void model_EventNewDevice() { System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => { DeviceItems.Clear(); model.GetDevices().ForEach(i => DeviceItems.Add(i)); LogMsgItems.Add("New device founded"); })); }
/// <summary> /// 添加设备 /// </summary> private void AddDevice() { DeviceInfoDlg dlg = new DeviceInfoDlg(); DeviceVM dv = new DeviceVM() { DeviceList = this.DeviceList, Left = mousePosition.X, Top = mousePosition.Y }; dlg.DataContext = dv; if ((bool)dlg.ShowDialog()) { DeviceItems.Add(dv); } }
private void GetItemsByThread(string objectId, IPortableDeviceContent content, int fNumber) { DateTime startTime = DateTime.Now; //Console.WriteLine("Task begin:" + fNumber + "ObjectID:" + objectId); Item i = new Item(objectId, content); if (i.ContentType.Type == WindowsPortableDeviceEnumerators.ContentType.FunctionalObject || i.ContentType.Type == WindowsPortableDeviceEnumerators.ContentType.Folder || i.ContentType.Type == WindowsPortableDeviceEnumerators.ContentType.Audio || i.ContentType.Type == WindowsPortableDeviceEnumerators.ContentType.Video || i.ContentType.Type == WindowsPortableDeviceEnumerators.ContentType.Image) { DeviceItems.Add(i); } RemoveCurrentTask(); UtilityHelper.LoadedItemCount++; Console.WriteLine("Folder:" + fNumber + " " + i.Name.Value + " -- " + (DateTime.Now - startTime).TotalMilliseconds + " -- Task Count: " + UtilityHelper.threadList.Count); }