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); } }
public PortScanResultEventArgs(string endPoint, int port, PortTypes portType) : this() { EndPoint = endPoint; Port = port; PortType = portType; }
/// <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); } }
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); }
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); }
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 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; }
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); }
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); }
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; }
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; }
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; }
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); }
/// <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; }
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(); }
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); }
/// <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; } } } }
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; }
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); }
public PortActionConstraint(PortTypes portType) { _portType = portType; }
public static void AddPort(PortTypes portType, int port) { Ports[portType] = port; }
public static PortTypes ParsePortType(string type) { PortTypes portType; return(PortTypes.TryParse(type, true, out portType) ? portType : PortTypes.Error); }
public Port(Entity entity, Signal signal, PortTypes type) : base(entity, signal) { PortType = type; }
public static bool IsPortPresent(PortTypes port) { return(_bombInfo.IsPortPresent(port.ToString())); }
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; }
public static int PortCount(PortTypes port) { return(port == PortTypes.ALL ? _bombInfo.GetPortCount() : _bombInfo.GetPortCount(port.ToString())); }
public static bool DuplicatePorts(PortTypes port = PortTypes.ALL) { return(port != PortTypes.ALL ? _bombInfo.IsDuplicatePortPresent(port.ToString()) : _bombInfo.IsDuplicatePortPresent()); }