Exemple #1
0
 private void 启用ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (DGVUSBList.CurrentRow != null)
     {
         string id = DGVUSBList.CurrentRow.Cells["DGVUSBList_InstanceID"].Value.ToString();
         R.Toast.Show("启用 USB", DGVUSBList.CurrentRow.Index + " : " + id);
         if (USBTool.Enable(id))
         {
             DGVUSBList_Refresh();
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 启用设备列表
        /// </summary>
        /// <param name="host"></param>
        /// <param name="model"></param>
        public static void Enable(string host, TcpDataModel model)
        {
            List <USBDeviceModel> list = Json.Byte2Object <List <USBDeviceModel> >(model.Data);

            if (Ls.Ok(list))
            {
                foreach (var item in list)
                {
                    if (USBTool.Enable(item.ID))
                    {
                        item.Running = true;
                    }
                }
            }
            R.Tx.TcppServer.Write(host, 20003000, Json.Object2Byte(list));
        }