Exemplo n.º 1
0
 private void Initial(NodesCanvasViewModel viewModelNodesCanvas, ConnectorViewModel fromConnector)
 {
     NodesCanvas           = viewModelNodesCanvas;
     FromConnector         = fromConnector;
     FromConnector.Connect = this;
     this.EndPoint         = fromConnector.PositionConnectPoint;
 }
Exemplo n.º 2
0
 public ConnectorViewModel(NodesCanvasViewModel nodesCanvas, NodeViewModel viewModelNode, string name, Point myPoint)
 {
     Node                 = viewModelNode;
     NodesCanvas          = nodesCanvas;
     Name                 = name;
     PositionConnectPoint = myPoint;
     SetupCommands();
     SetupSubscriptions();
 }
Exemplo n.º 3
0
        public NodeViewModel(NodesCanvasViewModel nodesCanvas, string name, Point point = default(Point))
        {
            NodesCanvas = nodesCanvas;
            Name        = name;
            Zindex      = nodesCanvas.Nodes.Count;
            Point1      = point;
            Transitions.Connect().ObserveOnDispatcher().Bind(TransitionsForView).Subscribe();
            SetupConnectors();

            SetupCommands();
            SetupBinding();
            SetupSubscriptions();
        }
Exemplo n.º 4
0
        public static ConnectViewModel FromXElement(NodesCanvasViewModel nodesCanvas, XElement node, out string errorMessage, Func <string, bool> actionForCheck)
        {
            ConnectViewModel viewModelConnect = null;

            errorMessage = null;
            string name = node.Attribute("Name")?.Value;
            string from = node.Attribute("From")?.Value;
            string to   = node.Attribute("To")?.Value;

            if (string.IsNullOrEmpty(name))
            {
                errorMessage = "Connect without name";
                return(viewModelConnect);
            }
            if (string.IsNullOrEmpty(from))
            {
                errorMessage = "Connect without from point";
                return(viewModelConnect);
            }
            if (string.IsNullOrEmpty(to))
            {
                errorMessage = "Connect without to point";
                return(viewModelConnect);
            }
            if (actionForCheck(name))
            {
                errorMessage = String.Format("Contains more than one connect with name \"{0}\"", name);
                return(viewModelConnect);
            }

            NodeViewModel nodeFrom = nodesCanvas.Nodes.Items.Single(x => x.Name == from);
            NodeViewModel nodeTo   = nodesCanvas.Nodes.Items.Single(x => x.Name == to);

            nodeFrom.CurrentConnector.Name = name;


            if (nodeFrom == nodeTo)
            {
                nodeFrom.CurrentConnector.CommandSetAsLoop.ExecuteWithSubscribe();
            }
            else
            {
                viewModelConnect             = new ConnectViewModel(nodeFrom.NodesCanvas, nodeFrom.CurrentConnector);
                viewModelConnect.ToConnector = nodeTo.Input;
                nodeFrom.CommandAddEmptyConnector.ExecuteWithSubscribe();
            }

            return(viewModelConnect);
        }
Exemplo n.º 5
0
        public static NodeViewModel FromXElement(NodesCanvasViewModel nodesCanvas, XElement node, out string errorMessage, Func <string, bool> actionForCheck)
        {
            errorMessage = null;
            NodeViewModel viewModelNode = null;
            string        name          = node.Attribute("Name")?.Value;

            if (string.IsNullOrEmpty(name))
            {
                errorMessage = "Node without name";
                return(viewModelNode);
            }

            if (actionForCheck(name))
            {
                errorMessage = String.Format("Contains more than one node with name \"{0}\"", name);
                return(viewModelNode);
            }

            viewModelNode = new NodeViewModel(nodesCanvas, name);

            return(viewModelNode);
        }
Exemplo n.º 6
0
 public CutterViewModel(NodesCanvasViewModel nodesCanvas)
 {
     NodesCanvas = nodesCanvas;
     SetupCommands();
     SetupSubscriptions();
 }
Exemplo n.º 7
0
 public ConnectViewModel(NodesCanvasViewModel viewModelNodesCanvas, ConnectorViewModel fromConnector)
 {
     Initial(viewModelNodesCanvas, fromConnector);
     SetupSubscriptions();
 }