public static void MultiFileImport(string path) { DirectoryInfo root = new DirectoryInfo(path); FileInfo[] files = root.GetFiles(); foreach (var file in files) { try { QueueFileReader fileReader = new QueueFileReader(file.FullName); ShareDataEntity shareData = ShareDataEntity.GetSingleton(); shareData.AddNewModelToMailQueueCollection(fileReader.QueueModelList.Select(s => s.QueueModel).ToList()); fileReader.QueueModelList.ForEach(f => shareData.AddNewModelToMailQueueReserverCollection(f.ReserverEntities)); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
private void ImportTask() { try { Runner.QueueFileReader fileReader = new Runner.QueueFileReader(ViewModel.TextBox_File_Text); ShareDataEntity shareData = ShareDataEntity.GetSingleton(); shareData.AddNewModelToMailQueueCollection(fileReader.QueueModelList.Select(s => s.QueueModel).ToList()); fileReader.QueueModelList.ForEach(f => shareData.AddNewModelToMailQueueReserverCollection(f.ReserverEntities)); ViewModel.DG1_ItemSource = fileReader.QueueModelList; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Dispatcher.Invoke(new Action(() => ShareDataEntity.GetSingleton().GetMailQueueViewCollection())); ViewModel.ProgressRing_IsActive = false; } }