public void SetRows(List <Model.Curve> curveList, List <Model.Device> deviceList) { this.curveList = curveList; this.deviceList = deviceList; tableOfCheckBoxes.Clear(); dataGridViewX1.Rows.Clear(); for (int i = 0; i < curveList.Count; i++) { DataGridViewRow row = new DataGridViewRow(); Model.Device device = deviceList.Find((de) => { return(de.CurveId == curveList[i].Id); }); DataGridViewLabelXCell cell1 = new DataGridViewLabelXCell(); cell1.Value = curveList[i].CurveName; DataGridViewLabelXCell cell2 = new DataGridViewLabelXCell(); DataGridViewLabelXCell cell3 = new DataGridViewLabelXCell(); if (device != null) { cell2.Value = device.Name; cell3.Value = device.SamplingRate; } else { cell2.Value = "未设定"; cell3.Value = "未设定"; } DataGridViewLabelXCell cell4 = new DataGridViewLabelXCell(); cell4.Tag = curveList[i].Id; Data.DataFetcher fe = GlobalTable.GlobalTables.Instance.GetFetcher(curveList[i].Id); if (fe == null) { cell4.Value = "未设定"; } else { cell4.Value = fe.ToString(); } //DataGridViewLabelXCell cell5 = new DataGridViewLabelXCell(); //cell5.Tag = curveList[i].Id; //if (fe is Data.NetDataFetcher) // cell5.Value = (fe as Data.NetDataFetcher).GetFetcherState(curveList[i].Id); //else // cell5.Value = "位置"; DataGridViewCheckBoxCell cell6 = new DataGridViewCheckBoxCell(); tableOfCheckBoxes.Add(curveList[i].Id, cell6); cell6.Tag = curveList[i].Id; //if (cell5.Value.ToString() == "传输中") //{ // cell6.Value = true; //} row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); row.Cells.Add(cell4); // row.Cells.Add(cell5); row.Cells.Add(cell6); dataGridViewX1.Rows.Add(row); } }
private void RegisterFetcher(Guid curveId, Data.DataFetcher fetcher) { if (SourceTable.ContainsKey(curveId)) { SourceTable[curveId] = fetcher; } else { SourceTable.Add(curveId, fetcher); } //fetcher.AddRegisteredId(curveId); }
private void BTN_Confirm_Click(object sender, EventArgs e) { Dictionary <Guid, string> dic = dataSourceConfigPanel1.GetCurveFetcherMap(); foreach (Guid id in dic.Keys) { string fetcherName = dic[id]; Data.DataFetcher fetcher = GlobalTable.GlobalTables.GetFetcherByName(fetcherName); if (fetcher != null) { LoggingDataManager.GlobalTable.GlobalTables.Instance.CreateConnection(id, Data.NetDataFetcher.Instance); } } MessageBox.Show("Òѱ£´æÉèÖÃ."); this.DialogResult = DialogResult.OK; }
public void SetRows(List <Model.Curve> curveList, List <Model.Device> deviceList) { this.curveList = curveList; this.deviceList = deviceList; tableOfComboBoxes.Clear(); dataGridViewX1.Rows.Clear(); for (int i = 0; i < curveList.Count; i++) { DataGridViewRow row = new DataGridViewRow(); Model.Device device = deviceList.Find((de) => { return(de.CurveId == curveList[i].Id); }); DataGridViewLabelXCell cell1 = new DataGridViewLabelXCell(); cell1.Value = curveList[i].CurveName; DataGridViewLabelXCell cell2 = new DataGridViewLabelXCell(); DataGridViewLabelXCell cell3 = new DataGridViewLabelXCell(); if (device != null) { cell2.Value = device.Name; cell3.Value = device.SamplingRate; } else { cell2.Value = "未设定"; cell3.Value = "未设定"; } DataGridViewComboBoxCell cell4 = new DataGridViewComboBoxCell(); cell4.Tag = curveList[i].Id; tableOfComboBoxes.Add(curveList[i].Id, cell4); cell4.Items.AddRange(new string[1] { Data.NetDataFetcher.Instance.ToString() }); cell4.Value = Data.NetDataFetcher.Instance.ToString(); Data.DataFetcher fetcher = GlobalTable.GlobalTables.Instance.GetFetcher(curveList[i].Id); if (fetcher != null) { cell4.Value = fetcher.ToString(); } row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); row.Cells.Add(cell4); dataGridViewX1.Rows.Add(row); } }
public void CreateConnection(Guid curveId, Data.DataFetcher fetcher) { RegisterCurve(curveId); RegisterFetcher(curveId, fetcher); RegisterDataCache(curveId, new Data.CurveData()); }