public override void Run() { Form f = (Form)WorkbenchSingleton.Workbench; foreach (string file in SplashScreenForm.GetRequestedFileList()) { try { IFileService fileService = (IFileService)ServiceManager.Services.GetService(typeof(IFileService)); fileService.OpenFile(file); IViewContent viewContent = WorkbenchSingleton.Workbench.ActiveViewContent; if (viewContent != null) { viewContent.ViewSelected -= AlgorithmManager.Algorithms.ClearPadsHandler; viewContent.ViewSelected += AlgorithmManager.Algorithms.ClearPadsHandler; viewContent.SelectView(); AlgorithmManager.Algorithms.Timer.Enabled = false; } } catch (Exception e) { Console.WriteLine("不能打开文件: {0} 出现错误 :\n{1}", file, e.ToString()); } } Application.Run(f); // 退出程序后,最后保存工作台的状态. PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); if (WorkbenchSingleton.Workbench is IMementoCapable) { IXmlConvertable workbenchStatus = ((IMementoCapable)WorkbenchSingleton.Workbench).CreateMemento(); propertyService.SetProperty(workbenchMemento, workbenchStatus); } }
public override void Run() { using (NewFileDialog nfd = new NewFileDialog()) { nfd.Owner = (Form)WorkbenchSingleton.Workbench; nfd.ShowDialog(); } IViewContent content = WorkbenchSingleton.Workbench.ActiveViewContent; if (content != null) { content.ViewSelected += AlgorithmManager.Algorithms.ClearPadsHandler; content.SelectView(); AlgorithmManager.Algorithms.Timer.Enabled = false; } }