public void ExecuteFlow() { OrderExamineApproveFlowManager flow = DeserializeFlow(); if (flow != null) { flow.RunFlows(InitOrder()); } }
public void PersistFlow() { OrderExamineApproveFlowManager flowManager = OrderExamineApproveFlowManager.CreateFlows(); //通过持久化实现了初始化和运行的分离 using (Stream stream = File.Open(PersistXMLFile, FileMode.Create)) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, flowManager); } }
private OrderExamineApproveFlowManager DeserializeFlow() { OrderExamineApproveFlowManager flowManger = null; if (File.Exists(PersistXMLFile)) { using (Stream stream = File.Open(PersistXMLFile, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); flowManger = formatter.Deserialize(stream) as OrderExamineApproveFlowManager; } } return(flowManger); }