Inheritance: ZoomCanvas
Exemple #1
0
        public Port(string name, Node parent, PortTypes portType, Type type)
        {
            ParentNode   = parent;
            hostCanvas   = ParentNode.HostCanvas;
            DataType     = type;
            PortType     = portType;
            Name         = name;
            Description  = name;
            PortDataType = type.Name;

            if (portType == PortTypes.Input)
            {
                Style = hostCanvas.FindResource("VplPortStyleLeft") as Style;
            }
            else
            {
                Style = hostCanvas.FindResource("VplPortStyleRight") as Style;
            }

            MouseDown += Port_MouseDown;

            ParentNode.SizeChanged     += ParentNode_SizeChanged;
            ParentNode.PropertyChanged += ParentNode_PropertyChanged;

            ConnectedConnectors = new List <Connector>();
            Origin = new BindingPoint(0, 0);
        }
Exemple #2
0
        public Port(string name, PortTypes portType, Type type, VplControl hostCanvas)
        {
            DataType = type;
            PortType = portType;
            Name     = name;

            this.hostCanvas = hostCanvas;

            if (portType == PortTypes.Input)
            {
                Style = this.hostCanvas.FindResource("VplPortStyleLeft") as Style;
            }
            else
            {
                Style = this.hostCanvas.FindResource("VplPortStyleRight") as Style;
            }

            MouseDown += Port_MouseDown;

            // ParentNode.SizeChanged += ParentNode_SizeChanged;
            // ParentNode.PropertyChanged += ParentNode_PropertyChanged;

            ConnectedConnectors = new List <Connector>();
            Origin = new BindingPoint(0, 0);
        }
        public ScriptingNode(VplControl.Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            scriptingControl = new ScriptingControl();


            scriptingControl.HighlightingComboBox.SelectionChanged += HighlightingComboBoxOnSelectionChanged;


            // Create new script File
            scriptingControl.CurrentFile = new CSharpScriptFile2();


            //scriptingControl.Height = 400;
            //scriptingControl.Width = 700;
            //scriptingControl.DockPanel.Height = 400;
            IsResizeable = true;

            //scriptingControl.StartCompilingEventHandler += StartCompilingEventHandler;

            scriptingControl.StartCSharpCompilingEventHandler += StartCSharpCompilation;
            scriptingControl.StartPythonCompilingEventHandler += StartPythonCompilation;

            AddControlToNode(scriptingControl);

            AddInputPortToNode("Input", typeof (object));

            AddOutputPortToNode("Output", typeof (object));
        }
        public SelectionNode(VplControl hostCanvas) : base(hostCanvas)
        {
            searchTextBox           = new SearchTextBox();
            searchTextBox.OnSearch += searchTextBox_OnSearch;

            var tempTypeList = new List <Type>();

            AddControlToNode(searchTextBox);

            listBox.DisplayMemberPath = "Name";
            listBox.MaxHeight         = 140;

            // Mine
            listBox.MinWidth = 150;

            AddControlToNode(listBox);


            switch (hostCanvas.NodeTypeMode)
            {
            case NodeTypeModes.OnlyInternalTypes:
                tempTypeList.AddRange(
                    ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes")
                    .ToList());
                break;

            case NodeTypeModes.OnlyExternalTypes:
                tempTypeList.AddRange(hostCanvas.ExternalNodeTypes);
                break;

            case NodeTypeModes.All:
                tempTypeList.AddRange(
                    ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes")
                    .ToList());
                tempTypeList.AddRange(hostCanvas.ExternalNodeTypes);
                break;
            }

            tempTypeList = tempTypeList.OrderBy(x => x.Name).ToList();

            foreach (
                var type in
                tempTypeList.Where(
                    type => !type.IsAbstract && !type.IsDefined(typeof(CompilerGeneratedAttribute), true)))
            {
                typeList.Add(type);
            }

            listBox.ItemsSource               = typeList;
            searchTextBox.PreviewKeyDown     += searchTextBox_KeyDown;
            listBox.PreviewMouseLeftButtonUp += listBox_PreviewMouseLeftButtonUp;

            listBox.SelectionMode = SelectionMode.Single;


            Border.MouseLeave += SelectionNode_MouseLeave;
            MouseEnter        += SelectionNode_MouseEnter;
        }
Exemple #5
0
        public ConnectorPort(VplControl hostCanvas)
        {
            this.hostCanvas = hostCanvas;


            Style = hostCanvas.FindResource("VplConnectorPortStyle") as Style;

            hostCanvas.Children.Add(this);
        }
        public Connector(VplControl hostCanvas, Port startPort, Port endPort)
        {
            HostCanvas = hostCanvas;

            Path = new Path();

            srtEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            endEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            Panel.SetZIndex(Path, 2);
            Panel.SetZIndex(srtEllipse, startPort.ParentNode.Id + 1);
            Panel.SetZIndex(endEllipse, endPort.ParentNode.Id + 1);

            Path.Style = HostCanvas.FindResource("VplConnectorStyle") as Style;

            StartPort = startPort;
            EndPort = endPort;

            Canvas.SetLeft(srtEllipse, StartPort.Origin.X - srtEllipse.ActualWidth/2);
            Canvas.SetTop(srtEllipse, StartPort.Origin.Y - srtEllipse.ActualHeight/2);

            Canvas.SetLeft(endEllipse, EndPort.Origin.X - endEllipse.ActualWidth/2);
            Canvas.SetTop(endEllipse, EndPort.Origin.Y - endEllipse.ActualHeight/2);

            StartBezierPoint = new BindingPoint(StartPort.Origin.X, StartPort.Origin.Y);
            EndBezierPoint = new BindingPoint(EndPort.Origin.X, EndPort.Origin.Y);

            startPort.DataChanged += endPort.StartPort_DataChanged;

            StartPort.Origin.PropertyChanged += Origin_PropertyChanged;
            EndPort.Origin.PropertyChanged += Origin_PropertyChanged;

            StartPort.ParentNode.PropertyChanged += Origin_PropertyChanged;
            EndPort.ParentNode.PropertyChanged += Origin_PropertyChanged;

            ObserveNode(StartPort.ParentNode);
            ObserveNode(EndPort.ParentNode);

            startPort.ConnectedConnectors.Add(this);
            endPort.ConnectedConnectors.Add(this);

            endPort.CalculateData(startPort.Data);

            DefinePath();

            HostCanvas.Children.Add(Path);
            HostCanvas.Children.Add(srtEllipse);
            HostCanvas.Children.Add(endEllipse);
        }
Exemple #7
0
        public Connector(VplControl hostCanvas, Port startPort, Port endPort)
        {
            HostCanvas = hostCanvas;

            Path = new Path();

            srtEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            endEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            Panel.SetZIndex(Path, 2);
            Panel.SetZIndex(srtEllipse, startPort.ParentNode.Id + 1);
            Panel.SetZIndex(endEllipse, endPort.ParentNode.Id + 1);

            Path.Style = HostCanvas.FindResource("VplConnectorStyle") as Style;

            StartPort = startPort;
            EndPort   = endPort;

            Canvas.SetLeft(srtEllipse, StartPort.Origin.X - srtEllipse.ActualWidth / 2);
            Canvas.SetTop(srtEllipse, StartPort.Origin.Y - srtEllipse.ActualHeight / 2);

            Canvas.SetLeft(endEllipse, EndPort.Origin.X - endEllipse.ActualWidth / 2);
            Canvas.SetTop(endEllipse, EndPort.Origin.Y - endEllipse.ActualHeight / 2);

            StartBezierPoint = new BindingPoint(StartPort.Origin.X, StartPort.Origin.Y);
            EndBezierPoint   = new BindingPoint(EndPort.Origin.X, EndPort.Origin.Y);

            startPort.DataChanged += endPort.StartPort_DataChanged;

            StartPort.Origin.PropertyChanged += Origin_PropertyChanged;
            EndPort.Origin.PropertyChanged   += Origin_PropertyChanged;

            StartPort.ParentNode.PropertyChanged += Origin_PropertyChanged;
            EndPort.ParentNode.PropertyChanged   += Origin_PropertyChanged;

            ObserveNode(StartPort.ParentNode);
            ObserveNode(EndPort.ParentNode);

            startPort.ConnectedConnectors.Add(this);
            endPort.ConnectedConnectors.Add(this);

            endPort.CalculateData(startPort.Data);

            DefinePath();

            HostCanvas.Children.Add(Path);
            HostCanvas.Children.Add(srtEllipse);
            HostCanvas.Children.Add(endEllipse);
        }
        /// <summary>
        ///     Initializes a new instance of VplElement class.
        /// </summary>
        /// <param name="hostCanvas">The host VplControl in which the VplElement will be rendered.</param>
        protected VplElement(VplControl hostCanvas)
        {
            HostCanvas = hostCanvas;
            // ----------------------------------------------------------------------------------------------------------------------
            // Border
            // ----------------------------------------------------------------------------------------------------------------------
            Border = new Border
            {
                Child = this,
                Style = FindResource("VplElementBorderStyle") as Style,
                Visibility = Visibility.Collapsed
            };

            DependencyPropertyDescriptor.FromProperty(IsSelectedProperty, typeof (VplElement))
                .AddValueChanged(this, OnSelectionChanged);

            HostCanvas.AddChildren(Border);


            // ----------------------------------------------------------------------------------------------------------------------
            // HitTestBorder
            // ----------------------------------------------------------------------------------------------------------------------
            HitTestBorder = new Border {Style = FindResource("HitTestBorderStyle") as Style};
            HitTestBorder.MouseEnter += HitTestBorder_MouseEnter;
            HitTestBorder.MouseLeave += HitTestBorder_MouseLeave;

            HitTestGrid = new Grid();

            HitTestGrid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(30)});
            HitTestGrid.ColumnDefinitions.Add(new ColumnDefinition());
            HitTestGrid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(30)});
            HitTestGrid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(30)});
            HitTestGrid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(30)});

            HitTestBorder.Child = HitTestGrid;

            HostCanvas.AddChildren(HitTestBorder);

            // ----------------------------------------------------------------------------------------------------------------------
            // Buttons
            // ----------------------------------------------------------------------------------------------------------------------
            if (GetType() == typeof (SelectionNode)) return;

            CaptionLabel = new NodeCaptionLabel(this);
            QuestButton = new NodeQuestionButton(this);
            ResizeButton = new NodePinButton(this);
            BinButton = new NodeBinButton(this);
            AutoCheckBox = new NodeAutoCheckBox(this);

            BinButton.Click += binButton_Click;

            BinButton.Visibility = Visibility.Collapsed;
            QuestButton.Visibility = Visibility.Collapsed;
            ResizeButton.Visibility = Visibility.Collapsed;
            AutoCheckBox.Visibility = Visibility.Collapsed;
        }
        public SelectionNode(VplControl hostCanvas) : base(hostCanvas)
        {
            searchTextBox = new SearchTextBox();
            searchTextBox.OnSearch += searchTextBox_OnSearch;

            var tempTypeList = new List<Type>();
            AddControlToNode(searchTextBox);

            listBox.DisplayMemberPath = "Name";
            listBox.MaxHeight = 140;

            // Mine
            listBox.MinWidth = 150;

            AddControlToNode(listBox);


            switch (hostCanvas.NodeTypeMode)
            {
                case NodeTypeModes.OnlyInternalTypes:
                    tempTypeList.AddRange(
                        ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes")
                            .ToList());
                    break;
                case NodeTypeModes.OnlyExternalTypes:
                    tempTypeList.AddRange(hostCanvas.ExternalNodeTypes);
                    break;
                case NodeTypeModes.All:
                    tempTypeList.AddRange(
                        ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes")
                            .ToList());
                    tempTypeList.AddRange(hostCanvas.ExternalNodeTypes);
                    break;
            }

            tempTypeList = tempTypeList.OrderBy(x => x.Name).ToList();

            foreach (
                var type in
                    tempTypeList.Where(
                        type => !type.IsAbstract && !type.IsDefined(typeof (CompilerGeneratedAttribute), true)))
            {
                typeList.Add(type);
            }

            listBox.ItemsSource = typeList;
            searchTextBox.PreviewKeyDown += searchTextBox_KeyDown;
            listBox.PreviewMouseLeftButtonUp += listBox_PreviewMouseLeftButtonUp;

            listBox.SelectionMode = SelectionMode.Single;


            Border.MouseLeave += SelectionNode_MouseLeave;
            MouseEnter += SelectionNode_MouseEnter;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.VplPropertyGrid = ((Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid)(target));
                return;

            case 2:
                this.VplControl = ((TUM.CMS.VplControl.Core.VplControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
        /// <summary>
        ///     Initializes a new instance of VplElement class.
        /// </summary>
        /// <param name="hostCanvas">The host VplControl in which the VplElement will be rendered.</param>
        protected VplElement(VplControl hostCanvas)
        {
            HostCanvas = hostCanvas;
            // ----------------------------------------------------------------------------------------------------------------------
            // Border
            // ----------------------------------------------------------------------------------------------------------------------
            Border = new Border
            {
                Child = this,
                Style = FindResource("VplElementBorderStyle") as Style
            };
            DependencyPropertyDescriptor.FromProperty(IsSelectedProperty, typeof(VplElement))
            .AddValueChanged(this, OnSelectionChanged);
            HostCanvas.Children.Add(Border);

            // ----------------------------------------------------------------------------------------------------------------------
            // HitTestBorder
            // ----------------------------------------------------------------------------------------------------------------------
            HitTestBorder = new Border {
                Style = FindResource("HitTestBorderStyle") as Style
            };
            HitTestBorder.MouseEnter += HitTestBorder_MouseEnter;
            HitTestBorder.MouseLeave += HitTestBorder_MouseLeave;

            HostCanvas.Children.Add(HitTestBorder);


            // ----------------------------------------------------------------------------------------------------------------------
            // Buttons
            // ----------------------------------------------------------------------------------------------------------------------
            if (GetType() == typeof(SelectionNode))
            {
                return;
            }

            CaptionLabel = new NodeCaptionLabel(this);
            QuestButton  = new NodeQuestionButton(this);
            ResizeButton = new NodeResizeButton(this);
            BinButton    = new NodeBinButton(this);
            AutoCheckBox = new NodeAutoCheckBox(this);

            CaptionLabel.Width = 80;

            BinButton.Click += binButton_Click;

            BinButton.Visibility    = Visibility.Collapsed;
            QuestButton.Visibility  = Visibility.Collapsed;
            ResizeButton.Visibility = Visibility.Collapsed;
            AutoCheckBox.Visibility = Visibility.Collapsed;
        }
        public NodeGroup(VplControl hostCanvas)
            : base(hostCanvas)
        {
            Id = Interlocked.Increment(ref counter);

            Border.MouseDown += HitTestBorder_MouseDown;
            Border.MouseUp += Border_MouseUp;

            Border.Visibility = Visibility.Visible;
            Border.Style = FindResource("VplGroupBorderStyle") as Style;
                
            HostCanvas.NodeGroupCollection.Add(this);

            SetZIndex(this, 1);
            SetZIndex(Border, 1);
        }
Exemple #13
0
        public NodeGroup(VplControl hostCanvas)
            : base(hostCanvas)
        {
            Id = Interlocked.Increment(ref counter);

            Border.MouseDown += HitTestBorder_MouseDown;
            Border.MouseUp   += Border_MouseUp;

            Border.Visibility = Visibility.Visible;
            Border.Style      = FindResource("VplGroupBorderStyle") as Style;

            HostCanvas.NodeGroupCollection.Add(this);

            SetZIndex(this, 1);
            SetZIndex(Border, 1);
        }
        public NodeGroup(VplControl hostCanvas)
            : base(hostCanvas)
        {
            Id = Interlocked.Increment(ref counter);

            Border.MouseDown += HitTestBorder_MouseDown;
            Border.MouseUp += Border_MouseUp;

            CaptionLabel.Width = 200;

            Name = "Name group here...";

            HostCanvas.NodeGroupCollection.Add(this);

            SetZIndex(this, 0);
            SetZIndex(Border, 0);
        }
        public NodeGroup(VplControl hostCanvas)
            : base(hostCanvas)
        {
            Id = Interlocked.Increment(ref counter);

            Border.MouseDown += HitTestBorder_MouseDown;
            Border.MouseUp   += Border_MouseUp;

            CaptionLabel.Width = 200;

            Name = "Name group here...";

            HostCanvas.NodeGroupCollection.Add(this);

            SetZIndex(this, 0);
            SetZIndex(Border, 0);
        }
        public Port(string name, PortTypes portType, Type type, VplControl hostCanvas)
        {
            DataType = type;
            PortType = portType;
            Name = name;

            HostCanvas = hostCanvas;

            if (portType == PortTypes.Input)
                Style = HostCanvas.FindResource("VplPortStyleLeft") as Style;
            else
                Style = HostCanvas.FindResource("VplPortStyleRight") as Style;

            MouseDown += Port_MouseDown;
            // ParentNode.SizeChanged += ParentNode_SizeChanged;

            // ParentNode.PropertyChanged += ParentNode_PropertyChanged;
            ConnectedConnectors = new List<Connector>();
            Origin = new BindingPoint(0,0);
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.VplPropertyGrid = ((Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid)(target));
     return;
     case 2:
     this.VplControl = ((TUM.CMS.VplControl.Core.VplControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
Exemple #18
0
        protected Node(VplControl hostCanvas) : base(hostCanvas)
        {
            Guid = Guid.NewGuid();

            id = Interlocked.Increment(ref id);
            id = Interlocked.Increment(ref id);
            Id = id;

            InputPorts      = new List <Port>();
            OutputPorts     = new List <Port>();
            ControlElements = new List <UIElement>();

            IsHitTestVisible = true;
            HasError         = false;


            SpaceCanvas = new Canvas();
            Children.Add(ContentGrid = new Grid {
                ShowGridLines = false, Background = Brushes.Transparent
            });


            if (hostCanvas.GraphFlowDirection == GraphFlowDirections.Horizontal)
            {
                // ----------------------------------------------------------------------------------------------------------------------
                // Content Panels
                // ----------------------------------------------------------------------------------------------------------------------
                InputPortPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };

                SetColumn(InputPortPanel, 0);
                SetRow(InputPortPanel, 1);
                ContentGrid.Children.Add(InputPortPanel);

                OutputPortPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };
                SetColumn(OutputPortPanel, 2);
                SetRow(OutputPortPanel, 1);
                ContentGrid.Children.Add(OutputPortPanel);
            }
            else
            {
                // ----------------------------------------------------------------------------------------------------------------------
                // Content Panels
                // ----------------------------------------------------------------------------------------------------------------------
                InputPortPanel = new DockPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                };

                SetRow(InputPortPanel, 0);
                SetColumn(InputPortPanel, 1);
                ContentGrid.Children.Add(InputPortPanel);

                OutputPortPanel = new DockPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                };

                SetColumn(OutputPortPanel, 1);
                SetRow(OutputPortPanel, 2);
                ContentGrid.Children.Add(OutputPortPanel);
            }

            // ----------------------------------------------------------------------------------------------------------------------
            // Content grid row and column definitions
            // ----------------------------------------------------------------------------------------------------------------------
            ContentGrid.ColumnDefinitions.Insert(0,
                                                 new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            // Input
            ContentGrid.ColumnDefinitions.Insert(0,
                                                 new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            // Content
            ContentGrid.ColumnDefinitions.Insert(0,
                                                 new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            // Output

            ContentGrid.RowDefinitions.Insert(0, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Header
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Content
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Footer
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Risize area

            ContentGrid.SizeChanged      += ContentGridOnSizeChanged;
            ContentGrid.VerticalAlignment = VerticalAlignment.Center;

            // ----------------------------------------------------------------------------------------------------------------------
            // Main content grid
            // ----------------------------------------------------------------------------------------------------------------------
            MainContentGrid = new Grid
            {
                ShowGridLines = false,
                Style         = FindResource("MainContentGridStyle") as Style
            };


            SetColumn(MainContentGrid, 1);
            SetRow(MainContentGrid, 1);
            ContentGrid.Children.Add(MainContentGrid);

            // ----------------------------------------------------------------------------------------------------------------------
            // Event delagates
            // ----------------------------------------------------------------------------------------------------------------------
            Border.MouseDown += Node_MouseDown;

            Loaded  += Node_Loaded;
            KeyUp   += Node_KeyUp;
            KeyDown += Node_KeyDown;

            // ----------------------------------------------------------------------------------------------------------------------
            // Comments
            // ----------------------------------------------------------------------------------------------------------------------
            TopComment = new Comment(this)
            {
                Text =
                    "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                Background = HostCanvas.FindResource("CommentBackgroundBrushError") as Brush,
                ExpandSide = CommentExpandSides.Top
            };


            BottomComment = new Comment(this)
            {
                Text =
                    "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                Background = HostCanvas.FindResource("CommentBackgroundBrush") as Brush,
                ExpandSide = CommentExpandSides.Bottom
            };

            TopComment.Visibility    = Visibility.Collapsed;
            BottomComment.Visibility = Visibility.Collapsed;

            ShowHelpOnMouseOver = false;

            if (QuestButton != null)
            {
                if (QuestButton != null)
                {
                    QuestButton.Click += QuestButton_Click;
                }
            }

            SetZIndex(this, Id);
            SetZIndex(Border, Id);


            if (HitTestBorder != null)
            {
                SetZIndex(HitTestBorder, Id);
            }
            if (BinButton != null)
            {
                SetZIndex(BinButton, Id);
            }
            if (ResizeButton != null)
            {
                SetZIndex(ResizeButton, Id);
            }
            if (QuestButton != null)
            {
                SetZIndex(QuestButton, Id);
            }
            if (CaptionLabel != null)
            {
                SetZIndex(CaptionLabel, Id);
            }
            if (AutoCheckBox != null)
            {
                SetZIndex(AutoCheckBox, Id);
            }

            SetZIndex(TopComment, Id);
            SetZIndex(BottomComment, Id);

            if (GetType() == typeof(SelectionNode))
            {
                return;
            }
            HostCanvas.NodeCollection.Add(this);
        }
Exemple #19
0
 public Theme(VplControl hostCanvas)
 {
     this.hostCanvas = hostCanvas;
 }
Exemple #20
0
        protected Node(VplControl hostCanvas) : base(hostCanvas)
        {
            Guid = Guid.NewGuid();

            id = Interlocked.Increment(ref id);
            id = Interlocked.Increment(ref id);
            Id = id;

            InputPorts      = new List <Port>();
            OutputPorts     = new List <Port>();
            ControlElements = new List <UIElement>();

            IsHitTestVisible = true;
            HasError         = false;

            SpaceCanvas = new Canvas();

            //Adding a title to nodes. A new subgrid holds the title an the node panel
            //TODO : Clean up

            // ----------------------------------------------------------------------------------------------------------------------
            // Container Panel
            // ----------------------------------------------------------------------------------------------------------------------

            Grid container = new Grid {
                ShowGridLines = false, Background = Brushes.Transparent
            };

            container.RowDefinitions.Insert(0, new RowDefinition());
            container.RowDefinitions.Insert(1, new RowDefinition());

            Children.Add(container);

            NodeTitle = new Grid {
                ShowGridLines = false, Background = Brushes.Transparent
            };

            Title(container, new Label {
                Content    = this.GetType().Name,
                Foreground = Brushes.White,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                FontSize = 13,
                Padding  = new Thickness(0)
            });

            container.Children.Add(ContentGrid = new Grid {
                ShowGridLines = false, Background = Brushes.Transparent
            });
            SetColumn(ContentGrid, 0);
            SetRow(ContentGrid, 1);


            if (hostCanvas.GraphFlowDirection == GraphFlowDirections.Horizontal)
            {
                // ----------------------------------------------------------------------------------------------------------------------
                // Content Panels
                // ----------------------------------------------------------------------------------------------------------------------
                InputPortPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };

                SetColumn(InputPortPanel, 0);
                SetRow(InputPortPanel, 1);
                ContentGrid.Children.Add(InputPortPanel);

                OutputPortPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };
                SetColumn(OutputPortPanel, 2);
                SetRow(OutputPortPanel, 1);
                ContentGrid.Children.Add(OutputPortPanel);
            }
            else
            {
                // ----------------------------------------------------------------------------------------------------------------------
                // Content Panels
                // ----------------------------------------------------------------------------------------------------------------------
                InputPortPanel = new DockPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                };

                SetRow(InputPortPanel, 0);
                SetColumn(InputPortPanel, 1);
                ContentGrid.Children.Add(InputPortPanel);

                OutputPortPanel = new DockPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                };

                SetColumn(OutputPortPanel, 1);
                SetRow(OutputPortPanel, 2);
                ContentGrid.Children.Add(OutputPortPanel);
            }

            // ----------------------------------------------------------------------------------------------------------------------
            // Content grid row and column definitions
            // ----------------------------------------------------------------------------------------------------------------------
            ContentGrid.ColumnDefinitions.Insert(0,
                                                 new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            // Input
            ContentGrid.ColumnDefinitions.Insert(0,
                                                 new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            // Content
            ContentGrid.ColumnDefinitions.Insert(0,
                                                 new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            // Output

            ContentGrid.RowDefinitions.Insert(0, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Header
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Content
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Footer
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            // Risize area

            ContentGrid.SizeChanged      += ContentGridOnSizeChanged;
            ContentGrid.VerticalAlignment = VerticalAlignment.Center;

            // ----------------------------------------------------------------------------------------------------------------------
            // Main content grid
            // ----------------------------------------------------------------------------------------------------------------------
            MainContentGrid = new Grid
            {
                ShowGridLines = false,
                Style         = FindResource("MainContentGridStyle") as Style
            };


            SetColumn(MainContentGrid, 1);
            SetRow(MainContentGrid, 1);
            ContentGrid.Children.Add(MainContentGrid);

            // ----------------------------------------------------------------------------------------------------------------------
            // Event delagates
            // ----------------------------------------------------------------------------------------------------------------------
            Border.MouseDown += Node_MouseDown;

            Loaded  += Node_Loaded;
            KeyUp   += Node_KeyUp;
            KeyDown += Node_KeyDown;

            // ----------------------------------------------------------------------------------------------------------------------
            // Comments
            // ----------------------------------------------------------------------------------------------------------------------
            TopComment = new Comment(this)
            {
                Text       = "",
                Background = HostCanvas.FindResource("CommentBackgroundBrushError") as Brush,
                ExpandSide = CommentExpandSides.Top
            };


            BottomComment = new Comment(this)
            {
                Text       = "",
                Background = HostCanvas.FindResource("CommentBackgroundBrush") as Brush,
                ExpandSide = CommentExpandSides.Bottom
            };

            TopComment.Visibility    = Visibility.Collapsed;
            BottomComment.Visibility = Visibility.Collapsed;

            ShowHelpOnMouseOver = false;

            if (QuestButton != null)
            {
                if (QuestButton != null)
                {
                    QuestButton.Click += QuestButton_Click;
                }
            }

            SetZIndex(this, Id);
            SetZIndex(Border, Id);


            if (HitTestBorder != null)
            {
                SetZIndex(HitTestBorder, Id);
            }
            if (BinButton != null)
            {
                SetZIndex(BinButton, Id);
            }
            if (ResizeButton != null)
            {
                SetZIndex(ResizeButton, Id);
            }
            if (QuestButton != null)
            {
                SetZIndex(QuestButton, Id);
            }
            if (CaptionLabel != null)
            {
                SetZIndex(CaptionLabel, Id);
            }
            if (AutoCheckBox != null)
            {
                SetZIndex(AutoCheckBox, Id);
            }

            SetZIndex(TopComment, Id);
            SetZIndex(BottomComment, Id);

            if (GetType() == typeof(SelectionNode))
            {
                return;
            }
            HostCanvas.NodeCollection.Add(this);
        }
Exemple #21
0
 public Theme(VplControl hostCanvas)
 {
     this.hostCanvas = hostCanvas;
 }
Exemple #22
0
        protected Node(VplControl hostCanvas) : base(hostCanvas)
        {
            Guid = Guid.NewGuid();

            id = Interlocked.Increment(ref id);
            id = Interlocked.Increment(ref id);
            Id = id;

            InputPorts = new List<Port>();
            OutputPorts = new List<Port>();
            ControlElements = new List<UIElement>();

            IsHitTestVisible = true;
            HasError = false;


            SpaceCanvas = new Canvas();
            Children.Add(ContentGrid = new Grid {ShowGridLines = false, Background = Brushes.Transparent});


            if (hostCanvas.GraphFlowDirection == GraphFlowDirections.Horizontal)
            {
                // ----------------------------------------------------------------------------------------------------------------------
                // Content Panels
                // ----------------------------------------------------------------------------------------------------------------------
                InputPortPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };

                SetColumn(InputPortPanel, 0);
                SetRow(InputPortPanel, 1);
                ContentGrid.Children.Add(InputPortPanel);

                OutputPortPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };
                SetColumn(OutputPortPanel, 2);
                SetRow(OutputPortPanel, 1);
                ContentGrid.Children.Add(OutputPortPanel);
            }
            else
            {
                // ----------------------------------------------------------------------------------------------------------------------
                // Content Panels
                // ----------------------------------------------------------------------------------------------------------------------
                InputPortPanel = new DockPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                };

                SetRow(InputPortPanel, 0);
                SetColumn(InputPortPanel, 1);
                ContentGrid.Children.Add(InputPortPanel);

                OutputPortPanel = new DockPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                };

                SetColumn(OutputPortPanel, 1);
                SetRow(OutputPortPanel, 2);
                ContentGrid.Children.Add(OutputPortPanel);
            }

            // ----------------------------------------------------------------------------------------------------------------------
            // Content grid row and column definitions
            // ----------------------------------------------------------------------------------------------------------------------
            ContentGrid.ColumnDefinitions.Insert(0,
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)});
            // Input
            ContentGrid.ColumnDefinitions.Insert(0,
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)});
            // Content
            ContentGrid.ColumnDefinitions.Insert(0,
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)});
            // Output

            ContentGrid.RowDefinitions.Insert(0, new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)});
            // Header
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)});
            // Content
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)});
            // Footer
            ContentGrid.RowDefinitions.Insert(1, new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)});
            // Risize area

            ContentGrid.SizeChanged += ContentGridOnSizeChanged;
            ContentGrid.VerticalAlignment = VerticalAlignment.Center;

            // ----------------------------------------------------------------------------------------------------------------------
            // Main content grid
            // ----------------------------------------------------------------------------------------------------------------------
            MainContentGrid = new Grid
            {
                ShowGridLines = false,
                Style = FindResource("MainContentGridStyle") as Style
            };


            SetColumn(MainContentGrid, 1);
            SetRow(MainContentGrid, 1);
            ContentGrid.Children.Add(MainContentGrid);

            // ----------------------------------------------------------------------------------------------------------------------
            // Event delagates
            // ----------------------------------------------------------------------------------------------------------------------
            Border.MouseDown += Node_MouseDown;

            Loaded += Node_Loaded;
            KeyUp += Node_KeyUp;
            KeyDown += Node_KeyDown;

            // ----------------------------------------------------------------------------------------------------------------------
            // Comments
            // ----------------------------------------------------------------------------------------------------------------------
            TopComment = new Comment(this)
            {
                Text =
                    "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                Background = HostCanvas.FindResource("CommentBackgroundBrushError") as Brush,
                ExpandSide = CommentExpandSides.Top
            };


            BottomComment = new Comment(this)
            {
                Text =
                    "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                Background = HostCanvas.FindResource("CommentBackgroundBrush") as Brush,
                ExpandSide = CommentExpandSides.Bottom
            };

            TopComment.Visibility = Visibility.Collapsed;
            BottomComment.Visibility = Visibility.Collapsed;

            ShowHelpOnMouseOver = false;

            if (QuestButton != null) if (QuestButton != null) QuestButton.Click += QuestButton_Click;

            SetZIndex(this, Id);
            SetZIndex(Border, Id);


            if (HitTestBorder != null) SetZIndex(HitTestBorder, Id);
            if (BinButton != null) SetZIndex(BinButton, Id);
            if (ResizeButton != null) SetZIndex(ResizeButton, Id);
            if (QuestButton != null) SetZIndex(QuestButton, Id);
            if (CaptionLabel != null) SetZIndex(CaptionLabel, Id);
            if (AutoCheckBox != null) SetZIndex(AutoCheckBox, Id);

            SetZIndex(TopComment, Id);
            SetZIndex(BottomComment, Id);

            if (GetType() == typeof (SelectionNode)) return;
            HostCanvas.NodeCollection.Add(this);
        }
        public SelectionNode(VplControl hostCanvas) : base(hostCanvas)
        {
            searchTextBox           = new SearchTextBox();
            searchTextBox.OnSearch += searchTextBox_OnSearch;

            var tempTypeList = new List <Type>();

            AddControlToNode(searchTextBox);

            listBox.DisplayMemberPath = "Name";
            listBox.MaxHeight         = 140;

            AddControlToNode(listBox);


            if (hostCanvas.NodesFilterted)
            {
                foreach (var item in hostCanvas.ExternalNodeTypes)
                {
                    if (item.Namespace.Contains(hostCanvas.NodesFilterName))
                    {
                        tempTypeList.Add(item);
                    }
                }
            }
            else
            {
                switch (hostCanvas.NodeTypeMode)
                {
                case NodeTypeModes.OnlyInternalTypes:
                    tempTypeList.AddRange(
                        ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes")
                        .ToList());
                    break;

                case NodeTypeModes.OnlyExternalTypes:
                    tempTypeList.AddRange(hostCanvas.ExternalNodeTypes);
                    break;

                case NodeTypeModes.All:
                    tempTypeList.AddRange(
                        ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes")
                        .ToList());
                    tempTypeList.AddRange(hostCanvas.ExternalNodeTypes);
                    break;
                }
            }

            tempTypeList = tempTypeList.OrderBy(x => x.Name).ToList();


            foreach (var type in tempTypeList.Where(type => !type.IsAbstract))
            {
                if (type.Name.Contains('<') || type.Name.Contains("ComboboxItem"))
                {
                }
                else
                {
                    typeList.Add(type);
                }
            }


            listBox.ItemsSource               = typeList;
            searchTextBox.PreviewKeyDown     += searchTextBox_KeyDown;
            listBox.PreviewMouseLeftButtonUp += listBox_PreviewMouseLeftButtonUp;

            listBox.SelectionMode = SelectionMode.Single;


            Border.MouseLeave += SelectionNode_MouseLeave;
            MouseEnter        += SelectionNode_MouseEnter;
        }