From c1686b546c6ecad789b7e5c6f67cb6b885363911 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Oct 2018 12:29:29 +0300 Subject: Enabled KeepAlive and for machine studio and implemented a connection lost dialog. --- .../DefaultStudioApplicationManager.cs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs') 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 8eff9ea4e..e6c687b92 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -22,6 +22,9 @@ using Tango.Core.DI; using Tango.BL.Entities; using Tango.BL; using Tango.MachineStudio.UI.ViewModels; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.Views; +using Tango.Integration.Operation; namespace Tango.MachineStudio.UI.StudioApplication { @@ -34,16 +37,18 @@ namespace Tango.MachineStudio.UI.StudioApplication { private INavigationManager _navigationManager; private IStudioModuleLoader _moduleLoader; + private INotificationProvider _notification; private List _openedWindows; /// /// Initializes a new instance of the class. /// /// The navigation manager. - public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader) + public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader, INotificationProvider notification) { _moduleLoader = moduleLoader; _navigationManager = navigationManager; + _notification = notification; _openedWindows = new List(); Application.Current.MainWindow.ContentRendered += (_, __) => @@ -109,8 +114,22 @@ namespace Tango.MachineStudio.UI.StudioApplication if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed) { ConnectedMachine = null; - } + if (e == Transport.TransportComponentState.Failed) + { + String failed_reason = (sender as IMachineOperator).FailedStateException.Message; + + ConnectionLostViewVM vm = new ConnectionLostViewVM() + { + Exception = failed_reason + }; + + InvokeUI(() => + { + _notification.ShowModalDialog(vm, (x) => { }, () => { }); + }); + } + } } /// -- cgit v1.3.1