private void Restart() { // Restarts the program for the current model ModelMetadata modelMetadata = dependencyInjection.Resolve <ModelMetadata>(); StartInstanceService startInstanceService = new StartInstanceService(); startInstanceService.StartInstance(modelMetadata.ModelFilePath); }
public static void Shutdown(string message, Exception e) { if (hasShutdown) { // Shutdown already in progress return; } hasShutdown = true; Log.Exception(e, message); if (isDispatcherInitialized) { var dispatcher = GetApplicationDispatcher(); if (dispatcher.CheckAccess()) { ShowExceptionDialog(e); } else { dispatcher.Invoke(() => ShowExceptionDialog(e)); } } if (Debugger.IsAttached) { Debugger.Break(); } if (DateTime.Now - StartTime >= MinTimeBeforeAutoRestart) { StartInstanceService.StartInstance(Environment.CurrentDirectory); } if (isDispatcherInitialized) { Application.Current.Shutdown(0); } else { throw new Exception($"Unhandled exception {message}", e); } }