示例#1
0
        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);
                }
            }
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtipaddress.Text != "" && txtipaddress.Text.IndexOf(".") > 0 && txtipaddress.Text.Split('.').Length - 1 > 1)
     {
         DeviceConnect deviceConnect = new DeviceConnect();
         lblSerinumber.Text = deviceConnect.getSeri(txtipaddress.Text);
         button2.Enabled    = true;
     }
     else
     {
         MessageBox.Show("IP Nhap sai");
     }
 }
示例#3
0
        public static void RunClient(string ipadress, string country, int port)
        {
            int icheck = 0;

            Process[] processlist = Process.GetProcesses();
            foreach (Process process in processlist)
            {
                string tile = process.MainWindowTitle;

                if (!String.IsNullOrEmpty(tile))
                {
                    if (tile.ToLower().Contains("911 S5 3.26"))
                    {
                        icheck = 1;
                    }
                }
            }

            Task t = new Task(() =>
            {
                if (icheck == 0)
                {
                    CmdProcess("./ChangeProxy/", "Client.exe");
                    Thread.Sleep(7000);
                    AutoItX.WinActivate("911 S5 3.26", "");
                    AutoItX.ControlClick("911 S5 3.26", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:4]");
                    Thread.Sleep(7000);
                    AutoItX.WinClose("Annoucement");
                    Thread.Sleep(3000);
                    Change(country, port);
                    DeviceConnect dv = new DeviceConnect();
                    string ipPC      = getIPAddrees();
                    dv.SetProxy(ipadress, ipPC, port, true);
                }
                else
                {
                    Change(country, port);
                }
            });

            t.Start();
        }