public DataContextTaxJournal() { DatePicker = new DatePickerAdd(); var command = new LibraryCommandPublic.TestAutoit.Okp2.TaxJournal(); DownloadPrintDb = new DownloadPrintDb(); StartButton = new StatusButtonMethod(); StartButton.Button.Command = new DelegateCommand(() => { command.StartTaxJournal(StartButton, ConfigFile.PathTemp, DatePicker); }); PrintFile = new DelegateCommand(() => { command.PrintFiles(DownloadPrintDb); }); }
/// <summary> /// Печать файлов /// </summary> /// <param name="downloadPrintDb">Модель документов</param> public async void PrintFiles(DownloadPrintDb downloadPrintDb) { DispatcherHelper.Initialize(); if (downloadPrintDb.IsValidationWork()) { await Task.Run(delegate { var db = new AddObjectDb(); DispatcherHelper.CheckBeginInvokeOnUI(delegate { downloadPrintDb.ProgressMaxPrint(downloadPrintDb.FileCollection.Count); }); foreach (var file in downloadPrintDb.FileCollection) { downloadPrintDb.Print(file.Path, file.Name); db.UpdatePrintDoc(file.IdDoc); DispatcherHelper.CheckBeginInvokeOnUI(delegate { downloadPrintDb.ProgressPrintFile(file.Name); }); File.Delete(file.Path); } DispatcherHelper.CheckBeginInvokeOnUI(downloadPrintDb.ProgressPrintFileDefault); downloadPrintDb.FileCollection.Clear(); DispatcherHelper.CheckBeginInvokeOnUI(delegate { downloadPrintDb.CountFile(downloadPrintDb.FileCollection.Count); }); }); } }