public void PostScanHook(String ScanValue) { char[] delim = { '|' }; // NOTE: the main thread will // after scanning // Update the barcode in the ExoNetUT object TheController.SaveBarCodeValue(TopIndex, ScanValue); //Update the UI: Necessary to do this here. StatusLabelCombo LabelStatus = new StatusLabelCombo(); LabelStatus.LabelBox = ""; LabelStatus.Status = ""; UpdateUI(LabelStatus); // update the status and commitPersist(rundone.txt) of this EN to file LastLabel = TheController.GetLabel(TopIndex).Trim(delim); // print label at the end of commiting LabelPrinter.PrintLabel( LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0], LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1] ); LabelPrinter.PrintLabel( LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0], LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1] ); }
public static void CtrlThreadFunc() { CtrlThreadStarted = true; //instantiate the other threads Thread PcapThread = new Thread(new ThreadStart(PcapThreadFunc)); Thread TftpThread = new Thread(new ThreadStart(TftpdThreadFunc)); Thread SignalPThread = new Thread(new ThreadStart(SignalPThreadFunc)); //start the threads PcapThread.Start(); TftpThread.Start(); SignalPThread.Start(); // keep saving in-flight by calling // SaveToFile(inflight.txt) // within that loop while (CtrlThreadEnable) { Ping Pong = new Ping(); int timeout = 100; foreach (ExoNetUT IterUT in TheModel.ExoNetStack) { if (IterUT.Alive == true) { if (IterUT.DynamicIP != "") { PingReply reply = Pong.Send(IterUT.DynamicIP.Replace("169.254", "172.20"), timeout); } } } System.Threading.Thread.Sleep(2000); TheModel.SaveInFlight(); //call to update the view. TheModel.TodayStatus.UpdateStatus(TheModel.ExoNetStack); StatusLabelCombo LabelStatus = new StatusLabelCombo(); LabelStatus.Status = TheModel.TodayStatus.ToString(); LabelStatus.LabelBox = ""; _currentPageViewModel.UpdateUI(LabelStatus); } PcapThread.Abort(); TftpThread.Abort(); SignalPThread.Abort(); ShutMeDown(); }
private void ReflectChanges(object sender, PropertyChangedEventArgs e) { //Routine update the property elements List <ReflectUI> Reflection = sender as List <ReflectUI>; StatusLabelCombo LabelStatus = new StatusLabelCombo(e.PropertyName); // absolutely make sure that we are in ui threead that // owns the DUTStackPanel controls. the closure(sender and e) // will get dispatched to ui now. This will work even if the // caller raising the reflectchanges event handler is a // different thread. it can dispatch the reflection and e to // 'this' but cant steal DUTStackPanel. 'this' is a ui control. this.Dispatcher.Invoke(() => { for (int i = 0; i < 16; i++) { //update all elements of all en visuals DUTStackPanel[i].Light1.Fill = Reflection[i].Light1; DUTStackPanel[i].Light2.Fill = Reflection[i].Light2; DUTStackPanel[i].Light3.Fill = Reflection[i].Light3; DUTStackPanel[i].Status.Text = Reflection[i].Status; DUTStackPanel[i].ENBox.Opacity = Reflection[i].Visibility; } if (LabelStatus.LabelBox.Contains("Finding Next Ready Board")) { WorkBox.Text = LabelStatus.LabelBox; NextButton.IsEnabled = false; } else { if (!WorkBox.Text.Contains(LabelStatus.LabelBox)) { WorkBox.Text += LabelStatus.LabelBox; } if (LabelStatus.Status != "") { StatBlock.Text = LabelStatus.Status.Replace("#", ": ").Replace("|", " | "); } } }); }
public override void UpdateUI(StatusLabelCombo LabelStatus) { String LabelBx = ""; if (TopIndex == -1) { LabelBx = NextOReset(); } // transcode_copy all the changes from ExonetUIstack to Reflectuistack // also status String if (UpdateUIEvent != null) { for (int i = 0; i < 16; i++) { if (TheController.ReturnLabeledStatus(i)) { continue; } if (TheController.IsAlive(i)) { ReflectUIStack[i].Light1 = Brushes.Red; ReflectUIStack[i].Light2 = Brushes.Gray; ReflectUIStack[i].Light3 = Brushes.Gray; ReflectUIStack[i].Status = "Connected: "; ReflectUIStack[i].Status += TheController.ReturnLinkLocalIP(i); } else { ReflectUIStack[i].Status = "Not Connected"; ReflectUIStack[i].Light1 = Brushes.Gray; ReflectUIStack[i].Light2 = Brushes.Gray; ReflectUIStack[i].Light3 = Brushes.Gray; ReflectUIStack[i].Visibility = 0.5; continue; } if (TheController.ReturnSvcdStatus(i)) { ReflectUIStack[i].Light2 = Brushes.Red; ReflectUIStack[i].Status = "Firmware Serviced"; } if (TheController.ReturnReadyPending(i)) { ReflectUIStack[i].Light3 = Brushes.Red; ReflectUIStack[i].Status = "Alloted and Testing"; } if (TheController.ReturnReadyPending(i) && TheController.ReturnPingStatus(i)) { ReflectUIStack[i].Status = "Ready for Scanning"; } if (i == TopIndex) { ReflectUIStack[i].Light1 = Brushes.Green; ReflectUIStack[i].Light2 = Brushes.Green; ReflectUIStack[i].Light3 = Brushes.Green; ReflectUIStack[i].Visibility = 1; if (TheController.ReturnBlinkingStatus(TopIndex) && !ScanEnabled) { LabelBx += "====== New XoNet DUT *BLINKING* *BLINKING* ======"; UIScanEnable(); // enable the scan button. LabelBx += Environment.NewLine; //LabelBx += "====== *BLINKING* *BLINKING* ======"; //LabelBx += Environment.NewLine; LabelBx += Environment.NewLine; LabelBx += Environment.NewLine; LabelBx += "------> IDENTIFY THE CONTINUOUSLY BLINKING BOARD <------"; LabelBx += Environment.NewLine; LabelBx += "------> CLICK [START SCAN] TO CONTINUE <------"; LabelBx += Environment.NewLine; LabelBx += "then use scanner to scan the pcb barcode of the blinking board"; LabelBx += Environment.NewLine; LabelBx += Environment.NewLine; //LabelBx += Environment.NewLine; } if (TheController.ReturnBarCode(i) != "") { ReflectUIStack[i].Status = "Scanned"; LabelBx += "PCB Scanned : " + TheController.ReturnBarCode(i); LabelBx += Environment.NewLine; LabelBx += "MAC : " + TheController.ReturnEtherMac(i); LabelBx += Environment.NewLine; LabelBx += "Label Printed"; LabelBx += Environment.NewLine; LabelBx += Environment.NewLine; LabelBx += Environment.NewLine; LabelBx += "------> DISCONNECT PCB & APPLY LABEL <------"; LabelBx += Environment.NewLine; LabelBx += "------> WHEN DONE CLICK [NEXT] TO CONTINUE <------"; LabelBx += Environment.NewLine; LabelBx += "Caution: DO NOT click NEXT before disconnecting the PCB"; } if (TheController.ReturnBlinkingStatus(i)) { ReflectUIStack[i].Status = "BLINKING"; } } else { ReflectUIStack[i].Visibility = 0.5; } } LabelStatus.LabelBox += LabelBx; UpdateUIEvent(ReflectUIStack, new PropertyChangedEventArgs(LabelStatus.ToString())); } }
public virtual void UpdateUI(StatusLabelCombo _stat) { return; }