Exemple #1
0
 private void CheckAllErrors(Mistakes mistakesCheck)
 {
     if (ValidateFiles)
     {
         if (mistakesCheck.OtherErrors != null)
         {
             ConsoleTextProperty = new ConsoleText {
                 TheColor = Brushes.Red, TheText = mistakesCheck.OtherErrors + "Done"
             }
         }
         ;
         else
         {
             ConsoleTextProperty = new ConsoleText {
                 TheColor = Brushes.Black, TheText = "Done"
             }
         };
     }
     else
     {
         ConsoleTextProperty = new ConsoleText {
             TheColor = Brushes.Black, TheText = "Done"
         }
     };
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 private bool CheckForCriticalErrors(Mistakes mistakesCheck)
 {
     if (ValidateFiles)
     {
         if (mistakesCheck.CriticalErrors != null)
         {
             ClearProperties(mistakesCheck.CriticalErrors);
             return(true);
         }
     }
     return(false);
 }