private UIElement ElementFactory(ElementType type) { //SetZoom(1.0);//置放大或者缩小为原点 UIElement element = null; double left = 0, right = 0; switch (type) { case ElementType.Begin: { element = new BeginControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height); break; } case ElementType.Activity: { element = new SMT.Workflow.Platform.Designer.DesignerControl.ActivityControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height); ((DesignerControl.ActivityControl)element).Title = "新建活动" + this.GetActivieyIdentityNo(); break; } case ElementType.Line: { element = new LineControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height); ((DesignerControl.LineControl)element).Title = "新建连线" + this.GetLineIdentityNo(); break; } case ElementType.Finish: { element = new FinishControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height); break; } } return element; }
public void ShowPropertyWindow(UIElement element) { _lineControl = element as LineControl;//旧的 if (_lineControl == null) { return; } #region 如果是新建连线就创对_lineObject对象 if (_lineObject == null) { LineObject obj = LineObjects.Where(p => p.LineId.Equals( _lineControl.UniqueID)).SingleOrDefault(); if (obj == null) { _lineObject = new LineObject(); _lineObject.LineId = _lineControl.UniqueID; } else { _lineObject = obj; } UpdateLineObject(_lineObject); } #endregion }
private List<LineControl> GetOtherLines(LineControl line) { var lines = from item in Elements where ((IControlBase)item).Type == ElementType.Line //&& ((IControlBase)item) != line select item; List<LineControl> otherLines = new List<LineControl>(); foreach (LineControl item in lines) { if (line.BeginElement == item.BeginElement) { otherLines.Add(item); } } return otherLines; }