public void SetHWC(HardwareController hwc) { HWC = hwc; string[] idents = hwc.IOControllerControlIdents; Array.Sort<string>(idents); ParameterControllerColumn.ItemsSource = new List<string>(idents); IOPortType[] s = new IOPortType[] { IOPortType.NOUSE, IOPortType.IN, IOPortType.INOUT, IOPortType.OUT }; ParameterPortTypeColumn.ItemsSource = new List<IOPortType>(s); List<IOGridEntry> entrys = new List<IOGridEntry>(); foreach (var i in idents) { IOController ic = hwc.GetIOController(i); IOPort[] all = ic.All; foreach (var p in all) { entrys.Add(new IOGridEntry() { ParamController = i, ParamBit = p.Bit, ParamPortType = p.PortType, ParamInName = p.InName, ParamOutName = p.OutName }); } } Data.Parameters = entrys; }
public void SetHWC(HardwareController hwc) { HWC = hwc; string[] all = HWC.AxesControlIdents; foreach (string s in all) { Data.AllAxesItems.Add(s); } }
public void SetHWC(HardwareController hwc) { HWC = hwc; string[] all = HWC.ToolsControlIdents; Array.Sort<string>(all); foreach (string s in all) { Data.AllToolsItems.Add(s); } }
public HardwareSettings(HardwareController hwc) { InitializeComponent(); Data = FindResource("datahandler") as HardwareSettingsDataHandler; HWC = hwc; this.SetHWC(); AxesConfig.SetHWC(hwc); IOConfig.SetHWC(hwc); ToolsConfig.SetHWC(hwc); }
/// <summary> /// Erstellt für alle Achsen im HardwareController die GUI Elemente. /// </summary> /// <param name="hwc">Der Verbundene HardwareController</param> public void SetHardwareControllerAndInitGUI(HardwareController hwc) { HWC = hwc; string[] axes = hwc.AxesControlIdents; for (int i = 0; i < axes.Length; ++i) { MainGrid.RowDefinitions.Add(NewRowDef()); Axis a = HWC.GetAxis(axes[i]); UI_OneAxis one = new UI_OneAxis(); one.SetAxisAndInitGUI(HWC, a); Grid.SetRow(one, i + 1); MainGrid.Children.Add(one); } }
public static void RunTest(MainWindow mw, HardwareController hwc) { #if TEST MW = mw; HWC = hwc; while (true) { TestWindow tw = new TestWindow(); if (tw.ShowDialog() != true) continue; int testNr = tw.SelectedTest.SelectedIndex; switch (testNr) { case 0: TrackedThread testThread = new TrackedThread("Test ImgButton", Test1); testThread.Start(); return; case 1: TrackedThread testThread2 = new TrackedThread("Test Enable Move Move Home Disable", Test2); testThread2.Start(); return; case 2: TrackedThread testThread3 = new TrackedThread("Test TabControl Main Window", Test3); testThread3.Thread.SetApartmentState(ApartmentState.STA); testThread3.Start(); return; case 3: TrackedThread testThread4 = new TrackedThread("Test Script with FAK", Test4); testThread4.Thread.SetApartmentState(ApartmentState.STA); testThread4.Start(); return; case 4: TrackedThread testThread5 = new TrackedThread("Test Script with FAK", Test5); testThread5.Thread.SetApartmentState(ApartmentState.STA); testThread5.Start(); return; default: MessageBox.Show("Unknown Test "); break; } } #endif }
public CameraClickAndMove(HardwareController hwc) { InitializeComponent(); this.Progress.Maximum = TimeStepsMS; LoadValues(); Data = FindResource("datahandler") as CameraClickAndMoveDataHandler; HWC = hwc; //NewImage(); ImgThread = new TrackedThread("CameraClickAndMove Window New Image Thread", NewImageContinousShot); ImgThread.Start(); PreviousWindowState = System.Windows.WindowState.Normal; Console.WriteLine(this.GetType().AssemblyQualifiedName); }
/// <summary> /// Erstellt für alle IOController im HardwareController die GUI Elemente. /// </summary> /// <param name="hwc">Der Verbundene HardwareController</param> public void SetHardwareControllerAndInitGUI(HardwareController hwc) { HWC = hwc; string[] ios = HWC.IOControllerControlIdents; int inRow = 0; int outRow = 0; foreach (var i in ios) { IOController ic = HWC.GetIOController(i); foreach (var p in ic.All) { if (p.PortType == IOPortType.IN || p.PortType == IOPortType.INOUT) { RowDefinition rdin = new RowDefinition(); rdin.Height = new GridLength(30); InGrid.RowDefinitions.Add(rdin); Label l = new Label(); l.Content = p.InName; Grid.SetRow(l, inRow); InGrid.Children.Add(l); Label l2 = new Label(); l2.Content = ic.ControlIdent; Grid.SetRow(l2, inRow); Grid.SetColumn(l2, 1); InGrid.Children.Add(l2); Label l3 = new Label(); l3.Content = p.Bit; Grid.SetRow(l3, inRow); Grid.SetColumn(l3, 2); InGrid.Children.Add(l3); ImgButton b = new ImgButton(); b.Width = 60; b.ImgToShow = p.InValue ? "bullet_green" : "bullet_white"; b.Text = p.InValue ? "ON" : "OFF"; Grid.SetRow(b, inRow); Grid.SetColumn(b, 3); InGrid.Children.Add(b); ic.OnInBitValueChange += new IOControllerIntBoolEvent(delegate(IOController iocont, int bit, bool val) { if (bit == p.Bit) { this.Dispatcher.Invoke(new Action(()=> { b.ImgToShow = val ? "bullet_green" : "bullet_white"; b.Text = val ? "ON" : "OFF"; })); } }); ++inRow; } if (p.PortType == IOPortType.OUT || p.PortType == IOPortType.INOUT) { RowDefinition rdout = new RowDefinition(); rdout.Height = new GridLength(30); OutGrid.RowDefinitions.Add(rdout); Label l = new Label(); l.Content = p.OutName; Grid.SetRow(l, outRow); OutGrid.Children.Add(l); Label l2 = new Label(); l2.Content = ic.ControlIdent; Grid.SetRow(l2, outRow); Grid.SetColumn(l2, 1); OutGrid.Children.Add(l2); Label l3 = new Label(); l3.Content = p.Bit; Grid.SetRow(l3, outRow); Grid.SetColumn(l3, 2); OutGrid.Children.Add(l3); ImgButton b = new ImgButton(); b.Width = 60; b.ImgToShow = p.OutValue ? "bullet_green" : "bullet_white"; b.Text = p.OutValue ? "ON" : "OFF"; ic.OnOutBitValueChange += new IOControllerIntBoolEvent(delegate(IOController iocont, int bit, bool val) { if (bit == p.Bit) { this.Dispatcher.Invoke(new Action(() => { b.ImgToShow = val ? "bullet_green" : "bullet_white"; b.Text = val ? "ON" : "OFF"; })); } }); b.Click += new RoutedEventHandler(delegate(System.Object o, RoutedEventArgs e) { ic.WriteOutValue(p.Bit, !p.OutValue); }); Grid.SetRow(b, outRow); Grid.SetColumn(b, 3); OutGrid.Children.Add(b); ++outRow; } } } }
public void SetAxisAndInitGUI(HardwareController hwc, Axis axis) { HWC = hwc; MyAxis = axis; Data.AxisName = MyAxis.ControlIdent; EnableChange(axis, axis.IsEnable); HasFaultChange(axis, axis.HasFault); this.Data.AbsPosStr = Axis.SConvertIntToStr(MyAxis.Position, true); this.Data.RelPosStr = Axis.SConvertIntToStr(HWC.ConvertCoordinatesAlways(MyAxis.ControlIdent, -MyAxis.Position) * (-1), true); //Verbinde Notifyer MyAxis.IsEnableChanged += EnableChange; MyAxis.HasFaultChange += HasFaultChange; MyAxis.PositionChange += PositionChange; MyAxis.VelocityChange += VelocityChange; //Load Values DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow"); Speed = ds.Ints[axis.ControlIdent + "-FR-Speed", 0]; Distance = ds.Ints[axis.ControlIdent + "-FR-Distance", 0]; UseDistance = ds.Bools[axis.ControlIdent + "-FR-UseDis", false]; DisplayFreeRunValues(); FreeRunThread = new TrackedThread("Free Run Distance Thread: "+ MyAxis, this.FreeRunThreadMethod); FreeRunQueue = new Queue<Action>(); FreeRunThread.Start(); }
public static void SetHWC(HardwareController hwc) { HWC = hwc; }
public static void Display(HardwareController hwc) { ScriptID = 0; if (HWC == null && hwc == null) { MessageBox.Show("Error while displaying Camera Window!"); return; } if (SingletonWindow == null) { if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) { TrackedThread tt = new TrackedThread("Inner Thread,CameraClickAndMove.Display ", () => { SingletonWindow = new CameraClickAndMove(hwc); SingletonWindow.ShowDialog(); }); tt.ApartmentState = ApartmentState.STA; tt.Start(true); return; } SingletonWindow = new CameraClickAndMove(hwc); SingletonWindow.Show(); } else { if (SingletonWindow.Dispatcher.Thread != System.Threading.Thread.CurrentThread) { SingletonWindow.Dispatcher.Invoke(new Action(() => { CameraClickAndMove.Display(HWC); })); return; } SingletonWindow.WindowState = SingletonWindow.PreviousWindowState; SingletonWindow.ShowInTaskbar = true; } SingletonWindow.Data.ButtonsVisible = Visibility.Collapsed; }