public static void Main() { if (null == sm_theProjectService) { sm_theProjectService = new Altaxo.Main.ProjectService(); sm_thePrintingService = new Altaxo.Main.PrintingService(); // we construct the main document sm_theProjectService.CurrentOpenProject = new AltaxoDocument(); MainController ctrl = new MainController(); sm_theWorkbench = new AltaxoWorkbench(new MainView()); ctrl.SetMenuToMainWindow(); // InitializeMainController(ctrl); } try { System.Windows.Forms.Application.Run(Current.MainWindow); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString()); } }
/// <summary> /// Sets the main project service. /// </summary> /// <param name="projectservice">The project service instance to use in this application.</param> public static void SetProjectService(Altaxo.Main.IProjectService projectservice) { if (null == sm_theProjectService) { sm_theProjectService = projectservice; } else { throw new ApplicationException("The project service can not be re-set to another value, only initialized for the first time!"); } }
protected override void OnClosing(CancelEventArgs e) { Altaxo.Main.IProjectService projectService = Altaxo.Current.ProjectService; if (projectService != null) { if (projectService.CurrentOpenProject != null && projectService.CurrentOpenProject.IsDirty) { projectService.AskForSavingOfProject(e); } } if (!e.Cancel) { base.OnClosing(e); } }
/// <summary> /// Sets the main project service. /// </summary> /// <param name="projectservice">The project service instance to use in this application.</param> public static void SetProjectService(Altaxo.Main.IProjectService projectservice) { if (null == sm_theProjectService) sm_theProjectService = projectservice; else throw new ApplicationException("The project service can not be re-set to another value, only initialized for the first time!"); }