void ButtonOkClick(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; _items = new TagDigital[dataGridView1.RowCount - 1]; int idx = 0; IDriver[] drivers = DriverManager.Instance.Drivers.ToArray(); for (int i = 0; i < dataGridView1.RowCount - 1; i++) { _items[idx] = new TagDigital(); _items[idx].Name = dataGridView1.Rows[i].Cells[0].Value.ToString(); _items[idx].Description = dataGridView1.Rows[i].Cells[1].Value.ToString(); foreach (IDriver driver in drivers) { if (driver.ToString() == dataGridView1.Rows[i].Cells[2].Value.ToString()) { _items[idx].Driver = driver; } } _items[idx].Address = dataGridView1.Rows[i].Cells[3].Value.ToString(); _items[idx].Historical = Convert.ToBoolean(dataGridView1.Rows[i].Cells[4].Value.ToString()); idx++; } return; }
void ButtonOkClick(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; _items = new TagDigital[dataGridView1.RowCount -1]; int idx = 0; IDriver[] drivers = DriverManager.Instance.Drivers.ToArray(); for (int i = 0; i < dataGridView1.RowCount - 1; i++) { _items[idx] = new TagDigital(); _items[idx].Name = dataGridView1.Rows[i].Cells[0].Value.ToString(); _items[idx].Description = dataGridView1.Rows[i].Cells[1].Value.ToString(); foreach (IDriver driver in drivers) { if (driver.ToString() == dataGridView1.Rows[i].Cells[2].Value.ToString()) { _items[idx].Driver = driver; } } _items[idx].Address = dataGridView1.Rows[i].Cells[3].Value.ToString(); _items[idx].Historical = Convert.ToBoolean(dataGridView1.Rows[i].Cells[4].Value.ToString()); idx++; } return; }
public static ITag NewTag(string type) { switch (type) { case "Digital": TagDigital tagDigital = new TagDigital(); return(tagDigital); case "Analog": TagAnalog tagAnalog = new TagAnalog(); return(tagAnalog); case "Sql": TagSql tagSql = new TagSql(); return(tagSql); default: return(null); } }
public static ITag NewTag(string type) { switch (type) { case "Digital": TagDigital tagDigital = new TagDigital(); return tagDigital; case "Analog": TagAnalog tagAnalog = new TagAnalog(); return tagAnalog; case "Sql": TagSql tagSql = new TagSql(); return tagSql; default: return null; } }