public static void UpdatePort(string name, List <Job> JobList) { Form form = Application.OpenForms["Form1"]; DataGridView JobList_gv; if (form == null) { return; } JobList_gv = form.Controls.Find(name, true).FirstOrDefault() as DataGridView; if (JobList_gv == null) { return; } if (JobList_gv.InvokeRequired) { UpdatePortJob ph = new UpdatePortJob(UpdatePort); JobList_gv.BeginInvoke(ph, name, JobList); } else { List <SlotInfo> tmp = new List <SlotInfo>(); if (JobList.Count != 0) { JobList.Sort((x, y) => { return(-Convert.ToInt16(x.Slot).CompareTo(Convert.ToInt16(y.Slot))); }); } //JobList_gv.DataSource = null; JobList_gv.DataSource = JobList; JobList_gv.Columns["ProcessFlag"].Visible = false; JobList_gv.Columns["Piority"].Visible = false; JobList_gv.Columns["OCRFlag"].Visible = false; JobList_gv.Columns["Position"].Visible = false; //JobList_gv.Columns["Slot"].Visible = false; JobList_gv.Columns["FromPort"].Visible = false; JobList_gv.Columns["Destination"].Visible = false; JobList_gv.Columns["DestinationSlot"].Visible = false; JobList_gv.Columns["LastNode"].Visible = false; JobList_gv.Columns["CurrentState"].Visible = false; JobList_gv.Columns["AlignerFlag"].Visible = false; //Conn_gv.Refresh(); // JobList_gv.ClearSelection(); } }
public static void UpdatePort(string name, string MappingList) { Form form = Application.OpenForms["Form1"]; DataGridView JobList_gv; if (form == null) { return; } JobList_gv = form.Controls.Find(name, true).FirstOrDefault() as DataGridView; if (JobList_gv == null) { return; } if (JobList_gv.InvokeRequired) { UpdatePortJob ph = new UpdatePortJob(UpdatePort); JobList_gv.BeginInvoke(ph, name, MappingList); } else { List <SlotInfo> tmp = new List <SlotInfo>(); for (int i = MappingList.Length - 1; i >= 0; i--) { SlotInfo t = new SlotInfo(); t.Slot = (i + 1).ToString(); switch (MappingList[i]) { case '0': t.ID = "No wafer"; break; case '1': t.ID = "Wafer"; break; case '2': t.ID = "Crossed"; break; case '?': t.ID = "Undefined"; break; case 'W': t.ID = "Overlapping"; break; } tmp.Add(t); } //JobList_gv.DataSource = null; JobList_gv.DataSource = tmp; //Conn_gv.Refresh(); // JobList_gv.ClearSelection(); } }