public Calibration(bool _twoZond, Dictionary<string, Dictionary<string, byte>> _devices) { InitializeComponent(); db = new ADatabase("calibration"); if (db.Connect()) { if (!ADatabase.CalibrationDatabaseStructureIsOK(db.Connection)) { db.CreateCalibrationDBStructure(); } twoZond = _twoZond; devices = _devices; List<string> devicesForCalibration = new List<string>(); foreach (KeyValuePair<string, Dictionary<string, byte>> baseblock in devices) { foreach (KeyValuePair<string, byte> channel in baseblock.Value) { devicesForCalibration.Add("ББ:" + baseblock.Key + " - CH" + channel.Value.ToString() + " Д:" + channel.Key.ToString()); } } channel_combobox.Items.Clear(); foreach (string record in devicesForCalibration) { channel_combobox.Items.Add(record); } channel_combobox.SelectedIndex = 0; dataGridView.Focus(); bw = new BackgroundWorker(); bw.DoWork += bw_DoWork; bw.ProgressChanged += bw_ProgressChanged; bw.RunWorkerCompleted += bw_RunWorkerCompleted; bw.WorkerReportsProgress = true; } else { MessageBox.Show("Не удалось соединиться с базой данных"); this.Close(); } }
public TestCalibration(bool _twoZond, Dictionary<string, Dictionary<string, byte>> devices) { InitializeComponent(); db = new ADatabase("calibration"); if (db.Connect()) { if (!ADatabase.CalibrationDatabaseStructureIsOK(db.Connection)) { db.CreateCalibrationDBStructure(); } twoZond = _twoZond; List<string> devicesForCalibration = new List<string>(); foreach (KeyValuePair<string, Dictionary<string, byte>> baseblock in devices) { foreach (KeyValuePair<string, byte> channel in baseblock.Value) { devicesForCalibration.Add("ББ:" + baseblock.Key + " - CH" + channel.Value.ToString() + " Д:" + channel.Key.ToString()); } } channel_combobox.Items.Clear(); foreach (string record in devicesForCalibration) { channel_combobox.Items.Add(record); } channel_combobox.SelectedIndex = 0; dataGridView.Focus(); bw = new BackgroundWorker(); bw.DoWork += bw_DoWork; bw.ProgressChanged += bw_ProgressChanged; bw.RunWorkerCompleted += bw_RunWorkerCompleted; bw.WorkerReportsProgress = true; } else { MessageBox.Show("Не удалось соединиться с базой данных"); this.Close(); } //int MinID = dataGridView.Rows[0].Cells.Cast<DataGridViewTextBoxCell>() // .Min(r => Convert.ToInt32(r.Value)); //dataGridView.Rows[0].Cells.Cast<DataGridViewTextBoxCell>().Single(x => x.Value.ToString() == MinID.ToString()).Style.BackColor = Color.LightGreen; //int MaxID2 = dataGridView.Rows[1].Cells.Cast<DataGridViewTextBoxCell>() // .Min(r => Convert.ToInt32(r.Value)); //dataGridView.Rows[1].Cells.Cast<DataGridViewTextBoxCell>().Single(x => x.Value.ToString() == MaxID2.ToString()).Style.BackColor = Color.LightGreen; //int MaxID3 = dataGridView.Rows[2].Cells.Cast<DataGridViewTextBoxCell>() // .Min(r => Convert.ToInt32(r.Value)); //dataGridView.Rows[2].Cells.Cast<DataGridViewTextBoxCell>().Single(x => x.Value.ToString() == MaxID3.ToString()).Style.BackColor = Color.LightGreen; //int MaxID4 = dataGridView.Rows[3].Cells.Cast<DataGridViewTextBoxCell>() // .Min(r => Convert.ToInt32(r.Value)); //dataGridView.Rows[3].Cells.Cast<DataGridViewTextBoxCell>().Single(x => x.Value.ToString() == MaxID4.ToString()).Style.BackColor = Color.LightGreen; }