Beispiel #1
0
        public GroupingViewModel()
        {
            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            Theme = new SimpleTheme();

            NodeViewModel Node1 = CreateNode(200, 150, "Rectangle", "");
            NodeViewModel Node2 = CreateNode(400, 150, "RoundedRectangle", "");
            NodeViewModel Node3 = CreateNode(200, 300, "Ellipse", "Start/Stop");
            NodeViewModel Node4 = CreateNode(400, 300, "PredefinedProcess", "Decision");
            NodeViewModel Node5 = CreateNode(200, 450, "Rectangle", "Process");
            NodeViewModel Node6 = CreateNode(650, 150, "Rectangle", "Process");
            NodeViewModel Node7 = CreateNode(850, 150, "Rectangle", "Process");

            CreateGroup(Node1, Node2);
            CreateContainer(Node6, Node7, "Container", 340, 100, 750, 150);

            //Initialize the item adde command to container style.
            ItemAddedCommand = new DelegateCommand(OnItemAddedCommandExecute);
        }
 private void Cycle(FlowLayoutPanel panel, bool visible)
 {
     using (ForumContainer container = new ForumContainer()) {
         foreach (var thm in container.ThemeSet.Where(x => x.Visible == visible))
         {
             var         author = container.AccountSet.FirstOrDefault(x => x.AccountId == thm.AuthorId);
             SimpleTheme smpPan = new SimpleTheme(thm, author.Name.TrimEnd());
             smpPan.SetClick(OnRedactionClick);
             panel.Controls.Add(smpPan);
         }
     }
 }
Beispiel #3
0
        public DiagramVM()
        {
            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            Theme = new SimpleTheme();

            NodeViewModel Node6 = CreateNode(650, 150, "Rectangle", "Process");
            NodeViewModel Node7 = CreateNode(850, 150, "Rectangle", "Process");

            CreateContainer(Node6, Node7, "Container", 340, 100, 750, 150);

            //Initialize the item adde command to container style.
            ItemAddedCommand = new DelegateCommand(OnItemAddedCommandExecute);
        }
Beispiel #4
0
        private static ITheme GetThemeByIndex(int i)
        {
            switch (i)
            {
            case 0: return(PlatformTheme ?? throw new InvalidOperationException());

            case 1: return(DefaultTheme.Create());

            case 2: return(AlternateBordersTheme.Create());

            case 3: return(SimpleTheme.CreateBlack());

            case 4: return(SimpleTheme.CreateWhite());

            case 5: return(SimpleTheme.CreateBlue());

            case 6: return(StylishTheme.CreateRed());

            case 7: return(StylishTheme.CreateBlue());

            default: throw new IndexOutOfRangeException();
            }
        }
Beispiel #5
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
        }
Beispiel #6
0
        public PortsDiagramViewModel()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new Command(OnItemUnselectedCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

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

            #endregion

            #region Node Creation

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

            #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
        }
Beispiel #7
0
        public DiagramVM()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new Command(OnItemUnselectedCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

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

            #endregion

            #region Node Creation

            NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher", true);
            NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book", false);


            #endregion

            #region Port Creation

            CreateNodePort(Node1, "NodePort11", 0.5, 0, "In");
            CreateNodePort(Node1, "NodePort12", 0.5, 1, "Out");

            CreateNodePort(Node2, "NodePort21", 0.5, 0, "In");
            CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out");

            #endregion

            #region NodeCollection

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);


            #endregion
        }