void graph_GetDrawType(object sender, DrawTypeEventArgs args) { if (IsDrawTextNode) { NodeVM node = new NodeVM(); node.UnitWidth = 150; node.UnitHeight = 50; node.Annotations = new List <IAnnotation>(); LabelVM label = new LabelVM(); label.Mode = ContentEditorMode.Edit; label.UnitWidth = 100; label.UnitHeight = 100; label.Content = ""; (node.Annotations as List <IAnnotation>).Add(label); args.DrawItem = node; node.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("IsSelected")) { INode n = s as INode; if (n.IsSelected) { (this.SelectedItems as SelectorVM).SelectorConstraints &= ~SelectorConstraints.QuickCommands; } else { (this.SelectedItems as SelectorVM).SelectorConstraints = SelectorConstraints.Default; foreach (IAnnotation annotaiton in n.Annotations as List <IAnnotation> ) { if (annotaiton.Content != null) { if (string.IsNullOrEmpty(annotaiton.Content.ToString())) { NodeCollection.Remove(s as NodeVM); break; } } } } } }; } else if (this.Shape.Equals("Rectangle")) { args.DrawItem = new System.Windows.Shapes.Rectangle() { StrokeThickness = 1.0, Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.White), Stretch = Stretch.Fill }; } else if (this.Shape.Equals("Ellipse")) { args.DrawItem = new System.Windows.Shapes.Ellipse() { StrokeThickness = 1.0, Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.White) }; } //else if (this.Shape.Equals("Line")) //{ //} }
/// <summary> /// The graph_ get draw type. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void graph_GetDrawType(object sender, DrawTypeEventArgs args) { if (this.IsDrawTextNode) { NodeVM node = new NodeVM(); node.UnitWidth = 150; node.UnitHeight = 50; node.Annotations = new List <IAnnotation>(); LabelVM label = new LabelVM(); label.Mode = ContentEditorMode.Edit; label.UnitWidth = 100; label.UnitHeight = 100; label.Content = string.Empty; (node.Annotations as List <IAnnotation>).Add(label); args.DrawItem = node; node.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("IsSelected")) { INode n = s as INode; if (n.IsSelected) { (this.SelectedItems as SelectorVM).SelectorConstraints &= ~SelectorConstraints.QuickCommands; } } }; } else if (this.Shape.Equals("Rectangle")) { args.DrawItem = new Rectangle { StrokeThickness = 1.0, Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.White), Stretch = Stretch.Fill }; } else if (this.Shape.Equals("Ellipse")) { args.DrawItem = new Ellipse { StrokeThickness = 1.0, Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.White) }; } }