private void goButton_Click(object sender, EventArgs e) { BandcampImportWorker bandcampImportWorker = new BandcampImportWorker(new DirectoryInfo(this.inputFolderBrowserDialog.SelectedPath)); bandcampImportWorker.Shelf = shelfSelector1.SelectedShelf; bandcampImportWorker.TargetFolder = new DirectoryInfo(this.outputFolderBrowserDialog.SelectedPath); bandcampImportWorker.IsDiscography = discographyCheckbox.Checked; bandcampImportWorker.DiscographyName = discographyNameTextBox.Text; bandcampImportWorker.Context = AzusaContext.GetInstance(); WorkerForm workerForm = new WorkerForm(bandcampImportWorker); workerForm.ShowDialog(this); this.Close(); }
private void BgCalcs(object sender) { var calc = CreateCalculation(sender); var worker = new BackgroundWorker(); worker.DoWork += (ss, ee) => calc.Perform(worker, ee); var pdForm = new WorkerForm(worker); pdForm.ShowDialog(); if (pdForm.Result is TablesDump res) { ShowCalculationResult(res); } pdForm.Dispose(); }
private void SendToExcel() { var excelExporter = new ExcelExporter(dataTableConnection); var worker = new BackgroundWorker(); worker.DoWork += (ss, ee) => excelExporter.Export(worker, ee); var workerForm = new WorkerForm(worker) { LoadingTitle = "Відбувається експорт..." }; workerForm.ShowDialog(); var result = workerForm.Result; workerForm.Dispose(); if (result is Exception exc) { throw exc; } }