コード例 #1
0
ファイル: LatticeData.cs プロジェクト: dolkensp/OTWB
 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;
 }
コード例 #2
0
ファイル: LatticeDisplay.xaml.cs プロジェクト: dolkensp/OTWB
        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);
        }
コード例 #3
0
ファイル: LatticeData.cs プロジェクト: dolkensp/OTWB
 public void Remove(Line2D l)
 {
     if (l == null) return;
     l.PropertyChanged -= l_PropertyChanged;
     _items.Remove(l);
     if (LineRemoved != null)
         LineRemoved(this, l);
     
 }
コード例 #4
0
ファイル: LatticeDisplay.xaml.cs プロジェクト: dolkensp/OTWB
 Line CreateLine(Line2D ll)
 {
     Line l = ll.Visual;
     AttachPointerEvents(ref l);
     l.Stroke = (ll.Name == lastHilightName) ? hiliteBrush : normalBrush;
     return l;
 }
コード例 #5
0
ファイル: LatticeDisplay.xaml.cs プロジェクト: dolkensp/OTWB
 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;
 }
コード例 #6
0
ファイル: LatticeRimPage.xaml.cs プロジェクト: dolkensp/OTWB
 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);
 }
コード例 #7
0
ファイル: ViewModel.cs プロジェクト: dolkensp/OTWB
 void l_LineChanged(object sender, Line2D e)
 {
     if (LatticeDataChanged != null)
         LatticeDataChanged(this, new EventArgs());
 }