Пример #1
0
        protected override void MonitorControlData(BaseGraphicalModel model)
        {
            if (model is PolygonGraphicalModel polygonModel)
            {
                polygonModel.PropertyChanged += (sender, e) =>
                {
                    if ("Points".Equals(e.PropertyName) && this.GraphicalShape.IsFocused)
                    {
                        DrawingControl();
                    }
                };
                polygonModel.Points.CollectionChanged += (sender, e) =>
                {
                    if (this.GraphicalShape.IsFocused)
                    {
                        switch (e.Action)
                        {
                        case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                        case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                        case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
                        case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
                            DrawingControl();
                            break;

                        case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
                            break;

                        default:
                            break;
                        }
                    }
                };
            }
        }
Пример #2
0
 protected override void MonitorControlData(BaseGraphicalModel model)
 {
     if (model is VerticalGraphicalModel verticalModel)
     {
         verticalModel.PropertyChanged += (sender, e) =>
         {
             if (this.GraphicalShape.IsFocused && ("X1".Equals(e.PropertyName) || "X2".Equals(e.PropertyName)))
             {
                 DrawingControl();
             }
         };
     }
     this.PropertyChanged += (sender, e) =>
     {
         if (this.GraphicalShape.IsFocused && "GraphicalModel".Equals(e.PropertyName))
         {
             DrawingControl();
         }
     };
 }
Пример #3
0
 public BaseGraphical(BaseGraphicalModel model)
 {
     this.GraphicalModel = model;
 }
Пример #4
0
 /// <summary>
 /// 监控数据模型,数据变化时,可能需要重新绘制门的控制按钮
 /// </summary>
 /// <param name="model"></param>
 protected abstract void MonitorControlData(BaseGraphicalModel model);