public IfcProjectOutputPort(string name, PortTypes portType, Type type, Core.VplControl hostCanvas, Guid id = new Guid())
            : base(name, portType, type, hostCanvas, id)
        {
            var modelInfo = Data as IfcModel;

            if (modelInfo == null)
            {
                return;
            }
            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                Filter = "IfcFile |*.ifc",
                Title  = "Save an IFC File"
            };

            saveFileDialog.ShowDialog();
            if (saveFileDialog.FileName != "")
            {
                modelInfo.xModel.SaveAs(saveFileDialog.FileName);
                modelInfo.xModel.Close();
                if (File.Exists(saveFileDialog.FileName))
                {
                    MessageBox.Show("File saved", "My Application", MessageBoxButton.OK);
                }
                else
                {
                    MessageBox.Show("There was an Error \n Please Try again", "My Application", MessageBoxButton.OK);
                }
            }
            else
            {
                MessageBox.Show("Please Connect a Model", "My Application", MessageBoxButton.OK);
            }
        }
Exemplo n.º 2
0
 public PortScanResultEventArgs(string endPoint, int port, PortTypes portType)
     : this()
 {
     EndPoint = endPoint;
     Port     = port;
     PortType = portType;
 }
Exemplo n.º 3
0
        /// <summary>
        ///     Adds an object port to the node
        /// </summary>
        /// <param name="node"></param>
        /// <param name="text">Title of the port</param>
        /// <param name="porttype">Type of the port (Input,Output)</param>
        /// <param name="type">Type of the data of the port</param>
        /// <para name="multicon">Multiple connections in one port</para>
        /// <param name="multiconnections"></param>
        /// <param name="control">The control that will host the data <c>optional</c></param>
        public void AddObjectPort(Node node, string text, PortTypes porttype, RTypes type, bool multiconnections,
                                  Control control)
        {
            var port = new ObjectPort(Host, porttype, text, type)
            {
                Control = control,
                MultipleConnectionsAllowed = multiconnections,
                ParentNode = this
            };

            if (port.PortTypes == PortTypes.Input)
            {
                port.Style = (Style)FindResource("InObjectPortStyle");
                port.index = InputPorts.Count;

                InputPorts.Add(port);
            }
            else
            {
                port.Style = (Style)FindResource("OutObjectPortStyle");
                port.index = OutputPorts.Count;

                OutputPorts.Add(port);
            }
        }
Exemplo n.º 4
0
        public IntegerPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            // Set the DataType
            DataType = typeof(int);

            integerSlider = new SliderExpanderInteger
            {
                Style       = hostCanvas.FindResource("ExpanderSliderStyleInteger") as Style,
                SliderValue = 5,
                SliderMax   = 10,
                SliderMin   = 2,
                SliderStep  = 1
            };

            if (Data != null)
            {
                integerSlider.SliderValue = (int)Data;
            }

            var binding = new Binding("Data")
            {
                Mode   = BindingMode.OneWayToSource,
                Source = this
            };

            integerSlider.SetBinding(SliderExpanderInteger.SliderValueProperty, binding);
            AddPopupContent(integerSlider);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public BimPlusProjectPort(string name, PortTypes portType, Type type, Core.VplControl hostCanvas)
            : base(name, portType, type, hostCanvas)
        {
            _dataController = DataController.Instance;

            // AddPopupContent(contentGrid);

            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition());

            textBlock = new TextBlock()
            {
                MinWidth = 120, MaxWidth = 300, IsHitTestVisible = false
            };

            var button = new Button
            {
                Content = "ProjectSelection",
                Margin  = new Thickness(5)
            };

            button.Click += ButtonOnClick;


            grid.Children.Add(textBlock);
            grid.Children.Add(button);

            AddPopupContent(grid);

            // MouseDown += OnMouseDown;
        }
Exemplo n.º 8
0
        public FilePathPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            // Set the DataType
            DataType = typeof(string);

            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition());

            textBlock = new TextBlock()
            {
                MinWidth = 120, MaxWidth = 300, IsHitTestVisible = false
            };

            if (Data != null)
            {
                textBlock.Text = (string)Data;
            }

            var button = new Button
            {
                Content = "Search",
                Width   = 50,
                Margin  = new Thickness(5)
            };

            button.Click += button_Click;

            grid.Children.Add(textBlock);
            grid.Children.Add(button);

            AddPopupContent(grid);
        }
Exemplo n.º 9
0
        private static void LogEvent(int portNum, PortTypes activePortType, int totalCount)
        {
            EventLog appLog = new EventLog();

            appLog.Source = "Nuwa Katana Self Host Test";
            appLog.WriteEntry(string.Format("Port: [{0}] is already used by: [type: {1}, count: {2}]\n", portNum, activePortType, totalCount),
                              EventLogEntryType.Error);
        }
Exemplo n.º 10
0
 protected override void WriteElements(XmlWriter writer)
 {
     base.WriteElements(writer);
     //Imports.ForEach(x => x.Write(writer));
     Types?.Write(writer);
     Messages.ForEach(x => x.Write(writer));
     PortTypes.ForEach(x => x.Write(writer));
     Bindings.ForEach(x => x.Write(writer));
     Services.ForEach(x => x.Write(writer));
 }
        public StringPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            // Set the DataType
            DataType    = typeof(string);
            portControl = new WatchPortControl();

            AddPopupContent(portControl);

            DataChanged += OnDataChanged;
        }
Exemplo n.º 12
0
        public IfcProjectPort(string name, PortTypes portType, Type type, Core.VplControl hostCanvas)
            : base(name, portType, type, hostCanvas)
        {
            modelController = ModelController.Instance;

            control = new IfcProjectPortControl();
            control.OpenFileButton.Click += ButtonOnClick;

            AddPopupContent(control);

            // MouseDown += OnMouseDown;
        }
Exemplo n.º 13
0
        public Watch3DPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            watch3DControl = new Watch3DControl();
            DataChanged   += OnDataChanged;

            // Init Viewport
            HelixViewport3D       = watch3DControl.ViewPort3D;
            HelixViewport3D.Title = "Watch3D";

            AddPopupContent(watch3DControl);

            MouseWheel += OnMouseWheel;
        }
Exemplo n.º 14
0
        public ExtendedPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas, Guid id = new Guid())
            : base(name, portType, type, hostCanvas)
        {
            // DefaultNode for the handling in the mainHostCanvas --> Checking the parentNode which should not be null
            ParentNode = new DefaultNode(hostCanvas);

            // Check (Create a Guid for the Port)
            if (id == Guid.Empty)
            {
                Id = Guid.NewGuid();
            }

            // UI
            PopupGrid = new Grid
            {
                Background          = Brushes.Transparent,
                Opacity             = 1,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Thickness(2)
            };

            PopupBorder = new Border
            {
                Background      = Brushes.White,
                CornerRadius    = new CornerRadius(5),
                BorderBrush     = new SolidColorBrush(Colors.DarkGray),
                BorderThickness = new Thickness(2),
                Padding         = new Thickness(10)
            };

            // Then add your border to the grid
            PopupGrid.Children.Add(PopupBorder);

            popup = new Popup
            {
                Child              = PopupGrid,
                PlacementTarget    = this,
                PopupAnimation     = PopupAnimation.Fade,
                AllowsTransparency = true,
                ClipToBounds       = true,
            };

            // Turn off the Toolips
            ToolTip = null;

            MouseDown += OnMouseDown;

            MouseEnter           += PortOnMouseEnter;
            MouseLeave           += PortOnMouseLeave;
            PopupGrid.MouseLeave += PopupGridOnMouseLeave;
        }
        public TrueFalsePort(string name, PortTypes portType, Type type, Core.VplControl hostCanvas)
            : base(name, portType, type, hostCanvas)
        {
            toggleButton = new ToggleButton
            {
                Width  = 80,
                Margin = new Thickness(5)
            };

            toggleButton.Checked   += toggleButton_Checked;
            toggleButton.Unchecked += toggleButton_Unchecked;

            toggleButton.IsChecked = true;

            AddPopupContent(toggleButton);
        }
Exemplo n.º 16
0
        /// <summary>
        ///     Adds an execution port to the node
        /// </summary>
        /// <param name="node"></param>
        /// <param name="name"></param>
        /// <param name="porttype"></param>
        /// <param name="text"></param>
        public void AddExecPort(Node node, string name, PortTypes porttype, string text)
        {
            var port = new ExecPort(Host, name, porttype, text, false);

            if (port.PortTypes == PortTypes.Input)
            {
                port.index = InExecPorts.Count;
                InExecPorts.Add(port);
            }
            else
            {
                port.index = OutExecPorts.Count;

                OutExecPorts.Add(port);
            }
            port.ParentNode = this;
        }
        public StringPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            // Set the DataType
            DataType = typeof(string);

            var textBox = new TextBox {
                MinWidth = 50
            };

            AddPopupContent(textBox);

            if (Data != null)
            {
                textBox.Text = (string)Data;
            }

            textBox.TextChanged += TextBoxOnTextChanged;
        }
Exemplo n.º 18
0
        public void AddObjectPort(Node node, string text, PortTypes porttype, RTypes type, bool multiconnections)
        {
            var port = new ObjectPort(Host, porttype, text, type)
            {
                MultipleConnectionsAllowed = multiconnections
            };

            port.ParentNode = node;
            if (port.PortTypes == PortTypes.Input)
            {
                InputPorts?.Add(port);
                InputPortsPanel?.Children.Add(port);
            }
            else
            {
                OutputPorts?.Add(port);
                OutputPortsPanel?.Children.Add(port);
            }
            OnPropertyChanged();
        }
Exemplo n.º 19
0
        public Port(string name, Node parent, PortTypes portType, Type type)
        {
            ParentNode = parent;

            DataType = type;
            PortType = portType;
            Name = name;

            if (portType == PortTypes.Input)
                Style = ParentNode.HostCanvas.FindResource("VplPortStyleLeft") as Style;
            else
                Style = ParentNode.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);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Starts the port scan.
        /// </summary>
        /// <param name="startingPortNumber">The port number to inclusively start scanning. (e.g. 1)</param>
        /// <param name="endingPortNumber">The port number to inclusively stop scanning. (e.g. 65535)</param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public void Start(Int32 startingPortNumber, Int32 endingPortNumber, PortTypes typesToScan)
        {
            if (startingPortNumber < 1)
            {
                throw new ArgumentOutOfRangeException("startingPortNumber",
                                                      "Argument \"startingPortNumber\" must be greater than zero.");
            }
            if (endingPortNumber > 65535)
            {
                throw new ArgumentOutOfRangeException("endingPortNumber",
                                                      "Argument \"endingPortNumber\" must be less than 65535.");
            }

            for (int index = startingPortNumber; index <= endingPortNumber; index++)
            {
                if (CurrentCancellationTokenSource.IsCancellationRequested)
                {
                    return;
                }

                PortScanner scanner = new PortScanner(EndPoint, index);
                scanner.PortScanResult += new EventHandler <PortScanResultEventArgs>(scanner_PortScanResult);

                switch (typesToScan)
                {
                case PortTypes.Tcp:
                {
                    _tasks.Add(Task.Factory.StartNew(() => scanner.AttemptTcpConnectionToPort(),
                                                     CurrentCancellationTokenSource.Token));
                    break;
                }

                case PortTypes.Udp:
                {
                    _tasks.Add(Task.Factory.StartNew(() => scanner.AttemptUdpConnectionToPort(),
                                                     CurrentCancellationTokenSource.Token));
                    break;
                }
                }
            }
        }
Exemplo n.º 21
0
 public ExecPort(VirtualControl host, string name, PortTypes portType, string text, bool multipleConnectors)
 {
     Focusable   = false;
     Text        = text;
     Host        = host;
     StrokeBrush = Brushes.AliceBlue;
     MultipleConnectionsAllowed = multipleConnectors;
     if (portType == PortTypes.Input)
     {
         Style     = FindResource("InExecPortStyle") as Style;
         PortTypes = PortTypes.Input;
     }
     else
     {
         Style     = FindResource("OutExecPortStyle") as Style;
         PortTypes = PortTypes.Output;
     }
     PreviewMouseDown += OnMouseLeftButtonDown;
     PreviewMouseUp   += OnPreviewMouseUp;
     PreviewMouseMove += OnPreviewMouseMove;
     MouseLeave       += (sender, args) => Host.HideLinkingPossiblity();
 }
        public BimPlusViewerPort(string name, PortTypes portType, Type type, Core.VplControl hostCanvas)
            : base(name, portType, type, hostCanvas)
        {
            _dataController = DataController.Instance;

            if (_dataController.IntBase == null)
            {
                return;
            }

            _webViewer = new WebViewer(_dataController.IntBase);
            ViewerGrid = new Grid()
            {
                Height = 600,
                Width  = 400
            };
            ViewerGrid.Children.Add(_webViewer);

            SetAllowTransparencyForPopup(false);
            AddPopupContent(ViewerGrid);

            DataChanged += OnDataChanged;
        }
Exemplo n.º 23
0
        public DoublePort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            // Set the DataType
            DataType = typeof(double);

            doubleSlider = new SliderExpanderDouble
            {
                Style       = hostCanvas.FindResource("ExpanderSliderStyleDouble") as Style,
                SliderValue = 5,
                SliderMax   = 10,
                SliderMin   = 2,
                SliderStep  = 0.01
            };

            var binding = new Binding("Data")
            {
                Mode   = BindingMode.OneWayToSource,
                Source = this
            };

            doubleSlider.SetBinding(SliderExpanderDouble.SliderValueProperty, binding);

            AddPopupContent(doubleSlider);
        }
Exemplo n.º 24
0
 public PortActionConstraint(PortTypes portType)
 {
     _portType = portType;
 }
Exemplo n.º 25
0
 public static void AddPort(PortTypes portType, int port)
 {
     Ports[portType] = port;
 }
Exemplo n.º 26
0
        public static PortTypes ParsePortType(string type)
        {
            PortTypes portType;

            return(PortTypes.TryParse(type, true, out portType) ? portType : PortTypes.Error);
        }
Exemplo n.º 27
0
 public Port(Entity entity, Signal signal, PortTypes type) : base(entity, signal)
 {
     PortType = type;
 }
Exemplo n.º 28
0
 public static bool IsPortPresent(PortTypes port)
 {
     return(_bombInfo.IsPortPresent(port.ToString()));
 }
Exemplo n.º 29
0
        public ObjectPort(VirtualControl host, PortTypes portType, string text, RTypes type)
        {
            Text = text;
            Data = new RVariable(type);
            Host = host;
            // Focusable = false;
            Data.ParentPort = this;


            if (portType == PortTypes.Input)
            {
                if (type == RTypes.ArrayOrFactorOrListOrMatrix)
                {
                    Style = (Style)FindResource("InArrayPortStyle");
                }
                else
                {
                    Style = (Style)FindResource("InObjectPortStyle");
                }
                PortTypes = PortTypes.Input;
            }
            else
            {
                if (type == RTypes.ArrayOrFactorOrListOrMatrix)
                {
                    Style = (Style)FindResource("OutArrayPortStyle");
                }
                else
                {
                    Style = (Style)FindResource("OutObjectPortStyle");
                }
                PortTypes = PortTypes.Output;
            }
            Loaded += (sender, args) =>
            {
                Host   = host;
                _panel = (StackPanel)Template.FindName("ControlsPanel", this);
                _pin   = (UIElement)Template.FindName("Pin", this);
                if (_pin != null)
                {
                    _pin.PreviewMouseDown += OnMouseDown;
                }
                if (_panel == null)
                {
                    return;
                }
                if (Control != null)
                {
                    try
                    {
                        _panel.Children.Remove(Control);
                        _panel.Children.Add(Control);
                    }
                    catch (Exception)
                    {
                        MagicLaboratory.unLinkChild(Control);
                        _panel.Children.Add(Control);
                    }
                }
            };

            PreviewMouseUp   += OnMouseUp;
            PreviewMouseMove += ObjectPort_PreviewMouseMove;
            MouseLeave       += (sender, args) =>
            {
                Host.HideLinkingPossiblity();
                ParentNode.Refresh();
                args.Handled = true;
            };

            Control.Loaded      += Control_Loaded;
            Control.SizeChanged += Control_SizeChanged;
        }
Exemplo n.º 30
0
 public static int PortCount(PortTypes port)
 {
     return(port == PortTypes.ALL ? _bombInfo.GetPortCount() : _bombInfo.GetPortCount(port.ToString()));
 }
Exemplo n.º 31
0
 public static bool DuplicatePorts(PortTypes port = PortTypes.ALL)
 {
     return(port != PortTypes.ALL ? _bombInfo.IsDuplicatePortPresent(port.ToString()) : _bombInfo.IsDuplicatePortPresent());
 }