Exemple #1
0
 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;
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 public void Remove(Line2D l)
 {
     if (l == null) return;
     l.PropertyChanged -= l_PropertyChanged;
     _items.Remove(l);
     if (LineRemoved != null)
         LineRemoved(this, l);
     
 }
Exemple #4
0
 Line CreateLine(Line2D ll)
 {
     Line l = ll.Visual;
     AttachPointerEvents(ref l);
     l.Stroke = (ll.Name == lastHilightName) ? hiliteBrush : normalBrush;
     return l;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 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);
 }
Exemple #7
0
 void l_LineChanged(object sender, Line2D e)
 {
     if (LatticeDataChanged != null)
         LatticeDataChanged(this, new EventArgs());
 }