public void AddSingleTag(Device_Mode model, DataGridViewRow dgvr)
 {
     if (this.dgv_Devices.InvokeRequired)
     {
         this.dgv_Devices.BeginInvoke(new AddDevice(AddSingleTag), model, dgvr);
     }
     else
     {
         this.dgv_Devices.Rows.Add(dgvr);
     }
 }
        public void DeviceInfo(Device_Mode model)
        {
            string sRowKey = model.MAC + "|" + model.IP;

            if (!dic_Rows.ContainsKey(sRowKey))
            {
                DataGridViewRow dgvr = new DataGridViewRow();
                dgvr.CreateCells(dgv_Devices, model.MAC, model.IP, model.ServerPort, model.RemoteIP, model.RemotePort, model.WorkingMode, model.ConnectMode, model.DeviceType);
                foreach (String item in dic_Rows.Keys)
                {
                    if (item.IndexOf(model.MAC) >= 0 || item.IndexOf(model.IP) >= 0)
                    {
                        dgvr.DefaultCellStyle.BackColor = Color.Red;
                    }
                }
                dic_Rows.Add(sRowKey, dgvr);
                AddSingleTag(model, dgvr);
            }
        }