예제 #1
0
 public AddLineCommand(ObservableCollection<LineViewModel> _lines, LineViewModel _line, NodeViewModel _fromNode, NodeViewModel _toNode)
 {
     lines = _lines;
     line = _line;
     fromNode = _fromNode;
     toNode = _toNode;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel()
 {
     NodeViewModel = new NodeViewModel(LineViewModel);
     LineViewModel = new LineViewModel(NodeViewModel);
     ////if (IsInDesignMode)
     ////{
     ////    // Code runs in Blend --> create design time data.
     ////}
     ////else
     ////{
     ////    // Code runs "for real"
     ////}
 }
예제 #3
0
파일: Tree.cs 프로젝트: Neeeeena/WinProG24
 public void addNeighbourAndLineAndUpdatePosition(NodeViewModel n1, NodeViewModel n2)
 {
     n1.addNeighbour(n2);
     LineViewModel temp = new LineViewModel(new Line()) { From = n1, To = n2 };
     Lines.Add(temp);
     addedLinesAutoBalance.Add(temp);
     if(int.Parse(n1.TxtOne) > int.Parse(n2.TxtOne))
     {
         n1.X = n2.X + X_OFFSET;
         n1.Y = n2.Y + Y_OFFSET;
     }
     else
     {
         n1.X = n2.X - X_OFFSET;
         n1.Y = n2.Y + Y_OFFSET;
     }
 }
예제 #4
0
        public void Execute()
        {
            clearSelectedNodes();
            foreach (NodeViewModel n in copiedNodes)
            {
                NodeViewModel node = n.newNodeViewModel();
                node.X += 30;
                node.Y += 30;
                Nodes.Add(node);
                addToSelectedNodes(node);
                mostRecentPastedNodes.Add(node);
            }

            foreach (LineViewModel l in copiedLines)
            {
                LineViewModel line = new LineViewModel(new Line() { From = l.From.Node, To = l.To.Node }) { From = l.From, To = l.To };
                foreach (NodeViewModel n in mostRecentPastedNodes)
                {

                    if (line.To.X + 30 == n.X && line.To.Y + 30 == n.Y)
                    {
                        line.To = n;

                    }
                    if (line.From.X + 30 == n.X && line.From.Y + 30 == n.Y)
                    {
                        line.From = n;

                    }
                }
                Lines.Add(line);
                line.From.addNeighbour(line.To);
                mostRecentPastedLines.Add(line);

            }
        }
예제 #5
0
 public AddLineCommand(ObservableCollection<LineViewModel> _lines, LineViewModel _line)
 {
     lines = _lines;
     line = _line;
 }