aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs35
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();
}