diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-09 16:59:07 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-09 16:59:07 +0200 |
| commit | f7d320bcc6651d0c85bad73b52b14ba050a40c18 (patch) | |
| tree | 6f446d30c34da651e5cb2bed93caa0edc3a38f24 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 58c791b68d9058516166cc26fc15563bd56ebeb6 (diff) | |
| download | Tango-f7d320bcc6651d0c85bad73b52b14ba050a40c18.tar.gz Tango-f7d320bcc6651d0c85bad73b52b14ba050a40c18.zip | |
Refactored PPC firmware upgrade.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
7 files changed, 17 insertions, 48 deletions
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 c5dab127c..f8a0fdc36 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -63,11 +63,6 @@ namespace Tango.PPC.UI.PPCApplication public event EventHandler SetupRequired; /// <summary> - /// Occurs when firmware upgrade is required. - /// </summary> - public event EventHandler FirmwareUpgradeRequired; - - /// <summary> /// Occurs when the main window content has been rendered. /// </summary> public event EventHandler ContentRendered; @@ -164,7 +159,7 @@ 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."); - settings.ApplicationState = ApplicationStates.FirmwareUpgrade; + settings.ApplicationState = ApplicationStates.Ready; settings.Save(); } @@ -191,16 +186,11 @@ namespace Tango.PPC.UI.PPCApplication { try { - if (settings.ApplicationState == ApplicationStates.PreSetup || settings.ApplicationState == ApplicationStates.SemiSetup) + if (settings.ApplicationState == ApplicationStates.PreSetup) { LogManager.Log($"The application is in {settings.ApplicationState} state. database initialization skipped. Invoking setup required event!"); SetupRequired?.Invoke(this, new EventArgs()); } - else if (settings.ApplicationState == ApplicationStates.FirmwareUpgrade) - { - LogManager.Log($"The application is in {settings.ApplicationState} state. database initialization skipped. Invoking firmware upgrade required event!"); - FirmwareUpgradeRequired?.Invoke(this, new EventArgs()); - } else { PostDbInitialize(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs index dea9cdac4..1cde1fe1a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs @@ -79,7 +79,6 @@ namespace Tango.PPC.UI.ViewModels public FirmwareUpgradeViewVM(IPPCApplicationManager applicationManager, IFirmwareUpgrader firmwareUpgrader) { _firmwareUpgrader = firmwareUpgrader; - applicationManager.FirmwareUpgradeRequired += ApplicationManager_FirmwareUpgradeRequired; CompleteCommand = new RelayCommand(Complete); TryAgainCommand = new RelayCommand(TryAgain); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs index 02cc4ba33..16b1c05bc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -138,8 +138,6 @@ namespace Tango.PPC.UI.ViewModels public MachineSetupViewVM(IPPCApplicationManager applicationManager, IMachineSetupManager machineSetupManager) { MachineSetupManager = machineSetupManager; - //MachineSetupManager.ProgressLog += (x, msg) => AppendLog(msg); - MachineSetupManager.ProgressStep += (x, step) => AppendLog(Environment.NewLine + "-----------" + step.ToDescription().ToUpper() + "-----------" + Environment.NewLine); HostAddress = Settings.MachineServiceAddress; SerialNumber = ""; @@ -171,6 +169,7 @@ namespace Tango.PPC.UI.ViewModels } var logger = new SimpleStringLogger(); + logger.Categories.Remove(LogCategory.Debug); LogManager.RegisterLogger(logger); logger.LogReceived += Logger_LogReceived; @@ -275,11 +274,9 @@ namespace Tango.PPC.UI.ViewModels try { _setup_result = await MachineSetupManager.Setup(SerialNumber, HostAddress); - Settings.ApplicationState = ApplicationStates.SemiSetup; - Settings.Save(); State = MachineSetupStates.Completed; LogManager.Log("Machine setup completed."); - CompleteSetup(); + await NavigateTo(MachineSetupView.SetupCompletedView); } catch (Exception ex) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index 108752976..c201bf555 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -167,7 +167,7 @@ namespace Tango.PPC.UI.ViewModels { _update_result = await MachineUpdateManager.Update(MachineProvider.Machine.SerialNumber, Settings.MachineServiceAddress); LogManager.Log("Machine update completed."); - CompleteUpdate(); + await NavigateTo(MachineUpdateView.UpdateCompletedView); } catch (Exception ex) { @@ -178,14 +178,13 @@ namespace Tango.PPC.UI.ViewModels else { await NavigateTo(MachineUpdateView.UpdateDbProgressView); - LogManager.Log("Starting database update..."); try { await MachineUpdateManager.UpdateDB(_db_compare_result); LogManager.Log("Database update completed."); - await NavigateTo(MachineUpdateView.UpToDateView); + await NavigateTo(MachineUpdateView.UpdateCompletedView); } catch (Exception ex) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml index 82b211d4e..864d4aac9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml @@ -18,7 +18,7 @@ <Image Source="/Images/machine-update-firmware.png" Stretch="None" /> </StackPanel> - <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="2"> + <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="0"> <Grid controls:NavigationControl.NavigationName="FirmwareProgressView"> <StackPanel HorizontalAlignment="Center" Margin="0 0 0 0"> <TextBlock TextAlignment="Center" LineHeight="40" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}"> 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 4ac6dab92..829f284de 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -32,7 +32,7 @@ <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="0"> <Grid controls:NavigationControl.NavigationName="WelcomeView"> - <StackPanel HorizontalAlignment="Center" Margin="0 100 0 0"> + <StackPanel HorizontalAlignment="Center" Margin="0 20 0 0"> <TextBlock TextAlignment="Center" LineHeight="40" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}"> <Run>Welcome to the machine setup wizard!</Run> <Run>In the next steps the software will gather required information, perform tests and apply an initial configuration to this machine.</Run> @@ -93,24 +93,10 @@ <Run>Please wait while we're setting up this machine.</Run> <Run>Do not turn off this PC.</Run> </TextBlock> - - <touch:TouchBusyIndicator Width="100" Height="100" Margin="0 80 0 0"> - <touch:TouchBusyIndicator.Style> - <Style TargetType="touch:TouchBusyIndicator"> - <Setter Property="IsIndeterminate" Value="False"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding State}" Value="Working"> - <Setter Property="IsIndeterminate" Value="True"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchBusyIndicator.Style> - </touch:TouchBusyIndicator> - <touch:TouchStepProgressBar FontSize="12" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> - - <StackPanel Margin="100 100 100 0" Visibility="{Binding MachineSetupManager.CurrentStep,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='DownloadingPackage'}"> - <TextBlock Text="{Binding MachineSetupManager.DownloadingPackagesStatus,Mode=OneWay}"></TextBlock> - <touch:TouchProgressBar Margin="0 10 0 0" Height="10" Maximum="100" Value="{Binding MachineSetupManager.DownloadingPackagesProgress,Mode=OneWay}" /> + <StackPanel Margin="0 200 0 0"> + <TextBlock Text="{Binding MachineSetupManager.Status.Name,FallbackValue='Download Software Package'}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> + <TextBlock HorizontalAlignment="Center" Text="{Binding MachineSetupManager.Status.Message,FallbackValue='Connecting to machine service...'}" Margin="0 40 0 0"></TextBlock> + <touch:TouchProgressBar Margin="50 10" Height="10" IsIndeterminate="{Binding MachineSetupManager.Status.IsIntermediate}" Maximum="{Binding MachineSetupManager.Status.Total}" Value="{Binding MachineSetupManager.Status.Progress,Mode=OneWay}" /> </StackPanel> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineUpdateView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineUpdateView.xaml index 06a330675..ac0b9e36c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineUpdateView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineUpdateView.xaml @@ -119,13 +119,11 @@ <StackPanel> <TextBlock HorizontalAlignment="Center" Margin="0 40 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Updating your machine</TextBlock> <TextBlock Margin="0 10 0 0" TextAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayBrush}">Do not turn off the machine</TextBlock> - - <touch:TouchBusyIndicator Width="100" Height="100" Margin="0 80 0 0" IsIndeterminate="{Binding IsVisible}"></touch:TouchBusyIndicator> - <touch:TouchStepProgressBar FontSize="10" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type update:MachineUpdateSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineUpdateManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> - - <StackPanel Margin="100 100 100 0" Visibility="{Binding MachineUpdateManager.CurrentStep,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='DownloadingPackage'}"> - <TextBlock Text="{Binding MachineUpdateManager.DownloadingPackagesStatus,Mode=OneWay}"></TextBlock> - <touch:TouchProgressBar Margin="0 10 0 0" Height="10" Maximum="100" Value="{Binding MachineUpdateManager.DownloadingPackagesProgress,Mode=OneWay}" /> + + <StackPanel Margin="0 200 0 0"> + <TextBlock Text="{Binding MachineUpdateManager.Status.Name,FallbackValue='Download Software Package'}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> + <TextBlock HorizontalAlignment="Center" Text="{Binding MachineUpdateManager.Status.Message,FallbackValue='Connecting to machine service...'}" Margin="0 40 0 0"></TextBlock> + <touch:TouchProgressBar Margin="50 10" Height="10" IsIndeterminate="{Binding MachineUpdateManager.Status.IsIntermediate}" Maximum="{Binding MachineUpdateManager.Status.Total}" Value="{Binding MachineUpdateManager.Status.Progress,Mode=OneWay}" /> </StackPanel> </StackPanel> </Grid> |
