public void Add(Line2D l) { _items.Add(l); l.Name = string.Format(LineNameFormat, namegen.Next()); if (LineChanged != null) LineChanged(this, l); l.PropertyChanged += l_PropertyChanged; }
void _lat_LineRemoved(object sender, Line2D ll) { UIElement toremove = null; foreach (UIElement uie in LatticeCanvas.Children) { if ((uie is Shape) && (uie as Shape).Name.StartsWith(ll.Name)) { toremove = uie; break; } } if (toremove != null) LatticeCanvas.Children.Remove(toremove); }
public void Remove(Line2D l) { if (l == null) return; l.PropertyChanged -= l_PropertyChanged; _items.Remove(l); if (LineRemoved != null) LineRemoved(this, l); }
Line CreateLine(Line2D ll) { Line l = ll.Visual; AttachPointerEvents(ref l); l.Stroke = (ll.Name == lastHilightName) ? hiliteBrush : normalBrush; return l; }
Line ReCreateLineWithIndex(Line2D ll) { Tuple<double, double> t = ScaleFactors; double st = lwidth / Math.Min(t.Item1, t.Item2); Line l = ll.Visual; AttachPointerEvents(ref l); l.Stroke = (ll.Name == lastHilightName) ? hiliteBrush : normalBrush; l.StrokeThickness = st; return l; }
private void Add_Line_Click(object sender, RoutedEventArgs e) { LatticeData ld = (viewModel.CurrentPathData as LatticeData); if (ld == null) return; Line2D l = new Line2D(new Point(0, 0), new Point(ld.Columns - 1, ld.Rows - 1)); ld.Add(l); }
void l_LineChanged(object sender, Line2D e) { if (LatticeDataChanged != null) LatticeDataChanged(this, new EventArgs()); }