diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-05 21:38:29 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-05 21:38:29 +0300 |
| commit | 568ffe0a9c0141c4530d962f134b4c5960d6ff9b (patch) | |
| tree | 8120c64bfa598a7dce86274a8e1f2eb9c4b8b5f9 /Software/Visual_Studio | |
| parent | f6fe86625120c894db221bac54aeb7bb483da0ad (diff) | |
| download | Tango-568ffe0a9c0141c4530d962f134b4c5960d6ff9b.tar.gz Tango-568ffe0a9c0141c4530d962f134b4c5960d6ff9b.zip | |
Improved remote upgrade UX.
Implemented last connected machine first in list.
Diffstat (limited to 'Software/Visual_Studio')
9 files changed, 87 insertions, 19 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/ApplicationUpgradeGeneratedViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/ApplicationUpgradeGeneratedViewVM.cs index 003aebab0..b90d73cc4 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/ApplicationUpgradeGeneratedViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/ApplicationUpgradeGeneratedViewVM.cs @@ -136,7 +136,7 @@ namespace Tango.FSE.Upgrade.ViewModels { CanUpgradeNowError = null; - if (!IsUpgradeNowSelected) return; + //if (!IsUpgradeNowSelected) return; if (SelectedMachine == null) { @@ -181,7 +181,7 @@ namespace Tango.FSE.Upgrade.ViewModels Handler = await RemoteUpgradeManager.PerformRemoteApplicationUpgrade(TemporaryTupFile, !SuppressFirmwareUpgrade); await Handler.WaitForCompletion(); IsCompleted = true; - await MachineProvider.DisconnectAndWaitForReconnection(TimeSpan.FromSeconds(20), TimeSpan.FromMinutes(1)); + await MachineProvider.DisconnectAndWaitForReconnection(TimeSpan.FromSeconds(20), TimeSpan.FromMinutes(1), "The remote machine is now performing final upgrade operations."); } catch (OperationCanceledException) { @@ -237,7 +237,6 @@ namespace Tango.FSE.Upgrade.ViewModels IsUpgradeNow = false; IsUpgradeNowSelected = false; TemporaryTupFile = null; - InvalidateCanUpgradeNow(); InvalidateRelayCommands(); } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/FirmwareUpgradeGeneratedViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/FirmwareUpgradeGeneratedViewVM.cs index 57cd3aa43..accc8d111 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/FirmwareUpgradeGeneratedViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/ViewModels/FirmwareUpgradeGeneratedViewVM.cs @@ -108,8 +108,6 @@ namespace Tango.FSE.Upgrade.ViewModels { CanUpgradeNowError = null; - if (!IsUpgradeNowSelected) return; - if (!MachineProvider.IsConnected) { CanUpgradeNow = false; @@ -158,7 +156,7 @@ namespace Tango.FSE.Upgrade.ViewModels Handler = await RemoteUpgradeManager.PerformRemoteFirmwareUpgrade(TfpFileLocation); await Handler.WaitForCompletion(); IsCompleted = true; - await MachineProvider.DisconnectAndWaitForReconnection(TimeSpan.FromSeconds(20), TimeSpan.FromMinutes(1)); + await MachineProvider.DisconnectAndWaitForReconnection(TimeSpan.FromSeconds(20), TimeSpan.FromMinutes(1),"The remote machine is now performing final upgrade operations."); } catch (OperationCanceledException) { @@ -202,7 +200,6 @@ namespace Tango.FSE.Upgrade.ViewModels SelectedVersion = null; IsUpgradeNowSelected = true; TfpFileLocation = null; - InvalidateCanUpgradeNow(); InvalidateRelayCommands(); } @@ -211,6 +208,7 @@ namespace Tango.FSE.Upgrade.ViewModels SelectedVersion = obj.SelectedVersion; TfpFileLocation = obj.TfpFileLocation; IsUsingExistingTfp = obj.IsExistingTfpFile; + InvalidateCanUpgradeNow(); } public async override Task<bool> OnNavigateBackRequest() diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/ApplicationUpgradeGeneratedView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/ApplicationUpgradeGeneratedView.xaml index c1f60d813..572785ee4 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/ApplicationUpgradeGeneratedView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/ApplicationUpgradeGeneratedView.xaml @@ -12,11 +12,11 @@ d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:ApplicationUpgradeGeneratedViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.ApplicationUpgradeGeneratedViewVM}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> <Grid IsEnabled="{Binding IsFree}"> <Grid IsEnabled="{Binding IsCompleted,Converter={StaticResource BooleanInverseConverter}}"> - <StackPanel> - <TextBlock FontSize="{StaticResource FSE_LargeFontSize}" Foreground="{StaticResource FSE_GreenBrush}">Application Upgrade Ready!</TextBlock> + <StackPanel Visibility="{Binding IsCompleted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock FontSize="{StaticResource FSE_LargeFontSize}" Foreground="{StaticResource FSE_GreenBrush}">Full Upgrade Ready!</TextBlock> <TextBlock Margin="0 10 0 0" Foreground="{StaticResource FSE_GrayBrush}" LineHeight="20"> - <Run>Your machine application and firmware upgrade is ready.</Run> + <Run>Your machine application and firmware upgrade is ready.</Run> </TextBlock> <StackPanel Visibility="{Binding IsUpgradeNow,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 5 0 0" > @@ -60,6 +60,14 @@ </StackPanel> </StackPanel> + <StackPanel Visibility="{Binding IsCompleted,Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock FontSize="{StaticResource FSE_LargeFontSize}" Foreground="{StaticResource FSE_GreenBrush}">Full Upgrade Completed!</TextBlock> + + <TextBlock Margin="0 10 0 0" Foreground="{StaticResource FSE_GrayBrush}" LineHeight="20"> + The remote machine should perform the final update operations and automatically reconnect. + </TextBlock> + </StackPanel> + <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="1000"> <DockPanel> <Grid DockPanel.Dock="Right" > diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/FirmwareUpgradeGeneratedView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/FirmwareUpgradeGeneratedView.xaml index a9d6034fd..c40389600 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/FirmwareUpgradeGeneratedView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Upgrade/Views/FirmwareUpgradeGeneratedView.xaml @@ -12,7 +12,7 @@ d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:FirmwareUpgradeGeneratedViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.FirmwareUpgradeGeneratedViewVM}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> <Grid IsEnabled="{Binding IsFree}"> <Grid IsEnabled="{Binding IsCompleted,Converter={StaticResource BooleanInverseConverter}}"> - <StackPanel> + <StackPanel Visibility="{Binding IsCompleted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <TextBlock FontSize="{StaticResource FSE_LargeFontSize}" Foreground="{StaticResource FSE_GreenBrush}">Firmware Upgrade Ready!</TextBlock> <TextBlock Margin="0 10 0 0" Foreground="{StaticResource FSE_GrayBrush}" LineHeight="20"> @@ -49,6 +49,14 @@ </StackPanel> </StackPanel> + <StackPanel Visibility="{Binding IsCompleted,Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock FontSize="{StaticResource FSE_LargeFontSize}" Foreground="{StaticResource FSE_GreenBrush}">Firmware Upgrade Completed!</TextBlock> + + <TextBlock Margin="0 10 0 0" Foreground="{StaticResource FSE_GrayBrush}" LineHeight="20"> + The remote machine should perform the final update operations and automatically reconnect. + </TextBlock> + </StackPanel> + <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="1000"> <DockPanel> <Grid DockPanel.Dock="Right" > diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs index 4d552d856..9a98477b8 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs @@ -79,7 +79,8 @@ namespace Tango.FSE.Common.Connection /// </summary> /// <param name="beginDelay">The amount of time to wait before starting reconnection attempts.</param> /// <param name="timeout">The timeout for when to drop the reconnection attempt.</param> + /// <param name="message">The message to display to the user</param> /// <returns></returns> - Task DisconnectAndWaitForReconnection(TimeSpan beginDelay, TimeSpan timeout); + Task DisconnectAndWaitForReconnection(TimeSpan beginDelay, TimeSpan timeout, String message = null); } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs index 759bcb4d5..6e1ec93a6 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs @@ -347,8 +347,9 @@ namespace Tango.FSE.UI.Connection /// </summary> /// <param name="beginDelay">The amount of time to wait before starting reconnection attempts.</param> /// <param name="timeout">The timeout for when to drop the reconnection attempt.</param> + /// <param name="message">The message to display to the user</param> /// <returns></returns> - public async Task DisconnectAndWaitForReconnection(TimeSpan beginDelay, TimeSpan timeout) + public async Task DisconnectAndWaitForReconnection(TimeSpan beginDelay, TimeSpan timeout, String message = null) { LogManager.Log("Starting disconnect and wait for machine procedure..."); LogManager.Log("Disconnecting from current machine..."); @@ -371,7 +372,7 @@ namespace Tango.FSE.UI.Connection } bool aborted = false; - MachineWaitForConnectionViewVM vm = new MachineWaitForConnectionViewVM(MachineOperator, (int)timeout.TotalSeconds); + MachineWaitForConnectionViewVM vm = new MachineWaitForConnectionViewVM(MachineOperator, (int)timeout.TotalSeconds, message); ThreadFactory.StartNew(() => { diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionView.xaml index 802b229f0..9c83de67c 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionView.xaml @@ -29,7 +29,7 @@ <StackPanel DockPanel.Dock="Top" Margin="0 10 0 0"> <TextBlock TextWrapping="Wrap" LineHeight="24"> - <Run>The connection with the machine had been lost due to a controlled disconnection.</Run> + <Run Text="{Binding Message}"></Run> <LineBreak/> <Run>This dialog will close as soon as the connection reestablishes.</Run> </TextBlock> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionViewVM.cs index 6b1dbb0b2..8d22720c2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionViewVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/MachineWaitForConnectionViewVM.cs @@ -32,13 +32,31 @@ namespace Tango.FSE.UI.Dialogs set { _remainingSeconds = value; RaisePropertyChangedAuto(); } } + private String _message; + /// <summary> + /// Gets or sets the message. + /// </summary> + public String Message + { + get { return _message; } + set { _message = value; RaisePropertyChangedAuto(); } + } + + /// <summary> /// Initializes a new instance of the <see cref="MachineWaitForConnectionViewVM"/> class. /// </summary> /// <param name="machine">The machine.</param> /// <param name="autoReconnectTimeout">The automatic reconnect timeout in seconds.</param> - public MachineWaitForConnectionViewVM(IExternalBridgeClient machine, int autoReconnectTimeout) + public MachineWaitForConnectionViewVM(IExternalBridgeClient machine, int autoReconnectTimeout, String message = null) { + Message = message; + + if (Message == null) + { + Message = "The connection with the machine had been lost due to a controlled disconnection."; + } + AutoMode = true; OKText = "CANCEL"; CanClose = false; diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs index cced594ea..dbd7819e8 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs @@ -173,17 +173,52 @@ namespace Tango.FSE.UI.Panes InvokeUI(() => { + bool insert = false; + + try + { + if (Settings.LastSelectedMachine != null) + { + if (machine.GetUniqueString() == Settings.LastSelectedMachine) + { + insert = true; + } + } + } + catch { } + if (machine is ExternalBridgeUsbClient) { - UsbMachines.Add(machine as ExternalBridgeUsbClient); + if (insert) + { + UsbMachines.Insert(0, machine as ExternalBridgeUsbClient); + } + else + { + UsbMachines.Add(machine as ExternalBridgeUsbClient); + } } else if (machine is ExternalBridgeSignalRClient) { - SignalRMachines.Add(machine as ExternalBridgeSignalRClient); + if (insert) + { + SignalRMachines.Insert(0, machine as ExternalBridgeSignalRClient); + } + else + { + SignalRMachines.Add(machine as ExternalBridgeSignalRClient); + } } else if (machine is ExternalBridgeTcpClient) { - TcpMachines.Add(machine as ExternalBridgeTcpClient); + if (insert) + { + TcpMachines.Insert(0, machine as ExternalBridgeTcpClient); + } + else + { + TcpMachines.Add(machine as ExternalBridgeTcpClient); + } } TryAutoSelectMachine(); |
