private void worker_DoWork(object sender, DoWorkEventArgs e) { if (!checkIfNotFirstStart()) { return; } OpenFileDialog fileDialog = GetFileDialog(); if (fileDialog.ShowDialog() == true) { try { ConsoleMessage message = new ConsoleMessage(); message.MessageNotification += MessageTriger; string saveFilePath = Path.GetDirectoryName(fileDialog.FileName); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); ConsoleTextProperty = new ConsoleText { TheText = "In progress..." + Environment.NewLine, TheColor = Brushes.Black }; List <List <string> > filePath = GetAllPathes(ExpLinksList, PDList, IDList, ChtDuplicatesList); FileReader fileReader = new FileReader(filePath, IsSelectedPDCheck, message); changeProgress(10); Mistakes mistakesCheck = new Mistakes(fileReader, filePath, IsSelectedPDCheck); if (CheckForCriticalErrors(mistakesCheck)) { return; } Processing processing = new Processing(fileReader, UserName, FitmentUpdateCheck, message); Writer writer = new Writer(processing, changeProgress, saveFilePath, message, fileReader); writer.Write(); CheckAllErrors(mistakesCheck); changeProgress(100); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds); ConsoleText workingTime = ConsoleTextProperty; workingTime.TheText += Environment.NewLine + "Время работы программы: " + elapsedTime; ConsoleTextProperty = workingTime; StartButton = "Clear"; } catch (Exception ex) { ConsoleTextProperty = new ConsoleText { TheText = "Произошла ошибка: " + ex, TheColor = Brushes.Red }; } } SetUserName(config); }
public Processing(FileReader reader, string userName, bool fitmentUpdateCheck, ConsoleMessage message) { fileReader = reader; this.userName = userName; this.fitmentUpdateCheck = fitmentUpdateCheck; this.message = message; }
public Writer(Processing process, Action <int> ChangeProgress, string saveFilePath, ConsoleMessage message, FileReader fileReader) { processing = process; this.changeProgress = ChangeProgress; this.saveFilePath = saveFilePath; this.message = message; this.fileReader = fileReader; }
public FileReader(List <List <string> > pathes, bool skuFromPDCheck, ConsoleMessage message) { this.pathes = pathes; this.skuFromPDCheck = skuFromPDCheck; this.message = message; }