public ViewModel() { this.SupportInfoData = new ObservableCollection <SupportInfoElement>(); this.ViewSource1 = new CollectionViewSource(); ViewSource1.Source = this.SupportInfoData; ViewSource1.Filter += (sender, e) => { SupportInfoElement sie = e.Item as SupportInfoElement; e.Accepted = sie.Column.Equals(1); }; ViewSource1.SortDescriptions.Add(new SortDescription("Number", ListSortDirection.Ascending)); this.ViewSource2 = new CollectionViewSource(); ViewSource2.Source = this.SupportInfoData; ViewSource2.Filter += (sender, e) => { SupportInfoElement sie = e.Item as SupportInfoElement; e.Accepted = sie.Column.Equals(2); }; ViewSource2.SortDescriptions.Add(new SortDescription("Number", ListSortDirection.Ascending)); }
private void AddGridItem(SupportInfoElement Item) { //Item.Number = ItemNumber++; Application.Current.Dispatcher.Invoke ( System.Windows.Threading.DispatcherPriority.Background, new Action(() => { vm.AddItem(Item); vm.ViewSource1.View.Refresh(); vm.ViewSource2.View.Refresh(); RepositionWindows(); } ) ); }
public void AddItem(SupportInfoElement Item) { SupportInfoData.Add(Item); RaisePropertyChanged("SupportInfoData"); }
private void Background_worker_DoWork(object sender, DoWorkEventArgs e) { int no = 1; List <Taskhelper> th = new List <Taskhelper>(); th.Add(new Taskhelper() { support_info_type = SupportInfotype.UserName, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.IsAdmin, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.ComputerName, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.OperatingSystem, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.WindowsVersionInfo, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.ComputerManufacturer, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.ComputerModel, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Firmware, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.SerialBaseboard, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.SerialBios, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.CPU, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Memory, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Network, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Ping, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Bitlocker, number = no++, col = 1 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.GraphicsCard, number = no++, col = 2 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Display, number = no++, col = 2 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.PhysicalDrives, number = no++, col = 2 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.LogicalDrives, number = no++, col = 2 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.Webcam, number = no++, col = 2 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.AudioOutDevices, number = no++, col = 2 }); th.Add(new Taskhelper() { support_info_type = SupportInfotype.AudioInDevices, number = no++, col = 2 }); Parallel.ForEach(th, one => { SupportInfoElement r = LoadData(one.support_info_type, one.number, one.col); AddGridItem(r); }); }