public static void OpenProject() { OpenFileDialog dig = new OpenFileDialog(); dig.Filter = "流程图(*.flow)|*.flow"; if (dig.ShowDialog(FlowDesign) == DialogResult.OK) { try { if (LoadProject(dig.FileName)) { AddLogToMainLog("打开工程成功 " + dig.FileName); //写入最近打开的列表 StreamWriter sw = new StreamWriter(Application.StartupPath + "//Lately.log", true, Encoding.Default); sw.WriteLine(dig.FileName); sw.Close(); } else { AddLogToMainLog("打开工程失败 " + dig.FileName); } } catch (Exception ex) { FlowManager.ThrowExceptionToMain(ex); } } }
/// <summary> /// 初始胡InitFlow /// </summary> /// <returns></returns> public static void StartFlowManager() { FlowDesign = new FlowDesign(); Mediator = new Mediator(FlowDesign); FlowDesign.mediator = Mediator; Mediator.DockPanel = FlowDesign.DockPanel; //加载初始化界面 Mediator.OpenLogForm(); Mediator.OpenPropertiesForm(); Mediator.OpenShapeForm(); Mediator.OpenToolForm(); //首先加载用户的工程树 FlowManager.LoadDataBase(); //启动主界面 Application.Run(FlowDesign); //创建垃圾定时回收 ClearMemoryTimer = new System.Threading.Timer(delegate { ClearMemory(); }, null, 50000, 50000); }
public static void SaveAsProject(FlowProject Project) { if (Project == null) { FrmDialog.ShowDialog(FlowDesign, "没有工程可保存!"); return; } SaveFileDialog dig = new SaveFileDialog(); dig.Filter = "流程图(*.flow)|*.flow"; if (dig.ShowDialog(FlowDesign) == DialogResult.OK) { try { Project.FileFullName = dig.FileName; Save(Project); } catch (Exception ex) { FlowManager.ThrowExceptionToMain(ex); } } }