diff options
| author | Roy Ben Shabat <Roy@twine-s.com> | 2020-12-30 15:11:34 +0000 |
|---|---|---|
| committer | Roy Ben Shabat <Roy@twine-s.com> | 2020-12-30 15:11:34 +0000 |
| commit | d33c19b3ac6803de4b5c8d475832efef131c1a45 (patch) | |
| tree | ea725abc39def99a755b041c13cba1fe0d594ddc /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication | |
| parent | 1bdcaa9f51303bbff682507f31fb3b4414692ca4 (diff) | |
| download | Tango-d33c19b3ac6803de4b5c8d475832efef131c1a45.tar.gz Tango-d33c19b3ac6803de4b5c8d475832efef131c1a45.zip | |
Revert "Hope it is fine"
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 0235f8cca..feed9e193 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -42,6 +42,7 @@ namespace Tango.MachineStudio.UI.StudioApplication private INotificationProvider _notification; private List<Window> _openedWindows; private List<IStudioViewModel> _notified_view_models; + private bool _isDialogShown; /// <summary> /// Occurs when the application is ready. @@ -49,6 +50,11 @@ namespace Tango.MachineStudio.UI.StudioApplication public event EventHandler ApplicationReady; /// <summary> + /// Occurs when the connected machine session has been lost and an automatic reconnection with the last machine is required. + /// </summary> + public event EventHandler ReconnectionRequired; + + /// <summary> /// Initializes a new instance of the <see cref="DefaultStudioApplicationManager" /> class. /// </summary> /// <param name="navigationManager">The navigation manager.</param> @@ -132,15 +138,28 @@ namespace Tango.MachineStudio.UI.StudioApplication { String failed_reason = (sender as IMachineOperator).FailedStateException.Message; - ConnectionLostViewVM vm = new ConnectionLostViewVM() + if (!_isDialogShown) { - Exception = failed_reason - }; + _isDialogShown = true; - InvokeUI(() => - { - _notification.ShowModalDialog<ConnectionLostViewVM, ConnectionLostView>(vm, (x) => { }, () => { }); - }); + ConnectionLostViewVM vm = new ConnectionLostViewVM() + { + Exception = failed_reason, + AutoReconnect = true, + }; + + InvokeUI(() => + { + _notification.ShowModalDialog<ConnectionLostViewVM, ConnectionLostView>(vm, (x) => + { + _isDialogShown = false; + ReconnectionRequired?.Invoke(this, new EventArgs()); + }, () => + { + _isDialogShown = false; + }); + }); + } } } } @@ -272,7 +291,7 @@ namespace Tango.MachineStudio.UI.StudioApplication var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); if (eventLogger != null) { - eventLogger.Log(EventTypes.APPLICATION_TERMINATED, "Application Terminated!"); + //eventLogger.Log(EventTypes.APPLICATION_TERMINATED, "Application Terminated!"); eventLogger.FlushAll(); } |
