diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-01 11:47:10 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-01 11:47:10 +0300 |
| commit | 00cfb0906e164487efed62bd6a65cdf681952bd1 (patch) | |
| tree | e5bc283226a0f758d63da4c05f761ce7801ac36e /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | d5c6067365e12674e95acaef4c4af45eaead8c3e (diff) | |
| download | Tango-00cfb0906e164487efed62bd6a65cdf681952bd1.tar.gz Tango-00cfb0906e164487efed62bd6a65cdf681952bd1.zip | |
Implemented reloading of color lab module and research module when machine designer changes machine !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs | 141 |
1 files changed, 74 insertions, 67 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index 99a6174a8..8d5981322 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -28,12 +28,12 @@ namespace Tango.MachineStudio.UI /// <summary> /// Interaction logic for App.xaml /// </summary> - public partial class App : Application + public partial class App : Application { private WpfGlobalExceptionTrapper exceptionTrapper; private LogManager LogManager = LogManager.Default; - protected override void OnStartup(StartupEventArgs e) + protected override void OnStartup(StartupEventArgs e) { #if DEBUG @@ -84,90 +84,97 @@ namespace Tango.MachineStudio.UI { try { - if (Application.Current == null) + try { - new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown }; + if (Application.Current == null) + { + new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown }; + } } - } - catch { } + catch { } - try - { - var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); - if (eventLogger != null) + try { - eventLogger.Log(e.Exception, "Application Crashed!"); + var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); + if (eventLogger != null) + { + eventLogger.Log(e.Exception, "Application Crashed!"); + } } - } - catch { } - - Application.Current.Dispatcher.Invoke(() => - { - WorkItem bug = null; - TeamFoundationServiceExtendedClient tfsClient = null; - INotificationProvider notification = null; + catch { } - try + Application.Current.Dispatcher.Invoke(() => { - tfsClient = TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>(); - notification = TangoIOC.Default.GetInstance<INotificationProvider>(); + WorkItem bug = null; + TeamFoundationServiceExtendedClient tfsClient = null; + INotificationProvider notification = null; + + try + { + tfsClient = TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>(); + notification = TangoIOC.Default.GetInstance<INotificationProvider>(); - if (tfsClient != null && tfsClient.IsInitialized) + if (tfsClient != null && tfsClient.IsInitialized) + { + bug = tfsClient.CreateBug(); + } + } + catch (Exception ex) { - bug = tfsClient.CreateBug(); + Debug.WriteLine(ex.ToString()); } - } - catch (Exception ex) - { - Debug.WriteLine(ex.ToString()); - } - ExceptionWindow exWin = new ExceptionWindow(e.Exception, bug != null); - exWin.ShowDialog(); + ExceptionWindow exWin = new ExceptionWindow(e.Exception, bug != null); + exWin.ShowDialog(); - switch (exWin.Resolution) - { - case ExceptionResolutions.Ignore: - e.TryRecover = true; - break; - case ExceptionResolutions.Restart: - e.TryRecover = false; - LogManager.Log("User selection was to restart the application. Restarting..."); - Process.Start(Application.ResourceAssembly.Location); - Environment.Exit(0); - break; - case ExceptionResolutions.Shutdown: - e.TryRecover = false; - LogManager.Log("User selection was to shutdown the application. Restarting..."); - Environment.Exit(0); - break; - case ExceptionResolutions.Report: - e.TryRecover = true; - LogManager.Log("User selection was to report the issue."); + switch (exWin.Resolution) + { + case ExceptionResolutions.Ignore: + e.TryRecover = true; + break; + case ExceptionResolutions.Restart: + e.TryRecover = false; + LogManager.Log("User selection was to restart the application. Restarting..."); + Process.Start(Application.ResourceAssembly.Location); + Environment.Exit(0); + break; + case ExceptionResolutions.Shutdown: + e.TryRecover = false; + LogManager.Log("User selection was to shutdown the application. Restarting..."); + Environment.Exit(0); + break; + case ExceptionResolutions.Report: + e.TryRecover = true; + LogManager.Log("User selection was to report the issue."); - if (bug != null) - { - notification.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(tfsClient.Project, bug), async (vm) => + if (bug != null) { - using (notification.PushTaskItem("Uploading bug report...")) + notification.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(tfsClient.Project, bug), async (vm) => { - try + using (notification.PushTaskItem("Uploading bug report...")) { - tfsClient.FinalizeBug(vm.WorkItem); - await tfsClient.UploadWorkItem(vm.WorkItem); + try + { + tfsClient.FinalizeBug(vm.WorkItem); + await tfsClient.UploadWorkItem(vm.WorkItem); + } + catch (Exception ex) + { + notification.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); + } } - catch (Exception ex) - { - notification.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); - } - } - }, null); - } + }, null); + } - break; - } - }); + break; + } + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in global exception trapper!"); + } } #endregion |
