/// <summary> /// 获取设备列表回调函数 /// </summary> /// <param name="state"></param> /// <param name="data"></param> private void GetDeviceList_Callback(bool state, byte[] data) { if (state) { this.Invoke(new Action(() => { ClassStatic.ListDriveData listDriveData = ClassStatic.GetListDriveData(data); if (listDriveData != null) { DeviceOnlineCount = 1; foreach (ClassStatic.ListDrive drive in listDriveData.list) { ControlDevice temp = new ControlDevice(); temp.DeviceId = drive.mac; temp.Title = drive.name; temp.Mac = drive.mac; temp.Portrait = Convert.ToInt32(drive.pid); temp.Status = drive.state; if (drive.token != "" && drive.token != null) { DeviceOnlineCount++; controlDeviceOnline.Add(drive.token, temp); flowLayoutPanelList.Controls.Add(temp); } else { controlDeviceOffline.Add(temp.Mac, temp); } } foreach (ControlDevice temp in controlDeviceOffline.Values) { flowLayoutPanelList.Controls.Add(temp); } labelListNum.Text = "我的设备(" + DeviceOnlineCount + "/" + (listDriveData.list.Count + 1) + ")"; } })); } }