コード例 #1
0
        public PracticeTeacherViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher)
            : base(userInterop, controllerInterop, dispatcher)
        {
            this.originalEntity = new PracticeTeacherDTO();

            this.selector = new SelectorViewModel(UserInterop, ControllerInterop, Dispatcher, true);
        }
コード例 #2
0
        public PracticeTeacherViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher, PracticeTeacherDTO practiceTeacher)
            : base(userInterop, controllerInterop, dispatcher)
        {
            this.originalEntity = practiceTeacher;

            var teacher = ControllerInterop.Service.GetTeacher(ControllerInterop.Session, practiceTeacher.Teacher.ID);
            var cathedra = ControllerInterop.Service.GetCathedra(ControllerInterop.Session, teacher.Cathedra.ID);
            var faculty = ControllerInterop.Service.GetFaculty(ControllerInterop.Session, cathedra.FacultyID);

            this.selector = new SelectorViewModel(userInterop, controllerInterop, dispatcher, faculty, selector_SelectorItemChanged, true);
        }
コード例 #3
0
        public KeyboardInteractionViewModel()
        {
            #region Properties

            Constraints = Constraints.Add(GraphConstraints.Undoable);

            DefaultConnectorType = ConnectorType.Line;

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

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

            Theme            = new LinearTheme();
            Theme.NodeStyles = (Theme as LinearTheme).VariantStyles[1];

            #endregion

            #region Nodes and Connectors Creation

            CustomNode Node1  = CreateNode(550, 100, "A", "SkyBlue", "1", "");
            CustomNode Node2  = CreateNode(450, 200, "B", "Red", "2", "1");
            CustomNode Node3  = CreateNode(550, 200, "C", "Red", "3", "1");
            CustomNode Node4  = CreateNode(650, 200, "D", "Red", "4", "1");
            CustomNode Node5  = CreateNode(400, 300, "E", "Yellow", "5", "2");
            CustomNode Node6  = CreateNode(500, 300, "F", "Yellow", "6", "2");
            CustomNode Node7  = CreateNode(600, 300, "G", "Yellow", "7", "4");
            CustomNode Node8  = CreateNode(700, 300, "H", "Yellow", "8", "4");
            CustomNode Node9  = CreateNode(450, 400, "I", "Violet", "9", "6");
            CustomNode Node10 = CreateNode(550, 400, "J", "Violet", "10", "6");
            CustomNode Node11 = CreateNode(650, 400, "K", "Violet", "11", "8");
            CustomNode Node12 = CreateNode(750, 400, "L", "Violet", "12", "8");
            CustomNode Node13 = CreateNode(400, 500, "M", "Green", "13", "9");
            CustomNode Node14 = CreateNode(500, 500, "N", "Green", "14", "9");
            CustomNode Node15 = CreateNode(600, 500, "O", "Green", "15", "11");
            CustomNode Node16 = CreateNode(700, 500, "P", "Green", "16", "11");
            CustomNode Node17 = CreateNode(450, 600, "Q", "SkyBlue", "17", "14");
            CustomNode Node18 = CreateNode(550, 600, "R", "SkyBlue", "18", "14");
            CustomNode Node19 = CreateNode(650, 600, "S", "SkyBlue", "19", "16");
            CustomNode Node20 = CreateNode(750, 600, "T", "SkyBlue", "20", "16");

            (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);
            (Nodes as NodeCollection).Add(Node8);
            (Nodes as NodeCollection).Add(Node9);
            (Nodes as NodeCollection).Add(Node10);
            (Nodes as NodeCollection).Add(Node11);
            (Nodes as NodeCollection).Add(Node12);
            (Nodes as NodeCollection).Add(Node13);
            (Nodes as NodeCollection).Add(Node14);
            (Nodes as NodeCollection).Add(Node15);
            (Nodes as NodeCollection).Add(Node16);
            (Nodes as NodeCollection).Add(Node17);
            (Nodes as NodeCollection).Add(Node18);
            (Nodes as NodeCollection).Add(Node19);
            (Nodes as NodeCollection).Add(Node20);

            CreateConnector(Node1, Node2);
            CreateConnector(Node1, Node3);
            CreateConnector(Node1, Node4);
            CreateConnector(Node2, Node5);
            CreateConnector(Node2, Node6);
            CreateConnector(Node4, Node7);
            CreateConnector(Node4, Node8);
            CreateConnector(Node6, Node9);
            CreateConnector(Node6, Node10);
            CreateConnector(Node8, Node11);
            CreateConnector(Node8, Node12);
            CreateConnector(Node9, Node13);
            CreateConnector(Node9, Node14);
            CreateConnector(Node11, Node15);
            CreateConnector(Node11, Node16);
            CreateConnector(Node14, Node17);
            CreateConnector(Node14, Node18);
            CreateConnector(Node16, Node19);
            CreateConnector(Node16, Node20);

            #endregion

            #region Commands and CommandManager

            // Custom command and Modified Commands

            CustomGroup   = new DelegateCommand(OnCustomGroupCommand);
            CustomUngroup = new DelegateCommand(OnCustomUngroupCommand);
            ChildNode     = new DelegateCommand(OnChildNodeCommand);
            ParentNode    = new DelegateCommand(OnParentNodeCommand);
            NextChild     = new DelegateCommand(OnNextChildCommand);
            PreviousChild = new DelegateCommand(OnPreviousChildCommand);

            ItemAddedCommand = new DelegateCommand(OnItemAdded);

            CommandManager = new Syncfusion.UI.Xaml.Diagram.CommandManager();

            (CommandManager as Syncfusion.UI.Xaml.Diagram.CommandManager).Commands = new CommandCollection();

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "CustomGroup",
                Command = CustomGroup,
                Gesture = new Gesture
                {
                    KeyModifiers = ModifierKeys.Control,
                    KeyState     = KeyStates.Down,
                    Key          = System.Windows.Input.Key.G,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "CustomUngroup",
                Command = CustomUngroup,
                Gesture = new Gesture
                {
                    KeyModifiers = ModifierKeys.Control,
                    KeyState     = KeyStates.Down,
                    Key          = System.Windows.Input.Key.U,
                },
            }
            );


            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "ChildNode",
                Command = ChildNode,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Down,
                },
            }
            );


            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "ParentNode",
                Command = ParentNode,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Up,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "NextChild",
                Command = NextChild,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Right,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "PreviousChild",
                Command = PreviousChild,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Left,
                },
            }
            );

            ViewPortChangedCommand = new DelegateCommand(OnViewPortChanged);

            #endregion
        }
コード例 #4
0
        private void RibbonGallery_SelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue != null)
            {
                foreach (var galleryGroup in shapeEffectStylesGallery.GalleryGroups)
                {
                    foreach (var galleryItem in galleryGroup.Items)
                    {
                        (galleryItem as RibbonGalleryItem).IsEnabled = true;
                    }
                }
                foreach (var galleryGroup in connectorEffectStylesGallery.GalleryGroups)
                {
                    foreach (var galleryItem in galleryGroup.Items)
                    {
                        (galleryItem as RibbonGalleryItem).IsEnabled = true;
                    }
                }
                foreach (var item in themeRemovedItems)
                {
                    if (item is INode)
                    {
                        (item as INode).Constraints |= NodeConstraints.ThemeStyle;
                    }
                    else if (item is IConnector)
                    {
                        (item as IConnector).Constraints |= ConnectorConstraints.ThemeStyle;
                    }
                }
                themeRemovedItems.Clear();
                shapeRemoveThemesCheckbox.IsChecked = false;
                if ((e.NewValue as DesignRibbonGalleryItem).Name.Equals("Custom1_ThemeRibbon") ||
                    (e.NewValue as DesignRibbonGalleryItem).Name.Equals("Custom2_ThemeRibbon"))
                {
                    sfdiagram.Theme                   = VariantGallery0.Theme = (e.NewValue as DesignRibbonGalleryItem).Theme;
                    VariantGallery0.IsEnabled         = false;
                    VariantGallery1.IsEnabled         = false;
                    VariantGallery2.IsEnabled         = false;
                    VariantGallery3.IsEnabled         = false;
                    VariantRibbonGallery.SelectedItem = null;
                }
                else
                {
                    VariantGallery0.IsEnabled = true;
                    VariantGallery1.IsEnabled = true;
                    VariantGallery2.IsEnabled = true;
                    VariantGallery3.IsEnabled = true;

                    if (themeRemovedItems != null)
                    {
                        foreach (object item in themeRemovedItems)
                        {
                            if (item is INode)
                            {
                                (item as INode).Constraints |= NodeConstraints.ThemeStyle;
                            }
                            else if (item is IConnector)
                            {
                                (item as IConnector).Constraints |= ConnectorConstraints.ThemeStyle;
                            }
                        }
                    }
                    SelectorViewModel selector = sfdiagram.SelectedItems as SelectorViewModel;
                    if ((selector.Nodes as ObservableCollection <object>).Count > 0)
                    {
                        shapeEffectStylesGallery.IsEnabled     = true;
                        connectorEffectStylesGallery.IsEnabled = false;
                    }
                    else if ((selector.Connectors as ObservableCollection <object>).Count > 0)
                    {
                        shapeEffectStylesGallery.IsEnabled     = false;
                        connectorEffectStylesGallery.IsEnabled = true;
                    }

                    sfdiagram.Theme = VariantGallery0.Theme = VariantGallery1.Theme = VariantGallery2.Theme = VariantGallery3.Theme = (e.NewValue as DesignRibbonGalleryItem).Theme;
                    VariantRibbonGallery.SelectedItem = VariantGallery0;
                }
            }
        }
コード例 #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
        }
コード例 #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
        }
コード例 #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
        }
コード例 #8
0
        public CommandsViewModel()
        {
            Constraints = GraphConstraints.Default | GraphConstraints.Undoable;

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

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

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

            ItemSelectedCommand   = new DelegateCommand(OnItemSelectedCommand);
            ItemUnSelectedCommand = new DelegateCommand(OnItemUnSelectedCommand);

            AllCommand = new DelegateCommand(OnAllCommandExecution);

            CreateNode(40, 60, 150, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 150, 170, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 100, 150, 240, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(60, 40, 80, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(80, 40, 160, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(100, 40, 240, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(40, 80, 600, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 750, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 80, 720, 180, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(40, 80, 600, 400, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 600, 500, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 80, 750, 430, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CommandsCustomNodeViewModel node = new CommandsCustomNodeViewModel
            {
                UnitHeight  = 100,
                UnitWidth   = 100,
                OffsetX     = 1100,
                OffsetY     = 120,
                FillColor   = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")),
                Shape       = resourceDictionary["RightTriangle"],
                Annotations = null,
                Key         = "Flip",
            };

            CreateNode(20, 60, 1100, 350, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 1100, 420, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(50, 100, 1100, 500, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            (Nodes as NodeCollection).Add(node);

            CreateNode(20, 200, 150, 40, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(50, 250, 150, 300, new SolidColorBrush(Colors.Transparent), "Try Alignment Commands(AlignLeft, AlignRight and AlignCenter)");
            CreateNode(20, 200, 150, 370, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(50, 250, 170, 580, new SolidColorBrush(Colors.Transparent), "Try Alignment Commands(AlignTop, AlignBottom and AlignMiddle)");
            CreateNode(20, 200, 700, 40, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(20, 250, 700, 240, new SolidColorBrush(Colors.Transparent), "Try SpaceAcross Command");
            CreateNode(20, 200, 700, 320, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(20, 250, 700, 570, new SolidColorBrush(Colors.Transparent), "Try SpaceDown Command");
            CreateNode(20, 200, 1100, 40, new SolidColorBrush(Colors.Transparent), "Select the below node");
            CreateNode(20, 250, 1100, 240, new SolidColorBrush(Colors.Transparent), "Try Flip Commands");
            CreateNode(20, 200, 1100, 300, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(20, 250, 1100, 570, new SolidColorBrush(Colors.Transparent), "Try Sizing Commands");
        }
コード例 #9
0
        public CommandsViewModel()
        {
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            Constraints = GraphConstraints.Default | GraphConstraints.Undoable;

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

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

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

            ItemSelectedCommand   = new Command(OnItemSelectedCommand);
            ItemUnSelectedCommand = new Command(OnItemUnSelectedCommand);

            ItemAddedCommand = new Command(OnItemAddedCommand);

            AllCommand = new Command(OnAllCommandExecution);

            CreateNode(40, 60, 150, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 150, 170, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 100, 150, 240, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(60, 40, 80, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(80, 40, 160, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(100, 40, 240, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(40, 80, 600, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 750, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 80, 720, 180, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(40, 80, 600, 400, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 600, 500, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 80, 750, 430, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CustomNodeViewModel node = new CustomNodeViewModel
            {
                UnitHeight  = 100,
                UnitWidth   = 100,
                OffsetX     = 1100,
                OffsetY     = 120,
                FillColor   = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")),
                Shape       = App.Current.Resources["RightTriangle"],
                Annotations = null,
                Key         = "Flip",
            };

            CreateNode(20, 60, 1100, 350, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 1100, 420, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(50, 100, 1100, 500, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            (Nodes as NodeCollection).Add(node);
        }
コード例 #10
0
        private void OnItemSelected(object obj)
        {
            var args = obj as ItemSelectedEventArgs;

            if (this.SelectedItems is SelectorViewModel)
            {
                SelectorViewModel sv = this.SelectedItems as SelectorViewModel;
                if (sv.Nodes is ObservableCollection <object> nodes && nodes.Any())
                {
                    var layout = this.LayoutManager.Layout as SfMindMapTreeLayout;
                    var node   = nodes.First() as NodeViewModel;
                    if (node == layout.LayoutRoot)
                    {
                        (this.SelectedItems as SelectorViewModel).Commands = new QuickCommandCollection()
                        {
                            new QuickCommandViewModel()
                            {
                                Shape               = resourceDictionary["Ellipse"],
                                OffsetX             = 0,
                                OffsetY             = 0.5,
                                Command             = AddLeftCommand,
                                Content             = "M4.0000001,0 L6,0 6,4.0000033 10,4.0000033 10,6.0000033 6,6.0000033 6,10 4.0000001,10 4.0000001,6.0000033 0,6.0000033 0,4.0000033 4.0000001,4.0000033 z",
                                HorizontalAlignment = HorizontalAlignment.Center,
                                VerticalAlignment   = VerticalAlignment.Center,
                                Margin              = new Thickness(-20, 0, 0, 0),
                            },

                            new QuickCommandViewModel()
                            {
                                Shape               = resourceDictionary["Ellipse"],
                                OffsetX             = 1,
                                OffsetY             = 0.5,
                                Command             = AddRightCommand,
                                Content             = "M4.0000001,0 L6,0 6,4.0000033 10,4.0000033 10,6.0000033 6,6.0000033 6,10 4.0000001,10 4.0000001,6.0000033 0,6.0000033 0,4.0000033 4.0000001,4.0000033 z",
                                HorizontalAlignment = HorizontalAlignment.Center,
                                VerticalAlignment   = VerticalAlignment.Center,
                                Margin              = new Thickness(20, 0, 0, 0),
                            }
                        };
                    }
                    else
                    {
                        if (layout.Orientation == Orientation.Horizontal)
                        {
                            if (node.OffsetX < (layout.LayoutRoot as INode).OffsetX)
                            {
                                (this.SelectedItems as SelectorViewModel).Commands = new QuickCommandCollection()
                                {
                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 0,
                                        OffsetY             = 0.5,
                                        Command             = AddLeftCommand,
                                        Content             = "M4.0000001,0 L6,0 6,4.0000033 10,4.0000033 10,6.0000033 6,6.0000033 6,10 4.0000001,10 4.0000001,6.0000033 0,6.0000033 0,4.0000033 4.0000001,4.0000033 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(-20, 0, 0, 0),
                                    },

                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 1,
                                        OffsetY             = 0.5,
                                        Command             = DeleteCommand,
                                        Content             = "M1.0000023,3 L7.0000024,3 7.0000024,8.75 C7.0000024,9.4399996 6.4400025,10 5.7500024,10 L2.2500024,10 C1.5600024,10 1.0000023,9.4399996 1.0000023,8.75 z M2.0699998,0 L5.9300004,0 6.3420029,0.99999994 8.0000001,0.99999994 8.0000001,2 0,2 0,0.99999994 1.6580048,0.99999994 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(20, 0, 0, 0),
                                    }
                                };
                            }
                            else
                            {
                                (this.SelectedItems as SelectorViewModel).Commands = new QuickCommandCollection()
                                {
                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 1,
                                        OffsetY             = 0.5,
                                        Command             = AddRightCommand,
                                        Content             = "M4.0000001,0 L6,0 6,4.0000033 10,4.0000033 10,6.0000033 6,6.0000033 6,10 4.0000001,10 4.0000001,6.0000033 0,6.0000033 0,4.0000033 4.0000001,4.0000033 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(20, 0, 0, 0),
                                    },

                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 0,
                                        OffsetY             = 0.5,
                                        Command             = DeleteCommand,
                                        Content             = "M1.0000023,3 L7.0000024,3 7.0000024,8.75 C7.0000024,9.4399996 6.4400025,10 5.7500024,10 L2.2500024,10 C1.5600024,10 1.0000023,9.4399996 1.0000023,8.75 z M2.0699998,0 L5.9300004,0 6.3420029,0.99999994 8.0000001,0.99999994 8.0000001,2 0,2 0,0.99999994 1.6580048,0.99999994 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(-20, 0, 0, 0),
                                    }
                                };
                            }
                        }
                        else
                        {
                            if (node.OffsetY < (layout.LayoutRoot as INode).OffsetY)
                            {
                                (this.SelectedItems as SelectorViewModel).Commands = new QuickCommandCollection()
                                {
                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 0,
                                        OffsetY             = 0.5,
                                        Command             = AddLeftCommand,
                                        Content             = "M4.0000001,0 L6,0 6,4.0000033 10,4.0000033 10,6.0000033 6,6.0000033 6,10 4.0000001,10 4.0000001,6.0000033 0,6.0000033 0,4.0000033 4.0000001,4.0000033 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(-20, 0, 0, 0),
                                    },

                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 1,
                                        OffsetY             = 0.5,
                                        Command             = DeleteCommand,
                                        Content             = "M1.0000023,3 L7.0000024,3 7.0000024,8.75 C7.0000024,9.4399996 6.4400025,10 5.7500024,10 L2.2500024,10 C1.5600024,10 1.0000023,9.4399996 1.0000023,8.75 z M2.0699998,0 L5.9300004,0 6.3420029,0.99999994 8.0000001,0.99999994 8.0000001,2 0,2 0,0.99999994 1.6580048,0.99999994 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(20, 0, 0, 0),
                                    }
                                };
                            }
                            else
                            {
                                (this.SelectedItems as SelectorViewModel).Commands = new QuickCommandCollection()
                                {
                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 1,
                                        OffsetY             = 0.5,
                                        Command             = AddRightCommand,
                                        Content             = "M4.0000001,0 L6,0 6,4.0000033 10,4.0000033 10,6.0000033 6,6.0000033 6,10 4.0000001,10 4.0000001,6.0000033 0,6.0000033 0,4.0000033 4.0000001,4.0000033 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(20, 0, 0, 0),
                                    },

                                    new QuickCommandViewModel()
                                    {
                                        Shape               = resourceDictionary["Ellipse"],
                                        OffsetX             = 0,
                                        OffsetY             = 0.5,
                                        Command             = DeleteCommand,
                                        Content             = "M1.0000023,3 L7.0000024,3 7.0000024,8.75 C7.0000024,9.4399996 6.4400025,10 5.7500024,10 L2.2500024,10 C1.5600024,10 1.0000023,9.4399996 1.0000023,8.75 z M2.0699998,0 L5.9300004,0 6.3420029,0.99999994 8.0000001,0.99999994 8.0000001,2 0,2 0,0.99999994 1.6580048,0.99999994 z",
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        Margin              = new Thickness(-20, 0, 0, 0),
                                    }
                                };
                            }
                        }
                    }
                }
            }
        }
コード例 #11
0
        public SfDiagram_Binding_With_TreeView_ViewModel()
        {
            #region Commands

            AddNode               = new DelegateCommand(OnAddNode);
            DeleteNode            = new DelegateCommand(OnDeleteNode);
            ItemAddedCommand      = new DelegateCommand(OnItemAdded);
            ItemDeletingCommand   = new DelegateCommand(OnItemDeleting);
            ItemSelectedCommand   = new DelegateCommand(OnItemSelected);
            ItemUnSelectedCommand = new DelegateCommand(OnItemUnSelected);

            #endregion

            #region Initialize Properties

            Tool = Tool.SingleSelect;

            Datas = new ObservableCollection <Items>()
            {
                new Items()
                {
                    Name = "Plant Manager", ID = 1, SubItems = new ObservableCollection <Items>()
                    {
                        new Items()
                        {
                            Name = "Production Manager", ID = 2, ParentID = 1, SubItems = new ObservableCollection <Items>()
                            {
                                new Items()
                                {
                                    Name = "Control Room", ID = 3, ParentID = 2, SubItems = new ObservableCollection <Items>()
                                    {
                                        new Items()
                                        {
                                            Name = "Foreman1", ID = 4, ParentID = 3, SubItems = new ObservableCollection <Items>()
                                            {
                                                new Items()
                                                {
                                                    Name = "Craft Personnel5", ID = 5, ParentID = 4
                                                },
                                                new Items()
                                                {
                                                    Name = "Craft Personnel6", ID = 6, ParentID = 4
                                                },
                                            },
                                        },
                                    },
                                },
                                new Items()
                                {
                                    Name = "Plant Operator", ID = 7, ParentID = 2, SubItems = new ObservableCollection <Items>()
                                    {
                                        new Items()
                                        {
                                            Name = "Foreman2", ID = 8, ParentID = 7, SubItems = new ObservableCollection <Items>()
                                            {
                                                new Items()
                                                {
                                                    Name = "Craft Personnel7", ID = 9, ParentID = 8
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Items()
                        {
                            Name = "Administrative Officer", ID = 10, ParentID = 1
                        },
                        new Items()
                        {
                            Name = "Maintenance Manager", ID = 11, ParentID = 1, SubItems = new ObservableCollection <Items>()
                            {
                                new Items()
                                {
                                    Name = "Electrical Supervisor", ID = 12, ParentID = 11, SubItems = new ObservableCollection <Items>()
                                    {
                                        new Items()
                                        {
                                            Name = "Craft Personnel1", ID = 13, ParentID = 12
                                        },
                                        new Items()
                                        {
                                            Name = "Craft Personnel2", ID = 14, ParentID = 12
                                        },
                                    },
                                },
                                new Items()
                                {
                                    Name = "Mechanical Supervisor", ID = 15, ParentID = 11, SubItems = new ObservableCollection <Items>()
                                    {
                                        new Items()
                                        {
                                            Name = "Craft Personnel3", ID = 16, ParentID = 15
                                        },
                                        new Items()
                                        {
                                            Name = "Craft Personnel4", ID = 17, ParentID = 15
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
            };

            DefaultConnectorType = ConnectorType.Orthogonal;

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

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands & ~SelectorConstraints.Rotator & ~SelectorConstraints.Tooltip & ~SelectorConstraints.Pivot,
            };

            LayoutManager = new Syncfusion.UI.Xaml.Diagram.Layout.LayoutManager()
            {
                Layout = new DirectedTreeLayout()
                {
                    HorizontalSpacing = 20,
                    VerticalSpacing   = 40,
                    Orientation       = TreeOrientation.TopToBottom,
                    Type = LayoutType.Hierarchical,
                },
                RefreshFrequency = RefreshFrequency.ArrangeParsing,
            };

            DataSourceSettings = new DataSourceSettings()
            {
                Id         = "ID",
                ParentId   = "ParentID",
                DataSource = GetData(Datas),
            };

            #endregion
        }
コード例 #12
0
ファイル: HomeController.cs プロジェクト: vplauzon/reading
        public ActionResult Index()
        {
            var model = new SelectorViewModel();

            return(View(model));
        }