Example #1
0
 public DeleteClassCommand(ObservableCollection<NodeViewModel> classes, NodeViewModel focusedClass, ObservableCollection<EdgeViewModel> edges)
 {
     _classes = classes;
     _focusedClass = focusedClass;
     _edges = edges;
     _removedEdges = new ObservableCollection<EdgeViewModel>();
 }
Example #2
0
 public MoveNodeCommand(NodeViewModel _node, int _newX, int _newY, int _oldX, int _oldY, ObservableCollection<EdgeViewModel> _edges)
 {
     this.node = _node;
     this.newX = _newX;
     this.newY = _newY;
     this.oldX = _oldX;
     this.oldY = _oldY;
     this.edges = _edges;
 }
Example #3
0
 public EdgeViewModel(NodeViewModel nVMEndA, NodeViewModel nVMEndB, Edge edge)
 {
     this.edge = edge;
     NVMEndA = nVMEndA;
     NVMEndB = nVMEndB;
     Type = edgeTypeConverter(this.edge.Type);
     initArrow();
     newPath();
 }
Example #4
0
 public void Execute()
 {
     if (_class == null)
     {
         classes.Add(_class = new NodeViewModel() { ClassName = "New Class", X = 100, Y = 100, Id = _index });
     }
     else
     {
         classes.Add(_class);
     }
 }
Example #5
0
 public EdgeViewModel(NodeViewModel nVMEndA, NodeViewModel nVMEndB, EdgeType type)
 {
     edge = new Edge();
     NVMEndA = nVMEndA;
     NVMEndB = nVMEndB;
     MultA = "";
     MultB = "";
     Type = edgeTypeConverter(type);
     initArrow();
     newPath();
 }
        public System.Web.WebPages.HelperResult RenderRootLevelNode(NodeViewModel node)
        {
#line default
#line hidden
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 21 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"



#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "    <li>\n        <a");

                WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 643), Tuple.Create("\"", 659)

#line 23 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                                 , Tuple.Create(Tuple.Create("", 650), Tuple.Create <System.Object, System.Int32>(node.Url

#line default
#line hidden
                                                                                                                  , 650), false)
                                 );

                WriteAttributeTo(__razor_helper_writer, "target", Tuple.Create(" target=\"", 660), Tuple.Create("\"", 685)

#line 23 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                                 , Tuple.Create(Tuple.Create("", 669), Tuple.Create <System.Object, System.Int32>(node.LinkTarget

#line default
#line hidden
                                                                                                                  , 669), false)
                                 );

                WriteLiteralTo(__razor_helper_writer, "><strong>");


#line 23 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                WriteTo(__razor_helper_writer, node.Title);


#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "</strong></a>\n");


#line 24 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"


#line default
#line hidden

#line 24 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                if (node.ChildNodes.Count > 0)
                {
#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "            <ul");

                    WriteLiteralTo(__razor_helper_writer, " class=\"nav nav-stacked\"");

                    WriteLiteralTo(__razor_helper_writer, ">\n");


#line 27 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"


#line default
#line hidden

#line 27 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                    foreach (var childNode in node.ChildNodes)
                    {
#line default
#line hidden

#line 29 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                        WriteTo(__razor_helper_writer, RenderSubLevelsRecursive(childNode));


#line default
#line hidden

#line 29 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                    }


#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "            </ul>\n");


#line 32 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                }


#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "    </li>\n");


#line 34 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"


#line default
#line hidden
            }));

#line 34 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
        }
 public override bool MatchNode(NodeViewModel node)
 {
     return(base.MatchNode(node) && node.Parent != null && node.Parent.Type.IsArray);
 }
        public System.Web.WebPages.HelperResult RenderRootLevelNode(NodeViewModel node)
        {
#line default
#line hidden
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 41 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"

                if (node.ChildNodes.Count > 0)
                {
#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "        <li");

                    WriteLiteralTo(__razor_helper_writer, " class=\"dropdown\"");

                    WriteLiteralTo(__razor_helper_writer, ">\n            <a");

                    WriteLiteralTo(__razor_helper_writer, " href=\"#\"");

                    WriteLiteralTo(__razor_helper_writer, " data-toggle=\"dropdown\"");

                    WriteLiteralTo(__razor_helper_writer, " class=\"dropdown-toggle\"");

                    WriteLiteralTo(__razor_helper_writer, ">");


#line 45 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                    WriteTo(__razor_helper_writer, node.Title);


#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "\n                <span");

                    WriteLiteralTo(__razor_helper_writer, " class=\"caret\"");

                    WriteLiteralTo(__razor_helper_writer, "></span>\n            </a>\n            <ul");

                    WriteLiteralTo(__razor_helper_writer, " class=\"dropdown-menu\"");

                    WriteLiteralTo(__razor_helper_writer, ">\n");

                    WriteLiteralTo(__razor_helper_writer, "                ");


#line 49 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                    WriteTo(__razor_helper_writer, RenderSubLevelsRecursive(node));


#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "\n            </ul>\n        </li>\n");


#line 52 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                }
                else
                {
#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "        <li");

                    WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 1939), Tuple.Create("\"", 1962)

#line 55 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                     , Tuple.Create(Tuple.Create("", 1947), Tuple.Create <System.Object, System.Int32>(GetClass(node)

#line default
#line hidden
                                                                                                                       , 1947), false)
                                     );

                    WriteLiteralTo(__razor_helper_writer, "><a");

                    WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 1966), Tuple.Create("\"", 1982)

#line 55 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                     , Tuple.Create(Tuple.Create("", 1973), Tuple.Create <System.Object, System.Int32>(node.Url

#line default
#line hidden
                                                                                                                       , 1973), false)
                                     );

                    WriteAttributeTo(__razor_helper_writer, "target", Tuple.Create(" target=\"", 1983), Tuple.Create("\"", 2008)

#line 55 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                     , Tuple.Create(Tuple.Create("", 1992), Tuple.Create <System.Object, System.Int32>(node.LinkTarget

#line default
#line hidden
                                                                                                                       , 1992), false)
                                     );

                    WriteLiteralTo(__razor_helper_writer, ">");


#line 55 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                    WriteTo(__razor_helper_writer, node.Title);


#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "</a></li>\n");


#line 56 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                }


#line default
#line hidden
            }));

#line 57 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
        }
 /// <summary>
 /// Indicates whether the given node matches the given type, either with the <see cref="Stride.Core.Presentation.Quantum.ViewModels.NodeViewModel.Type"/> property
 /// or the type of the <see cref="Stride.Core.Presentation.Quantum.ViewModels.NodeViewModel.Value"/> property.
 /// </summary>
 /// <param name="node">The node to check.</param>
 /// <param name="type">The type to match.</param>
 /// <returns><c>true</c> if the node matches the given type, <c>false</c> otherwise.</returns>
 protected static bool MatchType([NotNull] NodeViewModel node, [NotNull] Type type)
 {
     return(type.IsAssignableFrom(node.Type) || type.IsInstanceOfType(node.NodeValue));
 }
Example #10
0
        //Create Nodes and Connetors
        private void CreateNodesAndConnectors()
        {
            //Create and Add node which is source reference for center connector. It will not be visible
            NodeViewModel emptyNode = AddNode(20, 85, 60, 290, null, false, "TextNodesViewTemplate");

            //Create and Add node for HIGH PETROL CONSUMPTION IN BIKE Node
            NodeViewModel highPetrolConsumptionNode = AddNode(65, 160, 860, 290, "HIGH PETROL\nCONSUMPTION IN BIKE", true, "HighPetrolConsumptionViewTemplate");

            //Create and Add node for MACHINERY Node
            NodeViewModel machineryNode = AddNode(20, 85, 200, 70, "MACHINERY", false, "TextNodesViewTemplate");

            //Create and Add node for METHOD Node
            NodeViewModel methodNode = AddNode(20, 85, 410, 70, "METHOD", false, "TextNodesViewTemplate");

            //Create and Add node for PEOPLE Node
            NodeViewModel peopleNode = AddNode(20, 85, 620, 70, "PEOPLE", false, "TextNodesViewTemplate");

            //Create and Add node for MATERIAL Node
            NodeViewModel materialNode = AddNode(20, 85, 180, 510, "MATERIAL", false, "TextNodesViewTemplate");

            //Create and Add node for MEASUREMENT Node
            NodeViewModel measurmentNode = AddNode(20, 95, 390, 510, "MEASUREMENT", false, "TextNodesViewTemplate");

            //Create and Add node for ENVIRONMENT Node
            NodeViewModel enviromentNode = AddNode(20, 95, 610, 510, "ENVIRONMENT", false, "TextNodesViewTemplate");

            //Create lineconnector from emptyNode to highPetrolConsumptionNode
            ConnectorViewModel mainConnector = AddConnector(emptyNode, highPetrolConsumptionNode, null, null, new Point(0, 0), "",
                                                            new Thickness(0, 0, 0, 0));

            //create multiple ports in the mainConnector
            ConnectorPort machineryConnectorEndPort  = AddPort(mainConnector, 0.25);
            ConnectorPort materialConnectorEndPort   = AddPort(mainConnector, 0.28);
            ConnectorPort methodConnectorEndPort     = AddPort(mainConnector, 0.58);
            ConnectorPort measurmentConnectorEndPort = AddPort(mainConnector, 0.60);
            ConnectorPort peopleConnectorEndPort     = AddPort(mainConnector, 0.90);
            ConnectorPort enviromentConnectorPort    = AddPort(mainConnector, 0.93);

            //Create connection between machineryNode and machineryConnectorEndPort
            ConnectorViewModel machineryConnector = AddConnector(machineryNode, null, machineryConnectorEndPort, mainConnector, new Point(0, 0), "",
                                                                 new Thickness(0, 0, 0, 0));

            //Create connection between materialNode and materialConnectorEndPort
            ConnectorViewModel materialConnector = AddConnector(materialNode, null, materialConnectorEndPort, mainConnector, new Point(0, 0), "",
                                                                new Thickness(0, 0, 0, 0));

            //Create connection between methodNode and methodConnectorEndPort
            ConnectorViewModel methodConnector = AddConnector(methodNode, null, methodConnectorEndPort, mainConnector, new Point(0, 0), "",
                                                              new Thickness(0, 0, 0, 0));

            //Create connection between measurmentNode and measurmentConnectorEndPort
            ConnectorViewModel measurmentConnector = AddConnector(measurmentNode, null, measurmentConnectorEndPort, mainConnector, new Point(0, 0), "",
                                                                  new Thickness(0, 0, 0, 0));

            //Create connection between peopleNode and peopleConnectorEndPort
            ConnectorViewModel peopleConnector = AddConnector(peopleNode, null, peopleConnectorEndPort, mainConnector, new Point(0, 0), "",
                                                              new Thickness(0, 0, 0, 0));

            //Create connection between enviromentNode and enviromentConnectorPort
            ConnectorViewModel enviromentConnector = AddConnector(enviromentNode, null, enviromentConnectorPort, mainConnector, new Point(0, 0), "",
                                                                  new Thickness(0, 0, 0, 0));

            //Create end point port for Worn-Out Pistons connector
            ConnectorPort WornOutPistonsPort = AddPort(machineryConnector, 0.25);

            //Create connector for Worn-Out Pistons
            ConnectorViewModel WornOutPistonsConnector = AddConnector(null, null, WornOutPistonsPort, machineryConnector, new Point(70, 133),
                                                                      "Worn-out Pistons", new Thickness(50, 15, 0, 0));

            //Create end point port for Wrong Tire Pressure Connector
            ConnectorPort WrongTirePressurePort = AddPort(machineryConnector, 0.54);

            //Create connector for Wrong Tire Pressure
            ConnectorViewModel WrongTirePressureConnector = AddConnector(null, null, WrongTirePressurePort, machineryConnector, new Point(80, 193),
                                                                         "Wrong Tire Pressure", new Thickness(55, 15, 0, 0));

            //Create end point port for Fast Driving Connector
            ConnectorPort FastDrivingPort = AddPort(methodConnector, 0.25);

            //Create connector for Fast Driving
            ConnectorViewModel FastDrivingConnector = AddConnector(null, null, FastDrivingPort, methodConnector, new Point(305, 133), "Fast Driving",
                                                                   new Thickness(35, 15, 0, 0));

            //Create end point port for Wrong Gear Connector
            ConnectorPort WrongGearPort = AddPort(methodConnector, 0.54);

            //Create connector for Wrong Gear
            ConnectorViewModel WrongGearConnector = AddConnector(null, null, WrongGearPort, methodConnector, new Point(330, 193), "Wrong Gear",
                                                                 new Thickness(35, 15, 0, 0));

            //Create end point port for Maintenance Habit Connector
            ConnectorPort MaintenanceHabitPort = AddPort(peopleConnector, 0.55);

            //Create connector for Maintenance Habit
            ConnectorViewModel MaintenanceHabitConnector = AddConnector(null, null, MaintenanceHabitPort, peopleConnector, new Point(510, 193),
                                                                        "Maintenance Habit", new Thickness(50, 15, 0, 0));

            //Create end point port for No Owner Manual Connector
            ConnectorPort NoOwnerManualConnectorPort = AddPort(MaintenanceHabitConnector, 0.77);

            //Create connector for No Owner Manual
            ConnectorViewModel NoOwnerManualConnector = AddConnector(null, null, NoOwnerManualConnectorPort, MaintenanceHabitConnector,
                                                                     new Point(600, 155), "No Owner Manual", new Thickness(0, 0, 20, 10));

            //Create end point port for Poor Quality Petrol Connector
            ConnectorPort PoorQualityPetrolPort = AddPort(materialConnector, 0.73);

            //Create connector for Poor Quality Petrol
            ConnectorViewModel PoorQualityPetrolConnector = AddConnector(null, null, PoorQualityPetrolPort, materialConnector, new Point(75, 345),
                                                                         "Poor Quality Petrol", new Thickness(50, 15, 0, 0));

            //Create end point port for FastDrivingConnector
            ConnectorPort IncorrectLubricantPort = AddPort(materialConnector, 0.26);

            //Create connector for Incorrect Lubricant
            ConnectorViewModel IncorrectLubricantConnector = AddConnector(null, null, IncorrectLubricantPort, materialConnector, new Point(70, 443),
                                                                          "Incorrect Lubricant", new Thickness(50, 15, 0, 0));

            //Create end point port for Wrong Oil Connector
            ConnectorPort WrongOilPort = AddPort(IncorrectLubricantConnector, 0.73);

            //Create connector for Wrong Oil
            ConnectorViewModel WrongOilConnector = AddConnector(null, null, WrongOilPort, WrongGearConnector, new Point(145, 410), "Wrong Oil",
                                                                new Thickness(0, 0, 10, 10));

            //Create end point port for Reset Odometer Connector
            ConnectorPort ResetOdometerPort = AddPort(measurmentConnector, 0.6);

            //Create connector for Reset Odometer
            ConnectorViewModel ResetOdometerConnector = AddConnector(null, null, ResetOdometerPort, measurmentConnector,
                                                                     new Point(300, 373), "Do not Reset\nOdometer Properly", new Thickness(50, 25, 0, 0));

            //Create end point port for Extreme Weather Conditions Connector
            ConnectorPort ExtremeWeatherConditionsPort = AddPort(enviromentConnector, 0.6);

            //Create connector for Extreme Weather Conditions
            ConnectorViewModel ExtremeWeatherConditionsConnector = AddConnector(null, null, ExtremeWeatherConditionsPort, enviromentConnector,
                                                                                new Point(520, 373), "Extreme Weather\nConditions", new Thickness(45, 25, 0, 0));
        }
 private void progressChanged(int roots, int currentRoot, NodeViewModel root)
 {
     if (SelectionBuildProgressChanged != null)
         SelectionBuildProgressChanged(roots, currentRoot, (root!=null)?root.VM:null);
 }
        private NodeViewModel addOrRetrieveNode(IISOViewModel vm)
        {
            NodeViewModel node = null;
            if (!_nodes.TryGetValue(vm.Rowguid, out node))
            {
                node = new NodeViewModel(vm, this);
                _nodes.Add(vm.Rowguid, node);
            }

            return node;
        }
Example #13
0
 public override bool MatchNode(NodeViewModel node)
 {
     return(node.Name == "InlinedProperty");
 }
 public override bool MatchNode(NodeViewModel node)
 {
     return(base.MatchNode(node) && node.Parent != null && (node.Parent.HasCollection || node.Parent.HasDictionary));
 }
 public void PropertiesTests()
 {
     var stateNodeMock = Mock.Create<StateNode>();
     var diagramViewModelMock = Mock.Create<IDiagramViewModel>();
     var vm = new NodeViewModel<StateNode, StateConnection>(stateNodeMock, diagramViewModelMock);
     TestsHelper.TestPublicDeclaredPropertiesGetSet(vm, true);
 }
Example #16
0
        //private static List<IExpressionField> GetCRFields(IExpressionField f, SourceFieldList sourceNodeList)
        //{
        //    Func<IExpressionField, ICollection<IExpressionField>> sfRetriever = srf => GetCRFields(f, sourceNodeList);
        //    return new List<IExpressionField>
        //    {
        //        new SourceField(sourceNodeList)
        //            {
        //                DataType = NodeDataType.String, 
        //                Name = "Name", 
        //                SetName = SourceFieldSetNames.Item, 
        //                SystemName = f.Name + ".Name", 
        //                ConnectorOut = { DataType = NodeDataType.String, Name = f.Name + ".Name" },
        //            },
        //        new SourceField(sourceNodeList)
        //            {
        //                DataType = NodeDataType.String, 
        //                Name = "Author", 
        //                SetName = SourceFieldSetNames.Item, 
        //                SystemName = f.Name + ".Author", 
        //                ConnectorOut = { DataType = NodeDataType.String, Name = f.Name + ".Author" },
        //                SubfieldsRetriever = sfRetriever
        //            }
        //    };
        //}

        #region States
        private static void SetupStatesDiagram(DiagramViewModel vm)
        {
            vm.Palette.Add(new NodeGroup("Common States", new List<NodeViewModel<StateNode, StateConnection>>
                                                              {
                                                                  new NodeViewModel<StateNode, StateConnection>(
                                                                      new StateNode
                                                                          {
                                                                              Name = "Default",
                                                                              Description = "Default",
                                                                              Width = 135,
                                                                              Height = 60
                                                                          }, vm),
                                                                  new NodeViewModel<StateNode, StateConnection>(
                                                                      new StateNode
                                                                          {
                                                                              Name = "Approved",
                                                                              Description = "Approved",
                                                                              Width = 135,
                                                                              Height = 60
                                                                          }, vm),
                                                                  new NodeViewModel<StateNode, StateConnection>(
                                                                      new StateNode
                                                                          {
                                                                              Name = "Rejected",
                                                                              Description = "Rejected",
                                                                              Width = 135,
                                                                              Height = 60
                                                                          }, vm),
                                                                  new NodeViewModel<StateNode, StateConnection>(
                                                                      new StateNode
                                                                          {
                                                                              Name = "ReadyToApprove",
                                                                              Description = "ReadyToApprove",
                                                                              Width = 135,
                                                                              Height = 60
                                                                          }, vm)
                                                              }));

            var defaultNode = new StateNode
                                  {Name = "Default", Description = "Default", Width = 135, Height = 60, Left = 10, Top = 10};
            var approvedNode = new StateNode
                                   {
                                       Name = "Approved",
                                       Description = "Approved",
                                       Width = 135,
                                       Height = 60,
                                       Left = 200,
                                       Top = 200
                                   };
            var rejectedNode = new StateNode
                                   {Name = "Rejected", Description = "Rejected", Width = 135, Height = 60, Left = 10, Top = 200};

            var defaultNodeVM = new NodeViewModel<StateNode, StateConnection>(defaultNode, vm);
            var approvedNodeVM = new NodeViewModel<StateNode, StateConnection>(approvedNode, vm);
            var rejectedNodeVM = new NodeViewModel<StateNode, StateConnection>(rejectedNode, vm);

            vm.Items.Add(defaultNodeVM);
            vm.Items.Add(approvedNodeVM);
            vm.Items.Add(rejectedNodeVM);

            var defaultToApprovedConnection = new StateConnection
                                                  {
                                                      SourceItem = defaultNode,
                                                      DestinationItem = approvedNode,
                                                      IsSecurityMode = true,
                                                      IsUnlocked = true
                                                  };
            var defaultToRejectedConnection = new StateConnection {SourceItem = defaultNode, DestinationItem = rejectedNode};
            var rejectedToDefaultConnection = new StateConnection {SourceItem = rejectedNode, DestinationItem = defaultNode};

            vm.Items.Add(new ConnectionViewModel<StateConnection>(defaultToApprovedConnection, defaultNodeVM, approvedNodeVM, vm));
            vm.Items.Add(new ConnectionViewModel<StateConnection>(defaultToRejectedConnection, defaultNodeVM, rejectedNodeVM, vm));
            vm.Items.Add(new ConnectionViewModel<StateConnection>(rejectedToDefaultConnection, rejectedNodeVM, defaultNodeVM, vm));
        }
 private void trimBranchContaining(NodeViewModel node)
 {
     NodeViewModel root = findRoot(node.VM);
     root.removeSuperfluousChildren();
     if (!root.isNecessary())
         removeRoot(root);
 }
 private void removeRoot(NodeViewModel root)
 {
     if (_roots.Contains(root))
     {
         _roots.Remove(root);
         raiseRootsChanged();
     }
 }
 private void recursiveAddNodeToSelection(NodeViewModel node)
 {
     //If this is a Generator, we can add all the ISOs below
     if (node.IsGenerator && !TruncateDataItems)
         recursiveAddToSelection(node.VM);
     else // we need to add only the injected ones
     {
         _selection.Add(node.VM.ISO);
         addPropertiesToSelection(node.VM);
         foreach (var childNode in node.Children)
             recursiveAddNodeToSelection(childNode);
     }
 }
Example #20
0
 public override bool MatchNode(NodeViewModel node)
 {
     return(node.Type != typeof(string) && (node.NodeValue == null || node.NodeValue.GetType().IsStruct() || node.NodeValue.GetType().IsClass));
 }
Example #21
0
        //Add Nodes
        private NodeViewModel AddNode(double height, double width, double offx, double offy, string label)
        {
            NodeViewModel n = new NodeViewModel();

            if (label == "")
            {
                n.UnitHeight = height;
                n.UnitWidth  = width;
                n.OffsetX    = offx;
                n.OffsetY    = offy;
                n.Shape      = new RectangleGeometry()
                {
                    Rect = new Rect(100, 400, 20, 40)
                };
                n.ShapeStyle = this.Resources["nvmstyle"] as Style;

                //To Represent Annotation Properties
                n.Annotations = new ObservableCollection <IAnnotation>()
                {
                    new AnnotationEditorViewModel()
                    {
                        Content = "HIGH PETROL \nCONSUMPTION IN BIKE",
                        TextHorizontalAlignment = TextAlignment.Center,
                        TextVerticalAlignment   = VerticalAlignment.Center,
                        HorizontalAlignment     = HorizontalAlignment.Center,
                        VerticalAlignment       = VerticalAlignment.Center,
                        ReadOnly     = true,
                        ViewTemplate = XamlReader.Load(IshikawaDiagramTemplate.vTemplate2) as DataTemplate,
                        //ViewTemplate=this.Resources["viewtemplate2"] as DataTemplate,
                    }
                };
                (diagramcontrol.Nodes as ICollection <NodeViewModel>).Add(n);
            }
            else
            {
                if (label == "MATERIAL" || label == "PEOPLE" || label == "METHOD" || label == "MACHINERY" || label == "MEASUREMENT" || label == "ENVIRONMENT")
                {
                    n.UnitHeight = height;
                    n.UnitWidth  = width;
                    n.OffsetX    = offx;
                    n.OffsetY    = offy;
                    n.Shape      = new RectangleGeometry()
                    {
                        Rect = new Rect(100, 500, 20, 40)
                    };
                    n.ShapeStyle = this.Resources["style"] as Style;

                    //To Represent Annotation Properties
                    n.Annotations = new ObservableCollection <IAnnotation>()
                    {
                        new AnnotationEditorViewModel()
                        {
                            Content  = label,
                            WrapText = TextWrapping.NoWrap,
                            //TextVerticalAlignment = VerticalAlignment.Bottom,
                            ReadOnly     = true,
                            ViewTemplate = XamlReader.Load(IshikawaDiagramTemplate.vTemplate1) as DataTemplate,
                            // ViewTemplate=this.Resources["viewtemplate1"] as DataTemplate,
                            Alignment = ConnectorAnnotationAlignment.Center,
                        }
                    };
                    (diagramcontrol.Nodes as ICollection <NodeViewModel>).Add(n);
                }
                else
                {
                    n.UnitHeight = height;
                    n.UnitWidth  = width;
                    n.OffsetX    = offx;
                    n.OffsetY    = offy;
                    n.Shape      = new RectangleGeometry()
                    {
                        Rect = new Rect(100, 300, 20, 40)
                    };
                    n.ShapeStyle = this.Resources["style"] as Style;

                    (diagramcontrol.Nodes as ICollection <NodeViewModel>).Add(n);
                }
            }
            return(n);
        }
 public override bool MatchNode(NodeViewModel node)
 {
     return(node.Type == typeof(EntityComponentCollection) && node.Parent?.Type == typeof(Entity));
 }
        public SegmentsViewModel()
        {
            //Initialize the Nodes Collection
            this.Nodes = new ObservableCollection <NodeViewModel>();
            //Initialize the connectors Collection
            this.Connectors = new ObservableCollection <ConnectorViewModel>();

            //Creating source node
            NodeViewModel sourceNode = new NodeViewModel()
            {
                UnitHeight = 80,
                UnitWidth  = 150,
                OffsetX    = 800,
                OffsetY    = 250,
                Shape      = App.Current.Resources["Rectangle"],
            };

            //Creating target node
            NodeViewModel targetNode = new NodeViewModel()
            {
                UnitHeight = 80,
                UnitWidth  = 150,
                OffsetX    = 700,
                OffsetY    = 200,
                Shape      = App.Current.Resources["Rectangle"],
            };

            //Adding the nodes into Collection
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(sourceNode);
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(targetNode);

            //create the connector with orthogonal segments
            ConnectorViewModel orthogonalConnector = new ConnectorViewModel()
            {
                SourcePoint = new Point(100, 100),
                TargetPoint = new Point(200, 200),
                //Initialize the connector segment collection
                Segments = new ObservableCollection <IConnectorSegment>()
                {
                    //Specify the segment as orthogonal segment
                    new OrthogonalSegment()
                },
                //Initialize the AnnotationCollection
                Annotations = new ObservableCollection <IAnnotation>()
                {
                    //Initialize the Annotation with content
                    new AnnotationEditorViewModel()
                    {
                        Content = "Orthogonal Connector"
                    }
                }
            };

            //create the connector with custom orthogonal segments.
            ConnectorViewModel customOrthogonalConnector = new ConnectorViewModel()
            {
                SourcePoint = new Point(300, 100),
                TargetPoint = new Point(600, 300),
                Segments    = new ObservableCollection <IConnectorSegment>()
                {
                    new OrthogonalSegment()
                    {
                        //Specify the direction of the segment
                        Direction = OrthogonalDirection.Right,
                        //Specify the length of the segment
                        Length = 100,
                    },
                    new OrthogonalSegment()
                    {
                        Direction = OrthogonalDirection.Bottom,
                        Length    = 100,
                    },
                    new OrthogonalSegment()
                    {
                        Direction = OrthogonalDirection.Right,
                        Length    = 100,
                    },
                    new OrthogonalSegment()
                    {
                        Direction = OrthogonalDirection.Bottom,
                        Length    = 100,
                    },
                    new OrthogonalSegment()
                    {
                        Direction = OrthogonalDirection.Right,
                        Length    = 100,
                    }
                },
                //Initialize the AnnotationCollection
                Annotations = new ObservableCollection <IAnnotation>()
                {
                    //Initialize the Annotation with content
                    new AnnotationEditorViewModel()
                    {
                        Content = "Custom Orthogonal Connector"
                    }
                }
            };

            //Connector with avoid overlapping
            ConnectorViewModel routingConnector = new ConnectorViewModel()
            {
                SourceNode = sourceNode,
                TargetNode = targetNode,
            };

            //create the connector with cubic bezier segments
            ConnectorViewModel cubicBezierConnector = new ConnectorViewModel()
            {
                SourcePoint = new Point(100, 300),
                TargetPoint = new Point(200, 400),
                Segments    = new ObservableCollection <IConnectorSegment>()
                {
                    //Specify the segment as cubic curve segment
                    new CubicCurveSegment()
                },
                //Initialize the AnnotationCollection
                Annotations = new ObservableCollection <IAnnotation>()
                {
                    //Initialize the Annotation with content
                    new AnnotationEditorViewModel()
                    {
                        Content = "Cubic segment"
                    }
                }
            };

            //create the connector with custom cubic bezier segments
            ConnectorViewModel customCubicBezier = new ConnectorViewModel()
            {
                SourcePoint = new Point(300, 300),
                TargetPoint = new Point(500, 500),
                Segments    = new ObservableCollection <IConnectorSegment>()
                {
                    //Specify the segment as cubic curve segment
                    new CubicCurveSegment()
                    {
                        //Specifies the left side control point
                        Point1 = new Point(250, 350),
                        //Specifies the right side control point
                        Point2 = new Point(460, 350),
                        //Specifies the ending point of the segment
                        Point3 = new Point(400, 400),
                    },
                    new CubicCurveSegment()
                    {
                        Point1 = new Point(300, 450),
                        Point2 = new Point(550, 460),
                    }
                },
                //Initialize the AnnotationCollection
                Annotations = new ObservableCollection <IAnnotation>()
                {
                    //Initialize the Annotation with content
                    new AnnotationEditorViewModel()
                    {
                        Content = "Custom cubic segment"
                    }
                }
            };

            //create the connector with qudratic bezier segments
            ConnectorViewModel qudraticBezierConnector = new ConnectorViewModel()
            {
                SourcePoint = new Point(100, 450),
                TargetPoint = new Point(200, 550),
                Segments    = new ObservableCollection <IConnectorSegment>()
                {
                    //Specify the segment as qudratic curve segment
                    new QuadraticCurveSegment()
                },
                //Initialize the AnnotationCollection
                Annotations = new ObservableCollection <IAnnotation>()
                {
                    //Initialize the Annotation with content
                    new AnnotationEditorViewModel()
                    {
                        Content = "Qudratic segment"
                    }
                }
            };

            //create the connector with multiple segments
            ConnectorViewModel multipleSegments = new ConnectorViewModel()
            {
                SourcePoint = new Point(600, 350),
                TargetPoint = new Point(950, 650),
                Segments    = new ObservableCollection <IConnectorSegment>()
                {
                    //Specify the segment as Quadratic curve segment
                    new QuadraticCurveSegment()
                    {
                        Point1 = new Point(550, 550),
                        Point2 = new Point(700, 430),
                    },
                    //Specify the segment as straight segment
                    new StraightSegment()
                    {
                        Point = new Point(800, 550),
                    },
                    //Specify the segment as orthogonal segment
                    new OrthogonalSegment()
                    {
                        Length = 100,
                    },
                },
                //Initialize the AnnotationCollection
                Annotations = new ObservableCollection <IAnnotation>()
                {
                    //Initialize the Annotation with content
                    new AnnotationEditorViewModel()
                    {
                        Content = "Multiple segments"
                    }
                }
            };

            //Adding connector into Collection
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(orthogonalConnector);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(customOrthogonalConnector);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(routingConnector);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(cubicBezierConnector);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(customCubicBezier);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(qudraticBezierConnector);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(multipleSegments);
        }
 private void addRoot(NodeViewModel root)
 {
     if (!_roots.Contains(root))
     {
         _roots.Add(root);
         raiseRootsChanged();
     }
 }
Example #25
0
        void CNode_Loaded(object sender, RoutedEventArgs e)
        {
            ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Scale |
                               ManipulationModes.Rotate;
            NodeViewModel vm   = this.DataContext as NodeViewModel;
            INodeInfo     info = vm.Info as INodeInfo;

            //this.Padding = new Thickness(5);
            if (info.InNeighbors != null)
            {
                INode parent = info.InNeighbors.FirstOrDefault();
                if (parent != null)
                {
                    this.UpdateLayout();
                    //Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                    {
                        Point diff = new Point(parent.OffsetX - OffsetX, parent.OffsetY - OffsetY);
                        CompositeTransform trans = RenderTransform as CompositeTransform;
                        Point to   = new Point(trans.TranslateX, trans.TranslateY);
                        Point from = new Point(to.X + diff.X, to.Y + diff.Y);


                        DoubleAnimation x = new DoubleAnimation();
                        x.EasingFunction = new ExponentialEase()
                        {
                            EasingMode = EasingMode.EaseOut, Exponent = 5
                        };
                        DoubleAnimation y = new DoubleAnimation();
                        y.EasingFunction = new ExponentialEase()
                        {
                            EasingMode = EasingMode.EaseOut, Exponent = 5
                        };
                        x.Duration = new Duration(TimeSpan.FromMilliseconds(200));
                        y.Duration = new Duration(TimeSpan.FromMilliseconds(200));
                        x.From     = from.X;
                        y.From     = from.Y;
                        //x.To = to.X;
                        //y.To = to.Y;
                        Storyboard.SetTarget(x, RenderTransform);
                        Storyboard.SetTarget(y, RenderTransform);
                        Storyboard.SetTargetProperty(x, "TranslateX");
                        Storyboard.SetTargetProperty(y, "TranslateY");
                        Storyboard sb = new Storyboard();
                        sb.Children.Add(x);
                        sb.Children.Add(y);
                        sb.Duration = new Duration(TimeSpan.FromMilliseconds(200));
                        sb.Begin();
                    }    //);
                    //Storyboard storyboard = new Storyboard();
                    //RepositionThemeAnimation xani = new RepositionThemeAnimation();
                    //xani.FromHorizontalOffset = parent.OffsetX - OffsetX;
                    //xani.FromVerticalOffset = parent.OffsetY - OffsetY;
                    //xani.Duration = new Duration(TimeSpan.FromMilliseconds(200));
                    //Storyboard.SetTarget(xani, this);
                    //storyboard.Children.Add(xani);
                    //storyboard.Begin();
                }
            }
            if ((this.DataContext as CustomNode).NodeAnnotations != null)
            {
                (((IEnumerable <object>)(this.DataContext as CustomNode).NodeAnnotations).ElementAt(0) as CustomLabel).PropertyChanged += CNode_PropertyChanged;
            }
        }
Example #26
0
 public SimpleNodeViewModel(string text, NodeViewModel parent = null)
     : this(text, false, parent)
 {
 }
Example #27
0
        //Create Node and Connection
        private void Nodeviewmodel()
        {
            int height = 20;
            int width  = 75;
            //Node Creation
            NodeViewModel n1 = AddNode(50, 100, 50, 320, null);
            NodeViewModel n2 = AddNode(75, 180, 900, 320, "");
            NodeViewModel n3 = AddNode(height, width, 150, 100, "MACHINERY");
            NodeViewModel n4 = AddNode(height, width, 400, 100, "METHOD");
            NodeViewModel n5 = AddNode(height, width, 650, 100, "PEOPLE");
            NodeViewModel n6 = AddNode(height, width, 150, 540, "MATERIAL");
            NodeViewModel n7 = AddNode(height, width, 400, 540, "MEASUREMENT");
            NodeViewModel n8 = AddNode(height, width, 650, 540, "ENVIRONMENT");

            //Create lineconnector from node to node
            Connector line = addlineconnector(n1, n2, null, null, new Point(0, 0), "", new Thickness(0, 0, 0, 0));

            //Fixed a port in a lineconnector
            ConnectorPort p1 = addport(line, 0.25);
            ConnectorPort p2 = addport(line, 0.28);
            ConnectorPort p3 = addport(line, 0.58);
            ConnectorPort p4 = addport(line, 0.60);
            ConnectorPort p5 = addport(line, 0.90);
            ConnectorPort p6 = addport(line, 0.93);

            //Add lineconnector from Node to Port
            Connector c1 = addlineconnector(n3, null, p1, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            Connector c2 = addlineconnector(n6, null, p2, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            Connector c3 = addlineconnector(n4, null, p3, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            Connector c4 = addlineconnector(n7, null, p4, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            Connector c5 = addlineconnector(n5, null, p5, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            Connector c6 = addlineconnector(n8, null, p6, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));

            ConnectorPort m1  = addport(c1, 0.25);
            Connector     mp1 = addlineconnector(null, null, m1, c1, new Point(65, 162), "Worn-out Pistons", new Thickness(55, 15, 0, 0));

            ConnectorPort m2  = addport(c1, 0.54);
            Connector     mp2 = addlineconnector(null, null, m2, c1, new Point(80, 225), "Wrong Tire Pressure", new Thickness(65, 15, 0, 0));

            ConnectorPort m3  = addport(c3, 0.25);
            Connector     mp3 = addlineconnector(null, null, m3, c3, new Point(310, 162), "Fast Driving", new Thickness(40, 15, 0, 0));

            ConnectorPort m4  = addport(c3, 0.54);
            Connector     mp4 = addlineconnector(null, null, m4, c3, new Point(330, 224), "Wrong Gear", new Thickness(40, 15, 0, 0));

            ConnectorPort m5  = addport(c5, 0.55);
            Connector     mp5 = addlineconnector(null, null, m5, c5, new Point(510, 224), "Maintenance Habit", new Thickness(60, 15, 0, 0));

            ConnectorPort m6  = addport(mp5, 0.80);
            Connector     mp6 = addlineconnector(null, null, m6, mp5, new Point(625, 185), "No Owner Manual", new Thickness(0, 0, 10, 10));

            ConnectorPort m7  = addport(c2, 0.73);
            Connector     mp7 = addlineconnector(null, null, m7, c2, new Point(95, 375), "Poor Quality Petrol", new Thickness(60, 15, 0, 0));

            ConnectorPort m8  = addport(c2, 0.26);
            Connector     mp8 = addlineconnector(null, null, m8, c2, new Point(60, 474), "Incorrect Lubricant", new Thickness(60, 15, 0, 0));

            ConnectorPort m9  = addport(mp8, 0.73);
            Connector     mp9 = addlineconnector(null, null, m9, mp4, new Point(130, 435), "Wrong Oil", new Thickness(0, 0, 10, 10));

            ConnectorPort m10  = addport(c4, 0.6);
            Connector     mp10 = addlineconnector(null, null, m10, c4, new Point(300, 403), "Do not Reset\nOdometer Properly", new Thickness(60, 25, 0, 0));

            ConnectorPort m11  = addport(c6, 0.6);
            Connector     mp11 = addlineconnector(null, null, m11, c6, new Point(520, 403), "Extreme Weather\nConditions", new Thickness(55, 25, 0, 0));
        }
Example #28
0
 public SimpleNodeViewModel(string text, bool allowDrag, NodeViewModel parent = null)
     : base(parent)
 {
     Text      = text;
     AllowDrag = AllowDrag;
 }
Example #29
0
 public PreviewControl(NodeViewModel nodeViewModel)
 {
     this.nodeViewModel = nodeViewModel;
     InitializeComponent();
     Loaded += OnPreviewControlLoaded;
 }
        public void Inline(ScriptViewModel script, NodeViewModel node)
        {
            var newScript = script.Script.Clone();
            var group     = new NodeGroup {
                Name = node.Name
            };

            newScript.Groups.Add(group);
            var externalPins = new List <PinWithConnection>();

            foreach (var scriptNode in newScript.Nodes)
            {
                foreach (var pinWithConnection in scriptNode.InputPins)
                {
                    if (pinWithConnection.Connection != null && pinWithConnection.Connection.NodeId == node.Id)
                    {
                        externalPins.Add(pinWithConnection);
                    }
                }
            }

            var newNodes         = newScript.MergeWith(_script, (float)node.Position.X, (float)node.Position.Y);
            var inputConnectors  = new Dictionary <string, ScriptNode>();
            var outputConnectors = new Dictionary <string, ScriptNode>();

            foreach (var scriptNode in newNodes)
            {
                scriptNode.GroupId = group.Id;
                if (NodeTypes.IsConnectorType(scriptNode.Type))
                {
                    if (scriptNode.InputPins[0].Connection == null)
                    {
                        inputConnectors.Add(scriptNode.Name, scriptNode);
                    }
                    else
                    {
                        outputConnectors.Add(scriptNode.Name, scriptNode);
                    }
                }
            }

            foreach (var nodeInputPin in node.Node.InputPins)
            {
                if (nodeInputPin.Connection != null)
                {
                    ScriptNode connector;
                    if (inputConnectors.TryGetValue(nodeInputPin.Id, out connector))
                    {
                        connector.InputPins[0].Connection = nodeInputPin.Connection;
                    }
                }
            }

            foreach (var externalConnection in externalPins)
            {
                ScriptNode connector;
                if (outputConnectors.TryGetValue(externalConnection.Connection.PinId, out connector))
                {
                    externalConnection.Connection = new Connection(connector.Id, connector.OutputPins[0].Id);
                }
                else
                {
                    externalConnection.Connection = null;
                }
            }

            newScript.Nodes.RemoveAt(node.Node.Id);
            script.Script = newScript;
        }
 /// <summary>
 /// Indicates whether this instance of <see cref="ITemplateProvider"/> can provide a template for the given <see cref="Stride.Core.Presentation.Quantum.ViewModels.NodeViewModel"/>.
 /// </summary>
 /// <param name="node">The node to test.</param>
 /// <returns><c>true</c> if this template provider can provide a template for the given node, <c>false</c> otherwise.</returns>
 /// <remarks>This method is invoked by <see cref="Match"/>.</remarks>
 public abstract bool MatchNode(NodeViewModel node);
Example #32
0
        private void OnItemSelected(object item)
        {
            propertyPanel.IsEnabled = true;
            if ((Diagram.DataContext as AnnotationsViewModel).prevbutton != null)
            {
                (Diagram.DataContext as AnnotationsViewModel).prevbutton.Style = this.Resources["AnnotationsButtonStyle"] as Style;
            }

            if (item is INode)
            {
                NodeViewModel node = item as NodeViewModel;
                foreach (IAnnotation annotation in node.Annotations as ObservableCollection <IAnnotation> )
                {
                    this.UpdatePropertyPanelElements(annotation);

                    #region Button selection for Node
                    if (annotation.Offset == new Point(0.5, 0.5))
                    {
                        this.Center.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = Center as Button;
                        break;
                    }
                    else if (annotation.Offset == new Point(0, 0))
                    {
                        this.TopLeft.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = TopLeft as Button;
                        break;
                    }
                    else if (annotation.Offset == new Point(1, 0))
                    {
                        this.TopRight.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = TopRight as Button;
                        break;
                    }
                    else if (annotation.Offset == new Point(0, 1))
                    {
                        this.BottomLeft.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = BottomLeft as Button;
                        break;
                    }
                    else if (annotation.Offset == new Point(1, 1))
                    {
                        this.BottomRight.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = BottomRight as Button;
                        break;
                    }
                    else if (annotation.Offset == new Point(0.5, 1))
                    {
                        this.MarginText.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = MarginText as Button;
                        break;
                    }
                    #endregion
                }
            }
            else
            {
                ConnectorViewModel connector = item as ConnectorViewModel;
                foreach (IAnnotation annotation in connector.Annotations as ObservableCollection <IAnnotation> )
                {
                    this.UpdatePropertyPanelElements(annotation);

                    #region Button Selection for connectors
                    if (annotation.Length == 0)
                    {
                        this.SourceText.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = SourceText as Button;
                        break;
                    }
                    else if (annotation.Length == 1)
                    {
                        this.TargetText.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = TargetText as Button;
                        break;
                    }
                    else if (annotation.Length == 0.5 && annotation.Margin == new Thickness(0, -10, 0, 0))
                    {
                        this.AboveCenter.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = AboveCenter as Button;
                        break;
                    }
                    else if (annotation.Length == 0.5 && annotation.Margin == new Thickness(0, 10, 0, 0))
                    {
                        this.BelowCenter.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = BelowCenter as Button;
                        break;
                    }
                    else if (annotation.Length == 0.5 && annotation.Margin == new Thickness(0, 0, 0, 0))
                    {
                        this.CenterText.Style = this.Resources["AnnotationsSelectedButtonStyle"] as Style;
                        (Diagram.DataContext as AnnotationsViewModel).prevbutton = CenterText as Button;
                        break;
                    }
                    #endregion
                }
            }
        }
        public System.Web.WebPages.HelperResult RenderSubLevelsRecursive(NodeViewModel node)
        {
#line default
#line hidden
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 61 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"

                foreach (var childNode in node.ChildNodes)
                {
                    if (childNode.ChildNodes.Count > 0)
                    {
#line default
#line hidden
                        WriteLiteralTo(__razor_helper_writer, "             <li");

                        WriteLiteralTo(__razor_helper_writer, " class=\"dropdown-submenu\"");

                        WriteLiteralTo(__razor_helper_writer, ">\n                <a");

                        WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 2319), Tuple.Create("\"", 2340)

#line 67 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                         , Tuple.Create(Tuple.Create("", 2326), Tuple.Create <System.Object, System.Int32>(childNode.Url

#line default
#line hidden
                                                                                                                           , 2326), false)
                                         );

                        WriteAttributeTo(__razor_helper_writer, "target", Tuple.Create(" target=\"", 2341), Tuple.Create("\"", 2371)

#line 67 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                         , Tuple.Create(Tuple.Create("", 2350), Tuple.Create <System.Object, System.Int32>(childNode.LinkTarget

#line default
#line hidden
                                                                                                                           , 2350), false)
                                         );

                        WriteLiteralTo(__razor_helper_writer, ">");


#line 67 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                        WriteTo(__razor_helper_writer, childNode.Title);


#line default
#line hidden
                        WriteLiteralTo(__razor_helper_writer, "\n                    <span");

                        WriteLiteralTo(__razor_helper_writer, " class=\"right-caret\"");

                        WriteLiteralTo(__razor_helper_writer, "></span>\n                </a>\n                <ul");

                        WriteLiteralTo(__razor_helper_writer, " class=\"dropdown-menu\"");

                        WriteLiteralTo(__razor_helper_writer, ">\n");

                        WriteLiteralTo(__razor_helper_writer, "                    ");


#line 71 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                        WriteTo(__razor_helper_writer, RenderSubLevelsRecursive(childNode));


#line default
#line hidden
                        WriteLiteralTo(__razor_helper_writer, "\n                </ul>\n            </li>\n");


#line 74 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                    }
                    else
                    {
#line default
#line hidden
                        WriteLiteralTo(__razor_helper_writer, "            <li");

                        WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 2653), Tuple.Create("\"", 2681)

#line 77 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                         , Tuple.Create(Tuple.Create("", 2661), Tuple.Create <System.Object, System.Int32>(GetClass(childNode)

#line default
#line hidden
                                                                                                                           , 2661), false)
                                         );

                        WriteLiteralTo(__razor_helper_writer, ">\n                <a");

                        WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 2702), Tuple.Create("\"", 2723)

#line 78 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                         , Tuple.Create(Tuple.Create("", 2709), Tuple.Create <System.Object, System.Int32>(childNode.Url

#line default
#line hidden
                                                                                                                           , 2709), false)
                                         );

                        WriteAttributeTo(__razor_helper_writer, "target", Tuple.Create(" target=\"", 2724), Tuple.Create("\"", 2754)

#line 78 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                                         , Tuple.Create(Tuple.Create("", 2733), Tuple.Create <System.Object, System.Int32>(childNode.LinkTarget

#line default
#line hidden
                                                                                                                           , 2733), false)
                                         );

                        WriteLiteralTo(__razor_helper_writer, ">");


#line 78 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                        WriteTo(__razor_helper_writer, childNode.Title);


#line default
#line hidden
                        WriteLiteralTo(__razor_helper_writer, "</a>\n            </li>\n");


#line 80 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
                    }
                }


#line default
#line hidden
            }));

#line 82 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Horizontal.cshtml"
        }
Example #34
0
 // Creates a new node in the network at the current mouse location.
 private void CreateNode(ModuleBase module)
 {
     //var newNodePosition = Mouse.GetPosition(networkControl);
     NodeViewModel nvw = this.ViewModel.CreateNode(module, contextMenuPosition, true);
 }
 /// <summary>
 /// This method is used to execute Flow command
 /// </summary>
 /// <param name="obj"></param>
 private void FlowExecution(object obj)
 {
     selectedradiobutton = obj.ToString();
     if ((SelectedItems as SelectorViewModel).Nodes as IEnumerable <object> != null && ((SelectedItems as SelectorViewModel).Nodes as IEnumerable <object>).Count() > 0)
     {
         ClearAll();
         NodeViewModel node = ((SelectedItems as SelectorViewModel).Nodes as IEnumerable <object>).First() as NodeViewModel;
         if (obj.ToString() == "Incoming Connections")
         {
             if ((node.Info as INodeInfo).InConnectors as IEnumerable <object> != null && ((node.Info as INodeInfo).InConnectors as IEnumerable <object>).Count() > 0)
             {
                 foreach (ConnectorViewModel con in (node.Info as INodeInfo).InConnectors as IEnumerable <object> )
                 {
                     con.ConnectorGeometryStyle = View.Resources["ConnectorGeometryStyleFE"] as Style;
                     con.TargetDecoratorStyle   = View.Resources["TargetDecoratorStyleFE"] as Style;
                 }
             }
         }
         else if (obj.ToString() == "Outgoing Connections")
         {
             if ((node.Info as INodeInfo).OutConnectors as IEnumerable <object> != null && ((node.Info as INodeInfo).OutConnectors as IEnumerable <object>).Count() > 0)
             {
                 foreach (ConnectorViewModel con in (node.Info as INodeInfo).OutConnectors as IEnumerable <object> )
                 {
                     con.ConnectorGeometryStyle = View.Resources["ConnectorGeometryStyleFE"] as Style;
                     con.TargetDecoratorStyle   = View.Resources["TargetDecoratorStyleFE"] as Style;
                 }
             }
         }
         else if (obj.ToString() == "Incoming and Outgoing Connections")
         {
             if ((node.Info as INodeInfo).InOutConnectors as IEnumerable <object> != null && ((node.Info as INodeInfo).InOutConnectors as IEnumerable <object>).Count() > 0)
             {
                 foreach (ConnectorViewModel con in (node.Info as INodeInfo).InOutConnectors as IEnumerable <object> )
                 {
                     con.ConnectorGeometryStyle = View.Resources["ConnectorGeometryStyleFE"] as Style;
                     con.TargetDecoratorStyle   = View.Resources["TargetDecoratorStyleFE"] as Style;
                 }
             }
         }
         else if (obj.ToString() == "Incoming Nodes")
         {
             if ((node.Info as INodeInfo).InNeighbors as IEnumerable <object> != null && ((node.Info as INodeInfo).InNeighbors as IEnumerable <object>).Count() > 0)
             {
                 foreach (NodeViewModel innode in (node.Info as INodeInfo).InNeighbors as IEnumerable <object> )
                 {
                     if (node != innode)
                     {
                         innode.ShapeStyle = View.Resources["NodeStyleFE"] as Style;
                     }
                 }
             }
         }
         else if (obj.ToString() == "Outgoing Nodes")
         {
             if ((node.Info as INodeInfo).OutNeighbors as IEnumerable <object> != null && ((node.Info as INodeInfo).OutNeighbors as IEnumerable <object>).Count() > 0)
             {
                 foreach (NodeViewModel outnode in (node.Info as INodeInfo).OutNeighbors as IEnumerable <object> )
                 {
                     if (node != outnode)
                     {
                         outnode.ShapeStyle = View.Resources["NodeStyleFE"] as Style;
                     }
                 }
             }
         }
         else if (obj.ToString() == "Incoming and Outgoing Nodes")
         {
             if ((node.Info as INodeInfo).InNeighbors as IEnumerable <object> != null && ((node.Info as INodeInfo).InNeighbors as IEnumerable <object>).Count() > 0)
             {
                 foreach (NodeViewModel innode in (node.Info as INodeInfo).InNeighbors as IEnumerable <object> )
                 {
                     if (node != innode)
                     {
                         innode.ShapeStyle = View.Resources["NodeStyleFE"] as Style;
                     }
                 }
             }
             if ((node.Info as INodeInfo).OutNeighbors as IEnumerable <object> != null && ((node.Info as INodeInfo).OutNeighbors as IEnumerable <object>).Count() > 0)
             {
                 foreach (NodeViewModel outnode in (node.Info as INodeInfo).OutNeighbors as IEnumerable <object> )
                 {
                     if (node != outnode)
                     {
                         outnode.ShapeStyle = View.Resources["NodeStyleFE"] as Style;
                     }
                 }
             }
         }
         else if (obj.ToString() == "Flow of execution")
         {
             if ((node.Info as INodeInfo).OutConnectors as IEnumerable <object> != null && ((node.Info as INodeInfo).OutConnectors as IEnumerable <object>).Count() > 0)
             {
                 foreach (ConnectorViewModel con in (node.Info as INodeInfo).OutConnectors as IEnumerable <object> )
                 {
                     AdjacentStyle(con);
                 }
             }
         }
         else
         {
             ClearAll();
         }
     }
     else
     {
         MessageBox.Show("Select any Node to find its Flow Execution");
     }
 }
Example #36
0
        public MainWindow()
        {
            InitializeComponent();


            (diagram.Info as IGraphInfo).ItemSelectedEvent += MainWindow_ItemSelectedEvent;
            (diagram.Info as IGraphInfo).ItemAdded         += MainWindow_ItemAdded;
            NodeViewModel Node1 = CreateNode(590, 120, "Rectangle", "Shape1");
            NodeViewModel Node2 = CreateNode(550, 260, "RoundedRectangle", "shape2");
            NodeViewModel Node3 = CreateNode(900, 500, "RoundedRectangle", "shape3");

            CreateGroup(Node1, Node2);

            ContainerViewModel contaier1 = new ContainerViewModel()
            {
                UnitHeight  = 300,
                UnitWidth   = 300,
                OffsetX     = 850,
                OffsetY     = 450,
                Annotations = new AnnotationCollection()
                {
                    new AnnotationEditorViewModel()
                    {
                        Content = "Container",
                    },
                },
                Shape      = this.Resources["Rectangle"],
                ShapeStyle = this.Resources["GroupContainerStyle"] as Style,
                Nodes      = new ObservableCollection <NodeViewModel>()
                {
                    Node3,
                },
            };

            BpmnNodeViewModel bpmnEvent = new BpmnNodeViewModel()
            {
                OffsetX     = 300,
                OffsetY     = 250,
                UnitHeight  = 70,
                UnitWidth   = 100,
                Type        = BpmnShapeType.Event,
                Annotations = new AnnotationCollection()
                {
                    new AnnotationEditorViewModel()
                    {
                        Content = "BPMN shape 1",
                    },
                },
            };

            BpmnGroupViewModel bpmngroup = new BpmnGroupViewModel()
            {
                OffsetX    = 300,
                OffsetY    = 300,
                UnitWidth  = 300,
                UnitHeight = 250,
                Shape      = this.Resources["Rectangle"],
                //ShapeStyle = this.Resources["GroupShapeStyle"] as Style,
                Annotations = new AnnotationCollection()
                {
                    new AnnotationEditorViewModel()
                    {
                        Content = "BPMN group1",
                    },
                },
                Nodes = new ObservableCollection <NodeViewModel>()
                {
                    bpmnEvent,
                },
            };

            // Add the group into the Group's collection.
            (diagram.Groups as GroupCollection).Add(bpmngroup);
            (diagram.Groups as GroupCollection).Add(contaier1);
            //(diagram.Info as IGraphInfo).ItemDropEvent += MainWindow_ItemDropEvent;

            //diagram.PreviewSettings = new PreviewSettings()
            //{
            //    PreviewMode = PreviewMode.Preview,
            //};

            Groupshapestyle.Setters.Add(new Setter(Path.StrokeProperty, Brushes.Black));
            Groupshapestyle.Setters.Add(new Setter(Path.StrokeThicknessProperty, 1d));
            Groupshapestyle.Setters.Add(new Setter(Path.StretchProperty, Stretch.Fill));
            Groupshapestyle.Setters.Add(new Setter(Path.FillProperty, Brushes.White));
            Groupshapestyle.Setters.Add(new Setter(Path.StrokeDashArrayProperty, new DoubleCollection()
            {
                5, 1, 5
            }));
        }
        public System.Web.WebPages.HelperResult RenderSubLevelsRecursive(NodeViewModel node)
        {
#line default
#line hidden
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 38 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"



#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "    <li>\n        <a");

                WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 1134), Tuple.Create("\"", 1150)

#line 40 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                                 , Tuple.Create(Tuple.Create("", 1141), Tuple.Create <System.Object, System.Int32>(node.Url

#line default
#line hidden
                                                                                                                   , 1141), false)
                                 );

                WriteLiteralTo(__razor_helper_writer, " target =\"");


#line 40 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                WriteTo(__razor_helper_writer, node.LinkTarget);


#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "\">");


#line 40 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                WriteTo(__razor_helper_writer, node.Title);


#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "</a>\n");


#line 41 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"


#line default
#line hidden

#line 41 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                if (node.ChildNodes.Count > 0)
                {
#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "            <ul");

                    WriteLiteralTo(__razor_helper_writer, " class=\"nav\"");

                    WriteLiteralTo(__razor_helper_writer, ">\n");


#line 44 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"


#line default
#line hidden

#line 44 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                    foreach (var childNode in node.ChildNodes)
                    {
#line default
#line hidden

#line 46 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                        WriteTo(__razor_helper_writer, RenderSubLevelsRecursive(childNode));


#line default
#line hidden

#line 46 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                    }


#line default
#line hidden
                    WriteLiteralTo(__razor_helper_writer, "            </ul>\n");


#line 49 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
                }


#line default
#line hidden
                WriteLiteralTo(__razor_helper_writer, "    </li>\n");


#line 51 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"


#line default
#line hidden
            }));

#line 51 "..\..\ResourcePackages\Bootstrap\MVC\Views\Navigation\NavigationView.Sitemap.cshtml"
        }
Example #38
0
        public PortsViewModel()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new DelegateCommand(OnItemUnselectedCommand);

            ItemSelectedCommand = new DelegateCommand(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands | SelectorConstraints.HideDisabledResizer,
            };

            #endregion

            #region Node Creation

            NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher");
            NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book");
            NodeViewModel Node3 = CreateNode(65, 100, 700, 150, "Rectangle", "Board");
            NodeViewModel Node4 = CreateNode(65, 100, 450, 300, "Decision", "1st Review");
            NodeViewModel Node5 = CreateNode(65, 100, 700, 300, "Decision", "Approval");
            NodeViewModel Node6 = CreateNode(65, 100, 450, 450, "Rectangle", "Legal Terms");
            NodeViewModel Node7 = CreateNode(65, 100, 450, 600, "Decision", "2nd Review");

            #endregion

            #region Port Creation

            CreateNodePort(Node1, "NodePort11", 0, 0.5, "In");
            CreateNodePort(Node1, "NodePort12", 1, 0.5, "Out");
            CreateNodePort(Node1, "NodePort13", 0.25, 1, "In");
            CreateNodePort(Node1, "NodePort14", 0.5, 1, "Out");
            CreateNodePort(Node1, "NodePort15", 0.75, 1, "In");

            CreateNodePort(Node2, "NodePort21", 0, 0.5, "In");
            CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out");
            CreateNodePort(Node2, "NodePort23", 1, 0.4, "Out");
            CreateNodePort(Node2, "NodePort24", 1, 0.6, "In");

            CreateNodePort(Node3, "NodePort31", 0, 0.4, "In");
            CreateNodePort(Node3, "NodePort32", 0.5, 1, "Out");

            CreateNodePort(Node4, "NodePort41", 0, 0.5, "Out");
            CreateNodePort(Node4, "NodePort42", 0.5, 0, "In");
            CreateNodePort(Node4, "NodePort43", 0.5, 1, "Out");

            CreateNodePort(Node5, "NodePort51", 0.5, 0, "In");
            CreateNodePort(Node5, "NodePort52", 0.5, 1, "Out");

            CreateNodePort(Node6, "NodePort61", 0, 0.5, "In");
            CreateNodePort(Node6, "NodePort62", 0.5, 0, "In");
            CreateNodePort(Node6, "NodePort63", 0.5, 1, "Out");

            CreateNodePort(Node7, "NodePort71", 0, 0.5, "Out");
            CreateNodePort(Node7, "NodePort72", 0.5, 0, "In");
            CreateNodePort(Node7, "NodePort73", 1, 0.5, "Out");

            #endregion

            #region NodeCollection

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);
            (Nodes as NodeCollection).Add(Node3);
            (Nodes as NodeCollection).Add(Node4);
            (Nodes as NodeCollection).Add(Node5);
            (Nodes as NodeCollection).Add(Node6);
            (Nodes as NodeCollection).Add(Node7);

            #endregion

            #region ConnectorCollection

            ConnectorViewModel connector1  = CreateConnector("NodePort52", "NodePort11");
            ConnectorViewModel connector2  = CreateConnector("NodePort41", "NodePort15");
            ConnectorViewModel connector3  = CreateConnector("NodePort12", "NodePort21");
            ConnectorViewModel connector4  = CreateConnector("NodePort23", "NodePort31");
            ConnectorViewModel connector5  = CreateConnector("NodePort32", "NodePort51");
            ConnectorViewModel connector6  = CreateConnector("NodePort73", "NodePort24");
            ConnectorViewModel connector7  = CreateConnector("NodePort63", "NodePort72");
            ConnectorViewModel connector8  = CreateConnector("NodePort43", "NodePort62");
            ConnectorViewModel connector9  = CreateConnector("NodePort14", "NodePort61");
            ConnectorViewModel connector10 = CreateConnector("NodePort71", "NodePort13");
            ConnectorViewModel connector11 = CreateConnector("NodePort22", "NodePort42");

            (Connectors as ConnectorCollection).Add(connector1);
            (Connectors as ConnectorCollection).Add(connector2);
            (Connectors as ConnectorCollection).Add(connector3);
            (Connectors as ConnectorCollection).Add(connector4);
            (Connectors as ConnectorCollection).Add(connector5);
            (Connectors as ConnectorCollection).Add(connector6);
            (Connectors as ConnectorCollection).Add(connector7);
            (Connectors as ConnectorCollection).Add(connector8);
            (Connectors as ConnectorCollection).Add(connector9);
            (Connectors as ConnectorCollection).Add(connector10);
            (Connectors as ConnectorCollection).Add(connector11);

            ViewPortChangedCommand = new DelegateCommand(OnViewPortChanged);


            #endregion
        }
 public override bool MatchNode(NodeViewModel node)
 {
     return(node.Name == DisplayData.UnloadableObjectInfo && node.NodeValue is IUnloadable);
 }
Example #40
0
        public TextAnnotations()
        {
            this.Nodes           = new ObservableCollection <NodeViewModel>();
            this.Connectors      = new ObservableCollection <ConnectorViewModel>();
            this.HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal,
            };
            this.VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };
            this.SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
                SnapToObject    = SnapToObject.All,
            };

            this.PortVisibility = PortVisibility.Collapse;

            //Create Node
            NodeViewModel newProject = CreateNode(130, 40, 450, 80, "Terminator", "New Project");
            NodeViewModel design     = CreateNode(130, 40, 450, 160, "Rectangle", "Project planning and designing");
            NodeViewModel coding     = CreateNode(130, 40, 450, 250, "Rectangle", "Coding");
            NodeViewModel testing    = CreateNode(130, 40, 450, 360, "Rectangle", "Testing");
            NodeViewModel errors     = CreateNode(200, 50, 450, 470, "Decision", "Is Errors?");
            NodeViewModel completed  = CreateNode(130, 40, 450, 570, "Terminator", "Project Completed");

            //Create the node ports
            CreateNodePort(design, "designPort", 0, 0.5);
            CreateNodePort(coding, "codingPort", 1, 0.5);
            CreateNodePort(errors, "errorsPort2", 1, 0.5);
            CreateNodePort(errors, "errorsPort1", 0, 0.5);

            //Add nodes into collection
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(newProject);
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(design);
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(coding);
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(testing);
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(errors);
            (this.Nodes as ObservableCollection <NodeViewModel>).Add(completed);

            //Create the connectors
            ConnectorViewModel connector1 = CreateConnector(newProject, design, "", null, null);
            ConnectorViewModel connector2 = CreateConnector(design, coding, "", null, null);
            ConnectorViewModel connector3 = CreateConnector(coding, testing, "Coding completed", null, null);
            ConnectorViewModel connector4 = CreateConnector(testing, errors, "Testing completed", null, null);
            ConnectorViewModel connector5 = CreateConnector(errors, completed, "No Errors", null, null);
            ConnectorViewModel connector6 = CreateConnector(errors, coding, "Coding errors", "errorsPort2", "codingPort");
            ConnectorViewModel connector7 = CreateConnector(errors, design, "Design errors", "errorsPort1", "designPort");

            //Add the connectors into connectors collection
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector1);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector2);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector3);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector4);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector5);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector6);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector7);

            this.SelectedItems = new SelectorViewModel();
            (this.SelectedItems as SelectorViewModel).SelectorConstraints &= ~(SelectorConstraints.QuickCommands);
            SelectShapeCommand          = new Command(OnSelectShapeCommandExecute);
            ViewModeCommand             = new Command(OnViewModeCommandExecute);
            LabelInteractionCommand     = new Command(OnLabelInteractionCommandExecute);
            SelectFontStyleCommand      = new Command(OnSelectFontStyleCommandExecute);
            this.ItemSelectedCommand    = new Command(OnItemSelectedCommandExecute);
            this.ViewPortChangedCommand = new Command(OnViewPortChangedCommandExecute);
        }
            internal void injectChild(NodeViewModel child)
            {
                if (!_childNodes.Contains(child))
                {
                    _childNodes.Add(child);
                    child.BelowGenerator = this.BelowOrIsGenerator();

                    notifyChildrenChanged();
                }
            }
Example #42
0
 public Node()
 {
     InitializeComponent();
     DataContext = new NodeViewModel();
 }
Example #43
0
 public Node(NodeViewModel nodeViewModel)
 {
     InitializeComponent();
     DataContext = nodeViewModel;
 }
Example #44
0
        //Create Node and Connection
        private void Ishikawadiagrammodel()
        {
            //Node Creation
            int           height = 20;
            int           width  = 75;
            NodeViewModel n1     = AddNode(height, width, 60, 290, null);
            NodeViewModel n2     = AddNode2(height + 45, width + 75, 860, 290, "HIGH PETROL\nCONSUMPTION IN BIKE");
            TitleNode     n3     = AddNode(height, width, 200, 70, "MACHINERY");
            TitleNode     n4     = AddNode(height, width, 410, 70, "METHOD");
            TitleNode     n5     = AddNode(height, width, 620, 70, "PEOPLE");
            TitleNode     n6     = AddNode(height, width, 180, 510, "MATERIAL");
            TitleNode     n7     = AddNode(height, width, 390, 510, "MEASUREMENT");
            TitleNode     n8     = AddNode(height, width, 610, 510, "ENVIRONMENT");

            //Create lineconnector from node to node
            ConnectorViewModel line = addlineconnector(n1, n2, null, null, new Point(0, 0), "", new Thickness(0, 0, 0, 0));

            //Fixed a port in a lineconnector
            ConnectorPort p1 = addport(line, 0.25);
            ConnectorPort p2 = addport(line, 0.28);
            ConnectorPort p3 = addport(line, 0.58);
            ConnectorPort p4 = addport(line, 0.60);
            ConnectorPort p5 = addport(line, 0.90);
            ConnectorPort p6 = addport(line, 0.93);

            //Create lineconnector from Node to Port
            ConnectorViewModel c1 = addlineconnector(n3, null, p1, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            ConnectorViewModel c2 = addlineconnector(n6, null, p2, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            ConnectorViewModel c3 = addlineconnector(n4, null, p3, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            ConnectorViewModel c4 = addlineconnector(n7, null, p4, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            ConnectorViewModel c5 = addlineconnector(n5, null, p5, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));
            ConnectorViewModel c6 = addlineconnector(n8, null, p6, line, new Point(0, 0), "", new Thickness(0, 0, 0, 0));

            ConnectorPort      m1  = addport(c1, 0.25);
            ConnectorViewModel mp1 = addlineconnector(null, null, m1, c1, new Point(70, 133), "Worn-out Pistons", new Thickness(50, 15, 0, 0));

            ConnectorPort      m2  = addport(c1, 0.54);
            ConnectorViewModel mp2 = addlineconnector(null, null, m2, c1, new Point(80, 193), "Wrong Tire Pressure", new Thickness(55, 15, 0, 0));

            ConnectorPort      m3  = addport(c3, 0.25);
            ConnectorViewModel mp3 = addlineconnector(null, null, m3, c3, new Point(305, 133), "Fast Driving", new Thickness(35, 15, 0, 0));

            ConnectorPort      m4  = addport(c3, 0.54);
            ConnectorViewModel mp4 = addlineconnector(null, null, m4, c3, new Point(330, 193), "Wrong Gear", new Thickness(35, 15, 0, 0));

            ConnectorPort      m5  = addport(c5, 0.55);
            ConnectorViewModel mp5 = addlineconnector(null, null, m5, c5, new Point(510, 193), "Maintenance Habit", new Thickness(50, 15, 0, 0));

            ConnectorPort      m6  = addport(mp5, 0.77);
            ConnectorViewModel mp6 = addlineconnector(null, null, m6, mp5, new Point(600, 155), "No Owner Manual", new Thickness(0, 0, 20, 10));

            ConnectorPort      m7  = addport(c2, 0.73);
            ConnectorViewModel mp7 = addlineconnector(null, null, m7, c2, new Point(75, 345), "Poor Quality Petrol", new Thickness(50, 15, 0, 0));

            ConnectorPort      m8  = addport(c2, 0.26);
            ConnectorViewModel mp8 = addlineconnector(null, null, m8, c2, new Point(70, 443), "Incorrect Lubricant", new Thickness(50, 15, 0, 0));

            ConnectorPort      m9  = addport(mp8, 0.73);
            ConnectorViewModel mp9 = addlineconnector(null, null, m9, mp4, new Point(145, 410), "Wrong Oil", new Thickness(0, 0, 10, 10));

            ConnectorPort      m10  = addport(c4, 0.6);
            ConnectorViewModel mp10 = addlineconnector(null, null, m10, c4, new Point(300, 373), "Do not Reset\nOdometer Properly", new Thickness(50, 25, 0, 0));

            ConnectorPort      m11  = addport(c6, 0.6);
            ConnectorViewModel mp11 = addlineconnector(null, null, m11, c6, new Point(520, 373), "Extreme Weather\nConditions", new Thickness(45, 25, 0, 0));
        }
Example #45
0
 public PasteCommand(ObservableCollection<NodeViewModel> classes, NodeViewModel copyClass)
 {
     _classes = classes;
     _copyClass = copyClass;
 }
Example #46
0
        //The constructor does a lot of things, to ensure that when redo is executing, only as little as possible is done there.
        public EditNodeCommand(NodeViewModel focusedClass, ObservableCollection<NodeViewModel> classes)
        {
            _focusedClass = focusedClass;
            _classes = classes;
            _attributeList = new ObservableCollection<Attribute>();
            _methodList = new ObservableCollection<Attribute>();
            _undoAbleAtrList = new List<Attribute>();
            _undoAbleMethodList = new List<Attribute>();

            _availableTypesForAttributes = new ObservableCollection<String>();
            _availableTypesForMethod = new ObservableCollection<String>();

            _attributesToAdd = new List<Model.Attribute>();
            _methodsToAdd = new List<Model.Attribute>();

            //Populate the popupbox with attributes already on the node.
            foreach (var i in _focusedClass.Attributes)
            {
                Attribute a = new Attribute() { Modifier = i.Modifier, Name = i.Name, Type = i.Type };
                _attributeList.Add(i);
                _undoAbleAtrList.Add(a);

            }

            //Populate the popupbox with methods already on the node.
            foreach (var i in _focusedClass.Methods)
            {
                Attribute a = new Attribute(){Modifier = i.Modifier, Name = i.Name, Type = i.Type};
                _methodList.Add(i);
                _undoAbleMethodList.Add(a);
            }

            _popupWindow = new PopupWindow
            {
                dgList = { ItemsSource = _attributeList },
                methodList = { ItemsSource = _methodList },
                TestType = { ItemsSource = _availableTypesForAttributes },
                methodType = { ItemsSource = _availableTypesForMethod }
            };

            PopulateTypesInPopupBox();

            _popupWindow.ShowDialog();

            if (_popupWindow.DialogResult.HasValue && _popupWindow.DialogResult.Value)
            {

                foreach (Attribute n in _attributeList)
                {

                    //Dont add empty selections
                    if (string.IsNullOrEmpty(n.Name))
                    {
                        continue;
                    }

                    //Add the item to the node
                    _attributesToAdd.Add(n);
                }

                foreach (Attribute n in _methodList)
                {
                    //dont add empty selections
                    if (string.IsNullOrEmpty(n.Name))
                    {
                        continue;
                    }
                    _methodsToAdd.Add(n);
                }

            }
            //Cancel was pressed
            else{ return;}
        }