コード例 #1
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);
        }
コード例 #2
0
 public Processing(FileReader reader, string userName, bool fitmentUpdateCheck, ConsoleMessage message)
 {
     fileReader              = reader;
     this.userName           = userName;
     this.fitmentUpdateCheck = fitmentUpdateCheck;
     this.message            = message;
 }
コード例 #3
0
ファイル: Writer.cs プロジェクト: Alex-Za/Finish-Maker_Demo
 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;
 }
コード例 #4
0
 public FileReader(List <List <string> > pathes, bool skuFromPDCheck, ConsoleMessage message)
 {
     this.pathes         = pathes;
     this.skuFromPDCheck = skuFromPDCheck;
     this.message        = message;
 }