diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-05-22 10:04:30 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-05-22 10:04:30 +0300 |
| commit | 00286559dbcb233f43709f776e4e0dc383ddc577 (patch) | |
| tree | 00811a3cd2056cebbafb52425916f06b619bbaf9 /Software/Visual_Studio/PPC | |
| parent | ce9b5061ed59521e5a7109ba7b652070bc981c94 (diff) | |
| parent | 0818e1de49a495cc057e9291f626f998ae97c095 (diff) | |
| download | Tango-00286559dbcb233f43709f776e4e0dc383ddc577.tar.gz Tango-00286559dbcb233f43709f776e4e0dc383ddc577.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC')
7 files changed, 44 insertions, 24 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml index dac37ba10..a8675f843 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml @@ -64,8 +64,8 @@ <Grid Margin="20" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"> <Grid Height="80"> <touch:TouchCheckBox VerticalAlignment="Top" Margin="60 0 0 0" IsChecked="{Binding AutoConnect}" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect automatically</touch:TouchCheckBox> - <touch:TouchButton EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ConnectToWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="17" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect</touch:TouchButton> - <touch:TouchButton EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisconnectFromWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="17" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}">Disconnect</touch:TouchButton> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ConnectToWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="20" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect</touch:TouchButton> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisconnectFromWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="20" Height="45" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}">Disconnect</touch:TouchButton> </Grid> <Grid Visibility="{Binding Connecting,Converter={StaticResource BooleanToVisibilityConverter}}" Background="{StaticResource TangoMidBackgroundBrush}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs index 85c25128a..67b73d4f6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs @@ -71,7 +71,7 @@ namespace Tango.PPC.Common.Connectivity /// </summary> /// <param name="network">The network.</param> /// <returns></returns> - Task<bool> Connect(WiFiNetwork network); + Task<bool> Connect(WiFiNetwork network, String password = null); /// <summary> /// Disconnects the specified network. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index ed3f7f796..e98a03404 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -33,11 +33,16 @@ namespace Tango.PPC.Common public int MachineScanningTimeoutSeconds { get; set; } /// <summary> - /// Gets or sets the name of the name of a WiFi network to automatically connect to when the application starts. + /// Gets or sets the name of the WiFi network to automatically connect to when the application starts. /// </summary> public String AutoConnectWiFiName { get; set; } /// <summary> + /// Gets or sets the password of the WiFi network to automatically connect to when the application starts. + /// </summary> + public String AutoConnectWiFiPassword { get; set; } + + /// <summary> /// Gets or sets the embedded COM port if not specified will use auto scanning. /// </summary> public String EmbeddedComPort { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs index e7aff7357..dabfc5893 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -27,6 +27,7 @@ namespace Tango.PPC.UI.Connectivity private Wifi _wifi; private INotificationProvider _notification; private IMachineProvider _machineProvider; + private Rfc2898Cryptographer _cryptographer; /// <summary> /// Occurs when the connectivity provider state has changed (e.g network connected/disconnected). @@ -83,6 +84,8 @@ namespace Tango.PPC.UI.Connectivity /// </summary> public DefaultConnectivityProvider(IPPCApplicationManager applicationManager, INotificationProvider notificationProvider, IMachineProvider machineProvider) { + _cryptographer = new Rfc2898Cryptographer(); + _notification = notificationProvider; _machineProvider = machineProvider; @@ -135,7 +138,8 @@ namespace Tango.PPC.UI.Connectivity if (auto_connect_network != null && !auto_connect_network.IsConnected) { - await Connect(auto_connect_network); + auto_connect_network.AutoConnect = true; + await Connect(auto_connect_network, _cryptographer.Decrypt(settings.AutoConnectWiFiPassword)); } }); } @@ -211,36 +215,45 @@ namespace Tango.PPC.UI.Connectivity /// </summary> /// <param name="network">The network.</param> /// <returns></returns> - public async Task<bool> Connect(WiFiNetwork network) + public async Task<bool> Connect(WiFiNetwork network, String password = null) { var auth = network.CreateAuthenticationRequest(); bool result = false; - if ((auth.IsPasswordRequired || auth.IsUserNameRequired) && !network.HasProfile) + if (password == null) { - var vm = await _notification.ShowDialog<WiFiAuthenticationViewVM>(new WiFiAuthenticationViewVM(auth, network)); - - if (vm.DialogResult) + if ((auth.IsPasswordRequired || auth.IsUserNameRequired) && !network.HasProfile) { - result = await network.Connect(auth, true); + var vm = await _notification.ShowDialog<WiFiAuthenticationViewVM>(new WiFiAuthenticationViewVM(auth, network)); - if (!result) + if (vm.DialogResult) { - await _notification.ShowError("Could not connect to the specified network. Please check your password."); - await network.Forget(); - } + result = await network.Connect(auth, true); - await RefreshAvailableWiFiNetworks(); + if (!result) + { + await _notification.ShowError("Could not connect to the specified network. Please check your password."); + await network.Forget(); + } + + await RefreshAvailableWiFiNetworks(); + } + else + { + return false; + } } else { - return false; + result = await network.Connect(auth, false); + await RefreshAvailableWiFiNetworks(); } } else { - result = await network.Connect(auth, false); + auth.Password = password; + result = await network.Connect(auth, true); await RefreshAvailableWiFiNetworks(); } @@ -249,6 +262,7 @@ namespace Tango.PPC.UI.Connectivity OnConnectionStateChanged(true); var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); settings.AutoConnectWiFiName = network.AutoConnect ? network.Name : null; + settings.AutoConnectWiFiPassword = _cryptographer.Encrypt(auth.Password); settings.Save(); } @@ -266,6 +280,7 @@ namespace Tango.PPC.UI.Connectivity { var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); settings.AutoConnectWiFiName = null; + settings.AutoConnectWiFiPassword = null; settings.Save(); network.AutoConnect = false; network.Disconnect().Wait(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml index 311c3ce99..d3f6f9e49 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml @@ -36,10 +36,10 @@ </Grid> <Grid Grid.Row="2"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> - <touch:TouchButton Command="{Binding CloseCommand}" CornerRadius="25" Width="170" Height="50" Style="{StaticResource TangoHollowButton}">CANCEL</touch:TouchButton> - <touch:TouchButton CornerRadius="25" Width="170" Height="50" Margin="10 0 0 0" Command="{Binding OKCommand}">CONNECT</touch:TouchButton> - </StackPanel> + <Grid> + <touch:TouchButton HorizontalAlignment="Left" Command="{Binding CloseCommand}" CornerRadius="25" Width="170" Height="50" Style="{StaticResource TangoHollowButton}">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Width="170" Height="50" Margin="10 0 0 0" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}">CONNECT</touch:TouchButton> + </Grid> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index dc9e111f3..5e3394ad6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.29.0")] +[assembly: AssemblyVersion("1.0.30.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> |
