Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新连线的集合(如果连线不存在,就加入到集合里)
        /// </summary>
        /// <param name="activity">连线</param>
        /// <returns></returns>
        public void UpdateLineObject(LineObject activity)
        {
            var e = from a in LineObjects
                    where a.LineId == activity.LineId
                    select a;
            var ent = e.FirstOrDefault();

            if (ent != null)
            {
                //先删除后增加,保证数据是最新的
                LineObjects.Remove(ent);
                LineObjects.Add(activity);
            }
            else
            {
                LineObjects.Add(activity);
            }
        }