public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { //add a button to the inputGrid on the dynElement sunPathButt = new dynNodeButton(); sunPathButt.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; sunPathButt.VerticalAlignment = System.Windows.VerticalAlignment.Center; sunPathButt.Click += new System.Windows.RoutedEventHandler(registerButt_Click); sunPathButt.Content = "Use SunPath\nfrom Current View"; sunPathButt.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; sunPathButt.VerticalAlignment = System.Windows.VerticalAlignment.Center; tb = new System.Windows.Controls.TextBox(); tb.Text = "No SunPath Registered"; tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; tb.VerticalAlignment = System.Windows.VerticalAlignment.Center; SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); tb.Background = backgroundBrush; tb.BorderThickness = new Thickness(0); tb.IsReadOnly = true; tb.IsReadOnlyCaretVisible = false; nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.Children.Add(tb); nodeUI.inputGrid.Children.Add(sunPathButt); System.Windows.Controls.Grid.SetRow(sunPathButt, 0); System.Windows.Controls.Grid.SetRow(tb, 1); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { //add a text box to the input grid of the control tb = new TextBox(); tb.HorizontalAlignment = HorizontalAlignment.Stretch; tb.VerticalAlignment = VerticalAlignment.Center; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); //turn off the border var backgroundBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); tb.Background = backgroundBrush; tb.BorderThickness = new Thickness(0); tb.DataContext = this; var bindingSymbol = new Binding("Symbol") { Mode = BindingMode.TwoWay }; tb.SetBinding(TextBox.TextProperty, bindingSymbol); tb.TextChanged += tb_TextChanged; }
public override void SetupCustomUIElements(Controls.dynNodeView NodeUI) { image1 = new System.Windows.Controls.Image(); image1.Width = 320; image1.Height = 240; //image1.Margin = new Thickness(5); image1.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; image1.Name = "image1"; image1.VerticalAlignment = System.Windows.VerticalAlignment.Top; //image1.DataContext = resultImageUI; var bindingVal = new System.Windows.Data.Binding("ResultImage") { Mode = BindingMode.OneWay, Converter = new ImageConverter(), NotifyOnValidationError = false, Source = resultImageUI, //Path = ResultImageUI, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; image1.SetBinding(System.Windows.Controls.Image.SourceProperty, bindingVal); NodeUI.inputGrid.Children.Add(image1); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { //add a button to the inputGrid on the dynElement Button analysisResultButt = new dynNodeButton(); nodeUI.inputGrid.Children.Add(analysisResultButt); analysisResultButt.Margin = new Thickness(0, 0, 0, 0); analysisResultButt.HorizontalAlignment = HorizontalAlignment.Center; analysisResultButt.VerticalAlignment = VerticalAlignment.Center; analysisResultButt.Click += new RoutedEventHandler(analysisResultButt_Click); analysisResultButt.Content = "Select AR"; analysisResultButt.HorizontalAlignment = HorizontalAlignment.Stretch; analysisResultButt.VerticalAlignment = VerticalAlignment.Center; }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { //topControl.Height = 200; //topControl.Width = 300; //add an edit window option to the //main context window var editWindowItem = new System.Windows.Controls.MenuItem(); editWindowItem.Header = "Edit..."; editWindowItem.IsCheckable = false; nodeUI.MainContextMenu.Items.Add(editWindowItem); editWindowItem.Click += new RoutedEventHandler(editWindowItem_Click); nodeUI.UpdateLayout(); nodeUI.MouseDown += new MouseButtonEventHandler(nodeUI_MouseDown); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { base.SetupCustomUIElements(nodeUI); var resetButt = new Button() { Content = "Reset", ToolTip = "Resets the system to its initial state.", HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top }; resetButt.Click += delegate { _reset = true; RequiresRecalc = true; }; nodeUI.inputGrid.Children.Add(resetButt); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { image1 = new System.Windows.Controls.Image { //Width = 320, //Height = 240, MaxWidth = 400, MaxHeight = 400, Margin = new Thickness(5), HorizontalAlignment = System.Windows.HorizontalAlignment.Center, Name = "image1", VerticalAlignment = System.Windows.VerticalAlignment.Center }; //nodeUI.inputGrid.Children.Add(image1); nodeUI.grid.Children.Add(image1); image1.SetValue(Grid.RowProperty, 2); image1.SetValue(Grid.ColumnProperty, 0); image1.SetValue(Grid.ColumnSpanProperty, 3); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { //add a drop down list to the window combo = new ComboBox(); combo.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; combo.VerticalAlignment = System.Windows.VerticalAlignment.Center; nodeUI.inputGrid.Children.Add(combo); System.Windows.Controls.Grid.SetColumn(combo, 0); System.Windows.Controls.Grid.SetRow(combo, 0); combo.DropDownOpened += new EventHandler(combo_DropDownOpened); combo.SelectionChanged += delegate { if (combo.SelectedIndex != -1) { this.RequiresRecalc = true; } }; PopulateComboBox(); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { string[] serialPortNames = System.IO.Ports.SerialPort.GetPortNames(); foreach (string portName in serialPortNames) { if (lastComItem != null) { lastComItem.IsChecked = false; // uncheck last checked item } comItem = new System.Windows.Controls.MenuItem(); comItem.Header = portName; comItem.IsCheckable = true; comItem.IsChecked = true; comItem.Checked += new System.Windows.RoutedEventHandler(comItem_Checked); nodeUI.MainContextMenu.Items.Add(comItem); port.PortName = portName; lastComItem = comItem; } }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { base.SetupCustomUIElements(nodeUI); nodeUI.Width = 200; var drawPlane = new System.Windows.Controls.Image { Stretch = Stretch.Fill, HorizontalAlignment = HorizontalAlignment.Stretch, Height = 100 }; nodeUI.inputGrid.Children.Add(drawPlane); this.RequestChangeColorRange += new EventHandler(delegate { DispatchOnUIThread(delegate { WriteableBitmap bmp = CompleteColorScale(_start, _end); drawPlane.Source = bmp; }); }); }
public override void SetupCustomUIElements(Controls.dynNodeView nodeUI) { MenuItem mi = new MenuItem(); mi.Header = "Zoom to Fit"; mi.Click += new RoutedEventHandler(mi_Click); nodeUI.MainContextMenu.Items.Add(mi); //take out the left and right margins and make this so it's not so wide //NodeUI.inputGrid.Margin = new Thickness(10, 10, 10, 10); //add a 3D viewport to the input grid //http://helixtoolkit.codeplex.com/wikipage?title=HelixViewport3D&referringTitle=Documentation _watchView = new WatchView(); _watchView.watch_view.DataContext = this; RenderOptions.SetEdgeMode(_watchView, EdgeMode.Unspecified); Points = new Point3DCollection(); Lines = new Point3DCollection(); _points = new PointsVisual3D { Color = Colors.Red, Size = 6 }; _lines = new LinesVisual3D { Color = Colors.Blue, Thickness = 1 }; _points.Points = Points; _lines.Points = Lines; _watchView.watch_view.Children.Add(_lines); _watchView.watch_view.Children.Add(_points); _watchView.watch_view.Children.Add(new DefaultLights()); _watchView.Width = 400; _watchView.Height = 300; System.Windows.Shapes.Rectangle backgroundRect = new System.Windows.Shapes.Rectangle(); backgroundRect.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; backgroundRect.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; //backgroundRect.RadiusX = 10; //backgroundRect.RadiusY = 10; backgroundRect.IsHitTestVisible = false; BrushConverter bc = new BrushConverter(); Brush strokeBrush = (Brush)bc.ConvertFrom("#313131"); backgroundRect.Stroke = strokeBrush; backgroundRect.StrokeThickness = 1; SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(250, 250, 216)); backgroundRect.Fill = backgroundBrush; //nodeUI.inputGrid.Children.Add(backgroundRect); //nodeUI.inputGrid.Children.Add(_watchView); nodeUI.grid.Children.Add(backgroundRect); nodeUI.grid.Children.Add(_watchView); backgroundRect.SetValue(Grid.RowProperty, 2); backgroundRect.SetValue(Grid.ColumnSpanProperty, 3); _watchView.SetValue(Grid.RowProperty, 2); _watchView.SetValue(Grid.ColumnSpanProperty, 3); _watchView.Margin = new Thickness(5, 0, 5, 5); backgroundRect.Margin = new Thickness(5, 0, 5, 5); CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); }