private async Task GetAllClassifierDataCommandHandler() { try { var dataTypeClassifier1 = await _classifiersType1Repository.GetTypeClassifiers(); var dataTypeClassifier2 = await _classifiersType2Repository.GetTypeClassifiers(); var dataTypeClassifier3 = await _classifiersType3Repository.GetTypeClassifiers(); var dataTypeClassifier4 = await _classifiersType4Repository.GetTypeClassifiers(); ClassifierType1DataList.Clear(); ClassifierType2DataList.Clear(); ClassifierType3DataList.Clear(); ClassifierType4DataList.Clear(); await Task.Run(() => { foreach (var item in dataTypeClassifier1) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { ClassifierType1DataList.Add(new ClassifierType1ViewModel(item.Type1_ClassifierId, item.Type1_ClassifierName)); })); } foreach (var item in dataTypeClassifier2) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { ClassifierType2DataList.Add(new ClassifierType2ViewModel(item.Type2_ClassifierId, item.Type2_ClassifierName)); })); } foreach (var item in dataTypeClassifier3) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { ClassifierType3DataList.Add(new ClassifierType3ViewModel(item.Type3_ClassifierId, item.Type3_ClassifierName)); })); } foreach (var item in dataTypeClassifier4) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { ClassifierType4DataList.Add(new ClassifierType4ViewModel(item.Type4_ClassifierId, item.Type4_ClassifierName)); })); } }); } catch (Exception e) { Console.WriteLine(e); throw; } }
private void ResetClassifiersCommandHandler() { var type1 = ClassifierType1DataList.FirstOrDefault(x => x.IsEnabled == true); var type2 = ClassifierType2DataList.FirstOrDefault(x => x.IsEnabled == true); var type3 = ClassifierType3DataList.FirstOrDefault(x => x.IsEnabled == true); var type4 = ClassifierType4DataList.FirstOrDefault(x => x.IsEnabled == true); if (type1 != null) { type1.IsEnabled = false; } if (type2 != null) { type2.IsEnabled = false; } if (type3 != null) { type3.IsEnabled = false; } if (type4 != null) { type4.IsEnabled = false; } }