private void LoadingFolder(object parameter) { using (var openDialog = new FolderBrowserDialog()) { if (openDialog.ShowDialog() == DialogResult.OK) { string directoryPath = openDialog.SelectedPath; foreach (var path in Directory.GetFiles(directoryPath)) { var extension = Path.GetExtension(path); if (extension == ".xls" || extension == ".xlsx") { string pathFile = path; pathFile = Reports.Helpers.ConvertXlsToXlsx(path); var invoices = ProcessingInvoice.Procesing(BC, pathFile, PercentageRus, PercentageImport); ProcessingInvoice.ComplitedCompliteInvoice(pathFile, PercentageRus, PercentageImport, invoices); } } if (_prevPercentageRus != PercentageRus) { BC.EditParameter(ParameterType.PercentageRusBookKeeping, PercentageRus.ToString()); _prevPercentageRus = PercentageRus; } if (_prevPercentageImport != PercentageImport) { BC.EditParameter(ParameterType.PercentageImportBookKeeping, PercentageImport.ToString()); _prevPercentageImport = PercentageImport; } } } }
private void LoadingFile(object parameter) { using (var openDialog = new OpenFileDialog()) { if (openDialog.ShowDialog() == DialogResult.OK) { string path = openDialog.FileName; path = Reports.Helpers.ConvertXlsToXlsx(path); Task.Factory.StartNew(() => { var invoices = ProcessingInvoice.Procesing(BC, path, PercentageRus, PercentageImport); ProcessingInvoice.ComplitedCompliteInvoice(path, PercentageRus, PercentageImport, invoices); if (_prevPercentageRus != PercentageRus) { BC.EditParameter(ParameterType.PercentageRusBookKeeping, PercentageRus.ToString()); _prevPercentageRus = PercentageRus; } if (_prevPercentageImport != PercentageImport) { BC.EditParameter(ParameterType.PercentageImportBookKeeping, PercentageImport.ToString()); _prevPercentageImport = PercentageImport; } }); } } }