private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { bool flag = e.ColumnIndex == this.dataGridView1.Rows[0].Cells["Run"].ColumnIndex; if (flag) { string ipAddress = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string seri = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); string country = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); string stt = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); DBConnection db = new DBConnection(); if (!Directory.Exists("DB")) { Directory.CreateDirectory("DB"); } db.ConnectDB("DB", "ToolManager"); db.RunCommand("Update Manager set stt= '" + stt + "', country= '" + country + "' where tile='" + seri + "'"); if (dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString() == "ON") { dataGridView1.Rows[e.RowIndex].Cells[3].Value = "OFF"; int port = 5000 + e.RowIndex; DeviceConnect dv = new DeviceConnect(); dv.SetProxy(ipAddress, ipAddress, port, false); } else { dataGridView1.Rows[e.RowIndex].Cells[3].Value = "ON"; int port = 5000 + e.RowIndex; Client911.RunClient(ipAddress, country, port); } } }
private void Form1_Load(object sender, EventArgs e) { Console.WriteLine(Client911.getIPAddrees()); button2.Enabled = false; LoadDataHome(); }