async void LoadPrc(long p_prcID) { _prc = (p_prcID < 0) ? await WfdPrc.New() : await WfdPrc.Get(p_prcID); IsChanged = false; _sketch.His.CmdChanged -= OnSketchChanged; _fv.Data = _prc; _sketch.ReadXml(_prc.Diagram); // 绑定所有节点和连线图元 foreach (var obj in _sketch.Container.Children) { if (obj is SNode node) { node.Tag = (from item in _prc.Atvs.Items where item.ID == node.ID select item).FirstOrDefault(); } else if (obj is SLine line) { line.Tag = (from item in _prc.Trss.Items where item.ID == line.ID select item).FirstOrDefault(); } } _prc.Modified += (s, e) => UpdateSaveState(); _sketch.His.Clear(); _sketch.His.CmdChanged += OnSketchChanged; }
public static async Task <WfdPrc> New() { var prc = new WfdPrc( ID: await AtCm.NewID(), Name: "新流程", IsLocked: true, Dispidx: await AtCm.NewSeq("sq_wfd_prc"), Ctime: Kit.Now); prc.Atvs = Table <WfdAtv> .Create(); prc.Trss = Table <WfdTrs> .Create(); prc.AtvRoles = Table <WfdAtvrole> .Create(); prc.AttachEvent(); return(prc); }