diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-13 20:02:59 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-13 20:02:59 +0200 |
| commit | 69c55f54ee7217f16419049a311ce437d3c19157 (patch) | |
| tree | 2c0c25115e07ad4eba5dd4bb4c150fe6d1f0c702 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 7b371c15dfb48c5182bbb704b5ea1ff1385b1d30 (diff) | |
| download | Tango-69c55f54ee7217f16419049a311ce437d3c19157.tar.gz Tango-69c55f54ee7217f16419049a311ce437d3c19157.zip | |
Fixed issue with PPC WIFI connection profiles.
Implemented OS restart after first setup.
Prevented PPC updater crashes without restarting PPC.
Implemented restarting system view on PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
10 files changed, 148 insertions, 4 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 a05e66f10..5fc7f00df 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -224,7 +224,14 @@ namespace Tango.PPC.UI.Connectivity if (vm.DialogResult) { - result = await network.Connect(auth); + result = await network.Connect(auth, true); + + if (!result) + { + await _notification.ShowError("Could not connect to the specified network. Please check your password."); + await network.Forget(); + } + await RefreshAvailableWiFiNetworks(); } else @@ -234,7 +241,7 @@ namespace Tango.PPC.UI.Connectivity } else { - result = await network.Connect(auth); + result = await network.Connect(auth, false); await RefreshAvailableWiFiNetworks(); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 2929908cc..39ce8cd30 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -46,6 +46,11 @@ namespace Tango.PPC.UI.PPCApplication private INotificationProvider _notificationProvider; /// <summary> + /// Occurs when a system restart is required. + /// </summary> + public event EventHandler SystemRestartRequired; + + /// <summary> /// Occurs when the application has started. /// </summary> public event EventHandler ApplicationStarted; @@ -141,6 +146,7 @@ namespace Tango.PPC.UI.PPCApplication PPCSettings settings = null; bool initialized = false; + bool isAfterSetup = false; await Task.Factory.StartNew(() => { @@ -163,8 +169,21 @@ namespace Tango.PPC.UI.PPCApplication if (App.StartupArgs.Contains("-update_ok")) { LogManager.Log("Application started with '-update_ok' startup arguments. The application has been successfully updated."); + + if (settings.ApplicationState == ApplicationStates.PreSetup) + { + isAfterSetup = true; + LogManager.Log("System restart is required."); + } + settings.ApplicationState = ApplicationStates.Ready; settings.Save(); + + if (isAfterSetup) + { + SystemRestartRequired?.Invoke(this, new EventArgs()); + return; + } } if (settings.ApplicationState == ApplicationStates.Ready) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 17598c085..f40bfa7de 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -144,6 +144,7 @@ <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModels\MachineUpdateViewVM.cs" /> <Compile Include="ViewModels\NoPermissionsViewVM.cs" /> + <Compile Include="ViewModels\RestartingSystemViewVM.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> <Compile Include="ViewsContracts\IMachineSetupView.cs" /> <Compile Include="ViewsContracts\IMachineUpdateView.cs" /> @@ -174,6 +175,9 @@ <Compile Include="Views\NoPermissionsView.xaml.cs"> <DependentUpon>NoPermissionsView.xaml</DependentUpon> </Compile> + <Compile Include="Views\RestartingSystemView.xaml.cs"> + <DependentUpon>RestartingSystemView.xaml</DependentUpon> + </Compile> <Page Include="Connectivity\WiFiAuthenticationView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -242,6 +246,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\RestartingSystemView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 444fd70b9..4eb5475f0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -102,6 +102,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<MachineUpdateViewVM>(); TangoIOC.Default.Register<LoadingErrorViewVM>(); TangoIOC.Default.Register<NoPermissionsViewVM>(); + TangoIOC.Default.Register<RestartingSystemViewVM>(); TangoIOC.Default.GetInstance<IPPCApplicationManager>().ContentRendered += (_, __) => @@ -191,5 +192,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance<NoPermissionsViewVM>(); } } + + public static RestartingSystemViewVM RestartingSystemViewVM + { + get + { + return TangoIOC.Default.GetInstance<RestartingSystemViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingSystemViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingSystemViewVM.cs new file mode 100644 index 000000000..b1cb57fce --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingSystemViewVM.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.OS; + +namespace Tango.PPC.UI.ViewModels +{ + public class RestartingSystemViewVM : PPCViewModel + { + private IOperationSystemManager _os; + private INavigationManager _navigationManager; + + public RestartingSystemViewVM(IPPCApplicationManager applicationManager, IOperationSystemManager operationSystemManager, INavigationManager navigationManager) + { + _navigationManager = navigationManager; + _os = operationSystemManager; + applicationManager.SystemRestartRequired += ApplicationManager_SystemRestartRequired; + } + + private void ApplicationManager_SystemRestartRequired(object sender, EventArgs e) + { + InvokeUI(() => + { + _navigationManager.NavigateTo(NavigationView.RestartingSystemView); + }); + } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + await Task.Delay(2000); + _os.Restart(); + } + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index 30b99dbbf..9437caac9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -65,7 +65,7 @@ <TextBlock DockPanel.Dock="Top" Margin="20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> Checking internet connection, please wait... </TextBlock> - <touch:TouchBusyIndicator Width="250" Margin="0 100 0 0" Height="250" IsIndeterminate="{Binding CurrentView,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='WiFiTestView'}" /> + <touch:TouchBusyIndicator Width="250" Margin="0 100 0 0" Height="250" IsIndeterminate="{Binding CurrentView,Converter={StaticResource EnumToBooleanConverter},ConverterParameter='WiFiTestView'}" /> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 6d1bde59d..c6e3fa6ea 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -89,6 +89,7 @@ <local:ExternalBridgeView></local:ExternalBridgeView> <local:MachineSetupView></local:MachineSetupView> <local:MachineUpdateView></local:MachineUpdateView> + <local:RestartingSystemView></local:RestartingSystemView> </controls:NavigationControl> </touch:TouchPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml new file mode 100644 index 000000000..996b1788d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml @@ -0,0 +1,27 @@ +<UserControl x:Class="Tango.PPC.UI.Views.RestartingSystemView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RestartingSystemViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RestartingSystemViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid> + + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <touch:TouchBusyIndicator Width="350" Height="350" IsIndeterminate="{Binding IsVisible}" Foreground="{StaticResource TangoGrayBrush}" /> + <TextBlock Margin="0 40 0 0" TextAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + <Run> + Setup completed. + </Run> + <LineBreak/> + <Run> + Restarting the system for the last time... + </Run> + </TextBlock> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml.cs new file mode 100644 index 000000000..1b426192e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Views +{ + /// <summary> + /// Interaction logic for RestartingSystemView.xaml + /// </summary> + public partial class RestartingSystemView : UserControl + { + public RestartingSystemView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 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> |
