Exemplo n.º 1
0
        public NodeControl CreateNode(ViewModel.Node viewModelNode, SuperGraphControl parentSurface)
        {
            NodeControl nodeControl = null;

            /// TODO: We will need to consider being able to have the same viewModelNode present here twice.
            if (!Nodes.ContainsKey(viewModelNode.Id))
            {
                nodeControl = new NodeControl();
                Canvas.SetZIndex(nodeControl, 50);
                nodeControl.ParentSurface = parentSurface;
                nodeControl.DataContext   = viewModelNode;
                nodeControl.VideoRemoteControl.DataContext = viewModelNode.VideoInfo;
                //nodeControl.NodeCornerControl.DataContext = viewModelNode;
                NodeControlFactorySet set = new NodeControlFactorySet();
                set.Node    = viewModelNode;
                set.Control = nodeControl;

                Nodes.Add(viewModelNode.Id, set);
            }
            else
            {
                nodeControl = Nodes[viewModelNode.Id].Control;
            }

            return(nodeControl);
        }
Exemplo n.º 2
0
        public NodeControlFactorySet RemoveNode(ViewModel.Node viewModelNode)
        {
            if (Nodes.ContainsKey(viewModelNode.Id))
            {
                NodeControlFactorySet removedSet = Nodes[viewModelNode.Id];
                Nodes.Remove(viewModelNode.Id);

                return(removedSet);
            }

            return(null);
        }