public static void EventUpdate(string Name, bool Checked) { try { Form form = Application.OpenForms["FormMonitoring"]; CheckBox W; if (form == null) { return; } W = form.Controls.Find(Name + "_ck", true).FirstOrDefault() as CheckBox; if (W == null) { return; } if (W.InvokeRequired) { UpdatePortUsed ph = new UpdatePortUsed(EventUpdate); W.BeginInvoke(ph, Name, Checked); } else { W.Checked = Checked; } } catch { } }
public static void ButtonEnabled(string Name, bool Enabled) { try { Form form = Application.OpenForms["FormMonitoring"]; Button W; if (form == null) { return; } W = form.Controls.Find(Name, true).FirstOrDefault() as Button; if (W == null) { return; } if (W.InvokeRequired) { UpdatePortUsed ph = new UpdatePortUsed(ButtonEnabled); W.BeginInvoke(ph, Name, Enabled); } else { W.Enabled = Enabled; } } catch { } }
public static void ResetAssignCM(string Port, bool Enable) { try { Form form = Application.OpenForms["FormWaferMapping"]; if (form == null) { return; } Button fromPort = form.Controls.Find(Port + "_ASCM", true).FirstOrDefault() as Button; if (fromPort == null) { return; } if (fromPort.InvokeRequired) { UpdatePortUsed ph = new UpdatePortUsed(ResetAssignCM); fromPort.BeginInvoke(ph, Port, Enable); } else { DataGridView FromPort_gv = form.Controls.Find(Port + "Assign_Gv", true).FirstOrDefault() as DataGridView; if (FromPort_gv != null) { FromPort_gv.Enabled = Enable; } fromPort.Enabled = Enable; if (!Enable) { fromPort.Text = "Assign Cancel"; fromPort.BackColor = Color.Green; fromPort.ForeColor = Color.White; } else { fromPort.Text = "Assign Complete"; fromPort.BackColor = Color.Gainsboro; fromPort.ForeColor = Color.Black; } } } catch (Exception e) { logger.Error("UpdateAssignCM: Update fail:" + e.StackTrace); } }
public static void UpdateUseState(string PortName, bool used) { try { Form form = Application.OpenForms["FormMonitoring"]; TextBox Used; if (form == null) { return; } Used = form.Controls.Find(PortName + "_FID", true).FirstOrDefault() as TextBox; if (Used == null) { return; } if (Used.InvokeRequired) { UpdatePortUsed ph = new UpdatePortUsed(UpdateUseState); Used.BeginInvoke(ph, PortName, used); } else { if (used) { //Used.Text = "Used"; Used.BackColor = Color.Green; Used.ForeColor = Color.White; } else { //Used.Text = "Not Used"; Used.BackColor = Color.White; Used.ForeColor = Color.Black; } } } catch { logger.Error("UpdateUseState: Update fail."); } }
public static void UpdateEnabled(string Name, bool Enable) { try { Form form = Application.OpenForms["FormWaferMapping"]; Button btn; if (form == null) { return; } if (Name.Equals("FORM")) { if (form.InvokeRequired) { UpdatePortUsed ph = new UpdatePortUsed(UpdateEnabled); form.BeginInvoke(ph, Name, Enable); } else { if (Enable) { form.Enabled = true; } else { form.Enabled = false; } } } else { btn = form.Controls.Find(Name, true).FirstOrDefault() as Button; if (btn == null) { return; } if (btn.InvokeRequired) { UpdatePortUsed ph = new UpdatePortUsed(UpdateEnabled); btn.BeginInvoke(ph, Name, Enable); } else { if (Enable) { btn.Enabled = true; } else { btn.Enabled = false; } } } } catch { logger.Error("UpdateUseState: Update fail."); } }