-
Notifications
You must be signed in to change notification settings - Fork 82
New SampleDeviceCollection #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
262d065
DeviceLab sample
GregPettyjohn 94cca6f
This is what I showed to Dave
GregPettyjohn 46cabd4
Committing so that I can change machines and not loose my work
GregPettyjohn aaa9c91
Added a bunch of finishing touches
GregPettyjohn d543959
Merge remote-tracking branch 'upstream/master'
GregPettyjohn cfd71a8
Latest polish
GregPettyjohn 078c278
Added a nifty CommandSequence class
GregPettyjohn 7a1388e
Implemented a nifty CommandSequence class and then used it for the De…
GregPettyjohn b8e1484
Merge remote-tracking branch 'upstream/master'
GregPettyjohn 66cd7f7
Code cleanup + style cop. Checking in for demo
GregPettyjohn 1239e90
Finished satisfyint StyleCop
GregPettyjohn 331267b
Syncing with latest from the main fork
GregPettyjohn 81712df
Merge remote-tracking branch 'upstream/master'
GregPettyjohn 99007d8
Committing before merging changes from upstream
GregPettyjohn 6a8a32b
Merge remote-tracking branch 'upstream/master'
GregPettyjohn ab8eed0
Integrated the new DeviceSignIn view. Fixed the timing issue in the r…
GregPettyjohn da099b2
Merge remote-tracking branch 'upstream/master'
GregPettyjohn a49bab9
Renamed DeviceLab to SampleDeviceCollection
GregPettyjohn 377b3c2
Added finishing touches to the code. Getting it ready for a pull request
GregPettyjohn 7e28aae
Merge the latest from the upstream repo
GregPettyjohn c8bef65
Update calls into the wrapper to use the latest async naming convention
GregPettyjohn 870c303
Not tracking sync.cmd
GregPettyjohn 6991238
Ended up with a stray orig file. Deleting
GregPettyjohn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <configuration> | ||
| <startup> | ||
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
| </startup> | ||
| </configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <Application x:Class="SampleDeviceCollection.App" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="clr-namespace:SampleDeviceCollection" | ||
| StartupUri="MainWindow.xaml"> | ||
| <Application.Resources> | ||
| <ResourceDictionary Source="Themes\CustomStyles.xaml" /> | ||
| </Application.Resources> | ||
| </Application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| //---------------------------------------------------------------------------------------------- | ||
| // <copyright file="App.xaml.cs" company="Microsoft Corporation"> | ||
| // Licensed under the MIT License. See LICENSE.TXT in the project root license information. | ||
| // </copyright> | ||
| //---------------------------------------------------------------------------------------------- | ||
| using System.Windows; | ||
|
|
||
| namespace SampleDeviceCollection | ||
| { | ||
| /// <summary> | ||
| /// Interaction logic for App.xaml | ||
| /// </summary> | ||
| public partial class App : Application | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| //---------------------------------------------------------------------------------------------- | ||
| // <copyright file="BooleanConverter.cs" company="Microsoft Corporation"> | ||
| // Licensed under the MIT License. See LICENSE.TXT in the project root license information. | ||
| // </copyright> | ||
| //---------------------------------------------------------------------------------------------- | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Globalization; | ||
| using System.Windows; | ||
| using System.Windows.Data; | ||
|
|
||
| namespace SampleDeviceCollection | ||
| { | ||
| //------------------------------------------------------------------- | ||
| // Boolean Converter | ||
| //------------------------------------------------------------------- | ||
| #region Boolean Converter | ||
| /// <summary> | ||
| /// Template allows for easy creation of a value converter for bools | ||
| /// </summary> | ||
| /// <typeparam name="T">Type to convert back and forth to boolean</typeparam> | ||
| /// <remarks> | ||
| /// See BooleanToVisibilityConverter and BooleanToBrushConverter (below) and usage in Generic.xaml | ||
| /// </remarks> | ||
| public class BooleanConverter<T> : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="BooleanConverter{T}" /> class. | ||
| /// </summary> | ||
| /// <param name="trueValue">The value of type T that represents true</param> | ||
| /// <param name="falseValue">The value of type T that represents false</param> | ||
| public BooleanConverter(T trueValue, T falseValue) | ||
| { | ||
| this.True = trueValue; | ||
| this.False = falseValue; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the value that represents true | ||
| /// </summary> | ||
| public T True { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the value that represetns false | ||
| /// </summary> | ||
| public T False { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Convert an object of type T to boolean | ||
| /// </summary> | ||
| /// <param name="value">Object of type T to convert</param> | ||
| /// <param name="targetType">The parameter is not used.</param> | ||
| /// <param name="parameter">The parameter is not used.</param> | ||
| /// <param name="culture">The parameter is not used.</param> | ||
| /// <returns>Object of boolean value</returns> | ||
| public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is bool && ((bool)value) ? this.True : this.False; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Convert a boolean value to an object of type T | ||
| /// </summary> | ||
| /// <param name="value">The boolean value to convert</param> | ||
| /// <param name="targetType">The parameter is not used.</param> | ||
| /// <param name="parameter">The parameter is not used.</param> | ||
| /// <param name="culture">The parameter is not used.</param> | ||
| /// <returns>Object of type T</returns> | ||
| public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is T && EqualityComparer<T>.Default.Equals((T)value, this.True); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Converter between a boolean and visibility value | ||
| /// </summary> | ||
| [type: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Small classes are all instances of the same generic and are better organized in a single file.")] | ||
| public sealed class BooleanToVisibilityConverter : BooleanConverter<Visibility> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="BooleanToVisibilityConverter" /> class. | ||
| /// </summary> | ||
| public BooleanToVisibilityConverter() : | ||
| base(Visibility.Visible, Visibility.Hidden) | ||
| { | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Converter between a boolean and either "http" or "https" | ||
| /// </summary> | ||
| [type: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Small classes are all instances of the same generic and are better organized in a single file.")] | ||
| public sealed class BooleanToHttpsConverter : BooleanConverter<string> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="BooleanToHttpsConverter" /> class. | ||
| /// </summary> | ||
| public BooleanToHttpsConverter() : | ||
| base("https", "http") | ||
| { | ||
| } | ||
| } | ||
| #endregion // Boolean Converter | ||
| } |
36 changes: 36 additions & 0 deletions
36
Samples/SampleDeviceCollection/Controls/AutoScrollTextBox.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| //---------------------------------------------------------------------------------------------- | ||
| // <copyright file="AutoScrollTextBox.cs" company="Microsoft Corporation"> | ||
| // Licensed under the MIT License. See LICENSE.TXT in the project root license information. | ||
| // </copyright> | ||
| //---------------------------------------------------------------------------------------------- | ||
| using System.Windows; | ||
| using System.Windows.Controls; | ||
|
|
||
| namespace SampleDeviceCollection | ||
| { | ||
| /// <summary> | ||
| /// A TextBox derrivative that automatically scrolls to end whenever new text is added. | ||
| /// This is used for presenting scrolling output spew. | ||
| /// </summary> | ||
| public class AutoScrollTextBox : TextBox | ||
| { | ||
| /// <summary> | ||
| /// Initializes static members of the <see cref="AutoScrollTextBox" /> class. | ||
| /// </summary> | ||
| static AutoScrollTextBox() | ||
| { | ||
| DefaultStyleKeyProperty.OverrideMetadata(typeof(AutoScrollTextBox), new FrameworkPropertyMetadata(typeof(AutoScrollTextBox))); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Override OnTextChanged to automatically scroll to the end | ||
| /// </summary> | ||
| /// <param name="e">The arguments associated with this event</param> | ||
| protected override void OnTextChanged(TextChangedEventArgs e) | ||
| { | ||
| base.OnTextChanged(e); | ||
| this.CaretIndex = Text.Length; | ||
| this.ScrollToEnd(); | ||
| } | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
Samples/SampleDeviceCollection/Controls/BindablePassword.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <UserControl x:Class="SampleDeviceCollection.BindablePassword" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| mc:Ignorable="d" | ||
| d:DesignHeight="23" d:DesignWidth="200"> | ||
| <Grid> | ||
| <PasswordBox Name="PasswordBox" PasswordChanged="PasswordBox_PasswordChanged"/> | ||
| </Grid> | ||
| </UserControl> |
73 changes: 73 additions & 0 deletions
73
Samples/SampleDeviceCollection/Controls/BindablePassword.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| //---------------------------------------------------------------------------------------------- | ||
| // <copyright file="BindablePassword.xaml.cs" company="Microsoft Corporation"> | ||
| // Licensed under the MIT License. See LICENSE.TXT in the project root license information. | ||
| // </copyright> | ||
| //---------------------------------------------------------------------------------------------- | ||
| using System.Security; | ||
| using System.Windows; | ||
| using System.Windows.Controls; | ||
|
|
||
| namespace SampleDeviceCollection | ||
| { | ||
| /// <summary> | ||
| /// Interaction logic for BindablePassword.xaml | ||
| /// </summary> | ||
| public partial class BindablePassword : UserControl | ||
| { | ||
| //------------------------------------------------------------------- | ||
| // Constructors | ||
| //------------------------------------------------------------------- | ||
| #region Constructors | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="BindablePassword" /> class. | ||
| /// </summary> | ||
| public BindablePassword() | ||
| { | ||
| this.InitializeComponent(); | ||
| } | ||
| #endregion // Constructors | ||
|
|
||
| //------------------------------------------------------------------- | ||
| // Dependency Properties | ||
| //------------------------------------------------------------------- | ||
| #region Dependency Properties | ||
| #region Password Dependency Property | ||
| /// <summary> | ||
| /// Gets or sets the Password dependency property | ||
| /// </summary> | ||
| public SecureString Password | ||
| { | ||
| get | ||
| { | ||
| return (SecureString)GetValue(PasswordProperty); | ||
| } | ||
|
|
||
| set | ||
| { | ||
| this.SetValue(PasswordProperty, value); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Password Dependeny Property static association | ||
| /// </summary> | ||
| public static readonly DependencyProperty PasswordProperty = | ||
| DependencyProperty.Register( | ||
| "Password", | ||
| typeof(SecureString), | ||
| typeof(BindablePassword), | ||
| new PropertyMetadata(default(SecureString))); | ||
|
|
||
| /// <summary> | ||
| /// Forwards change events to the password box's secure string to the Password dependency property | ||
| /// </summary> | ||
| /// <param name="sender">object that originated the event</param> | ||
| /// <param name="e">Parameters for the event</param> | ||
| private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) | ||
| { | ||
| this.Password = ((PasswordBox)sender).SecurePassword; | ||
| } | ||
| #endregion // Password Dependency Property | ||
| #endregion // Dependency Properties | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did I accidentally commit this file? sorry :(