private void RefreshPLCComm() { if (this.dataGridViewDevDB1.InvokeRequired) { DlgtRefreshPLCComm dlgtRefresh = new DlgtRefreshPLCComm(RefreshPLCComm); this.Invoke(dlgtRefresh); } else { DataTable dt1 = null; DataTable dt2 = null; //DataTable dtTask = null; string taskDetail = ""; presenter.GetRunningInfo(ref dt1, ref dt2, ref taskDetail); this.dataGridViewDevDB1.DataSource = dt1; for (int i = 0; i < this.dataGridViewDevDB1.Columns.Count; i++) { this.dataGridViewDevDB1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; this.dataGridViewDevDB1.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } this.dataGridViewDevDB1.Columns[this.dataGridViewDevDB1.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; this.dataGridViewDevDB2.DataSource = dt2; for (int i = 0; i < this.dataGridViewDevDB2.Columns.Count; i++) { this.dataGridViewDevDB2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; this.dataGridViewDevDB2.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } this.dataGridViewDevDB2.Columns[this.dataGridViewDevDB2.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; this.richTextBoxTaskInfo.Text = taskDetail; } }
private void RefreshRgvSwitch() { if (this.dataGridView1.InvokeRequired) { DlgtRefreshPLCComm dlgtRefreshRgv = new DlgtRefreshPLCComm(RefreshRgvSwitch); this.Invoke(dlgtRefreshRgv); } else { DataTable dtMainPlc1 = new DataTable(); DataTable dtRgvPlc1 = new DataTable(); string reStr = ""; presenter.GetRgvSwitch(1, ref dtMainPlc1, ref dtRgvPlc1, ref reStr); this.dataGridView1.DataSource = dtMainPlc1; this.dataGridView2.DataSource = dtRgvPlc1; presenter.GetRgvSwitch(2, ref dtMainPlc1, ref dtRgvPlc1, ref reStr); this.dataGridView3.DataSource = dtMainPlc1; this.dataGridView4.DataSource = dtRgvPlc1; } }
private void RefreshPLCComm() { if (this.dataGridViewDevDB1.InvokeRequired) { DlgtRefreshPLCComm dlgtRefresh = new DlgtRefreshPLCComm(RefreshPLCComm); this.Invoke(dlgtRefresh); } else { string nodeName = GetNodenameSel(); DataTable dt1 = null; DataTable dt2 = null; //DataTable dtTask = null; string taskDetail = ""; if (!NodeMonitor.GetDevRunningInfo(nodeName, ref dt1, ref dt2, ref taskDetail)) { Console.WriteLine("刷新工位信息失败"); return; } this.dataGridViewDevDB1.DataSource = dt1; for (int i = 0; i < this.dataGridViewDevDB1.Columns.Count; i++) { this.dataGridViewDevDB1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; this.dataGridViewDevDB1.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } this.dataGridViewDevDB1.Columns[this.dataGridViewDevDB1.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; this.dataGridViewDevDB2.DataSource = dt2; for (int i = 0; i < this.dataGridViewDevDB2.Columns.Count; i++) { this.dataGridViewDevDB2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; this.dataGridViewDevDB2.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } this.dataGridViewDevDB2.Columns[this.dataGridViewDevDB2.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; this.richTextBoxTaskInfo.Text = taskDetail; } }