diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-06-23 09:05:29 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-06-23 09:05:29 +0300 |
| commit | 230f73f478a6428a975a51789b6f43ca7a8a5ef8 (patch) | |
| tree | 7d245111db13b87bae873e990d05ced7572df413 /Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs | |
| parent | 67af9764fef96f05f61e20942b865a22645ca836 (diff) | |
| download | Tango-230f73f478a6428a975a51789b6f43ca7a8a5ef8.tar.gz Tango-230f73f478a6428a975a51789b6f43ca7a8a5ef8.zip | |
Implemented FSE "Application Restart" on remote desktop.
Fixed issue with insufficient liquid quantities dialog on MS.
Added "Display Name" to MS RMLs list.
Implemented sorting to all rmls lists on PPC.
Implemented "Display Name" on all PPC rmls lists.
Diffstat (limited to 'Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs index e671bcfe5..b4031783c 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs @@ -11,9 +11,11 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media.Imaging; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.Core.Threading; using Tango.FSE.Common; using Tango.FSE.Common.Notifications; +using Tango.FSE.Common.RemoteActions; using Tango.FSE.Common.RemoteDesktop; using Tango.RemoteDesktop.Frames; using Tango.RemoteDesktop.Network; @@ -72,6 +74,9 @@ namespace Tango.FSE.PPCConsole.ViewModels set { _touchMode = value; RaisePropertyChangedAuto(); } } + [TangoInject] + public IRemoteActionsProvider RemoteActionsProvider { get; set; } + #endregion #region Commands @@ -111,6 +116,11 @@ namespace Tango.FSE.PPCConsole.ViewModels /// </summary> public RelayCommand StopRecordingCommand { get; set; } + /// <summary> + /// Gets or sets the restart application command. + /// </summary> + public RelayCommand RestartApplicationCommand { get; set; } + #endregion #region Constructors @@ -131,6 +141,7 @@ namespace Tango.FSE.PPCConsole.ViewModels TakeSnapshotCommand = new RelayCommand(TakeSnapshot); StartRecordingCommand = new RelayCommand(StartRecording); StopRecordingCommand = new RelayCommand(StopRecording, () => IsRecording); + RestartApplicationCommand = new RelayCommand(RestartApplication); } #endregion @@ -323,6 +334,44 @@ namespace Tango.FSE.PPCConsole.ViewModels RemoteDesktopProvider.SendCommand(RemoteDesktopCommand.HideAndOpenShell); } + private async void RestartApplication() + { + if (await NotificationProvider.ShowWarningQuestion("Are you sure you want to restart the remote application?", "RESTART")) + { + bool restarted = false; + + try + { + try + { + await RemoteDesktopProvider.EndSession(); + } + catch { } + + await Task.Factory.StartNew(RemoteActionsProvider.RestartApplication); + restarted = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error restarting the remote application."); + } + + if (restarted) + { + try + { + await MachineProvider.DisconnectAndWaitForReconnection(TimeSpan.FromSeconds(20), TimeSpan.FromMinutes(1), "The remote PPC is now restarting..."); + + if (MachineProvider.IsConnected) + { + StartRemoteDesktop(); + } + } + catch { } + } + } + } + #endregion #region Video Recording |
