private static void StatePropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args) { DDObject sender = (DDObject)d; DDManipulationState oldValue = (DDManipulationState)args.OldValue; sender.OnManipulationStateChanged(oldValue); }
protected override void CloneTo(DDObject target) { base.CloneTo(target); foreach (DDNodeWithHandles node in Nodes) { (target as DDNodeObject).Nodes.Add(node.Clone()); } }
public bool Contains(DDObject o) { foreach (DDObjectTC otc in _data) { if (otc.Target == o) { return(true); } } return(false); }
public void Add(DDObject newObject) { TargetBoundsCache = null; if (newObject is DDNodeObject) { _data.Add(DDNodeObjectTC.CreateInitializedInstance <DDNodeObjectTC>(newObject)); } else { _data.Add(DDObjectTC.CreateInitializedInstance <DDObjectTC>(newObject)); } OnPropertyChanged("Count"); }
protected virtual void CloneTo(DDObject target) { target.X = X; target.Y = Y; target.Width = Width; target.Height = Height; if (Fill != null) { target.Fill = Fill.Clone(); } if (Stroke != null) { target.Stroke = Stroke.Clone(); } target.StrokeThickness = StrokeThickness; //TODO: Add more when needed! }
public static DDObject TryCreateFromCLR(object clrSource) { if (!(clrSource is Shape)) { return(null); } DDObject newObject = null; if (clrSource is Path) { if (((clrSource as Path).Data is PathGeometry) && (((clrSource as Path).Data as PathGeometry).Figures.Count > 0)) { if (((clrSource as Path).Data as PathGeometry).Figures[0].IsFilled) { newObject = new DDPolygon(); } else { newObject = new DDPolyline(); } } } if (clrSource is Rectangle) { newObject = new DDRectangle(); } if (clrSource is Ellipse) { newObject = new DDEllipse(); } if (newObject != null) { if (newObject.SetFromCLR(clrSource as Shape)) { return(newObject); } } return(null); }
public void SetFromCanvas(Canvas source) { Width = source.Width; Height = source.Height; if (source.Background != null) { Background = source.Background.Clone(); } else { Background = null; } // TODO: Add more if needed foreach (UIElement element in source.Children) { DDObject newObject = DDObject.TryCreateFromCLR(element); if (newObject != null) { Children.Add(newObject); } } }
private static void AnyBoundsPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args) { DDObject sender = (DDObject)d; sender.OnBoundsChanged(); }