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/Tango.PPC.UI | |
| 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/Tango.PPC.UI')
4 files changed, 35 insertions, 20 deletions
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> |
