private void FilterPartWorks() { PartWorks.Clear(); if (SpecificationDataStorage.Instance.PartsWorkList.Count() < 1) { return; } new Thread(ThrSearchPartWorks).Start(); }
private void SelectPartsComplete(object sender) { List <PartWorkDataModel> temp = PartWorks.ToList().Where(p => p.Checked == true).ToList(); foreach (var item in PartsWithWorks) { item.HoursChanged -= model_HoursChanged; } PartsWithWorks.Clear(); foreach (var item in temp) { PartWorkWithHoursModel model = new PartWorkWithHoursModel(item.Model); model.HoursChanged += model_HoursChanged; PartsWithWorks.Add(model); } VisAddPartWorks = Visibility.Collapsed; }
private void ThrSearchPartWorks() { if (SelectedPartsWorkType != null) { List <WorksInfoDataModel> temp = SpecificationDataStorage.Instance.PartsWorkList.ToList().Where(p => p.id_Class == SelectedPartsWorkType.id).ToList(); Application.Current.Dispatcher.BeginInvoke(new Action(() => { temp.ForEach(a => PartWorks.Add(new PartWorkDataModel(a))); })); } else { Application.Current.Dispatcher.BeginInvoke(new Action(() => { SpecificationDataStorage.Instance.PartsWorkList.ToList().ForEach(a => PartWorks.Add(new PartWorkDataModel(a))); })); } }