private void OpenToyConstructorForm() { try { _toysListForm = new ToysListForm(_context); _toysListForm.ShowDialog(); } catch (CantConnectToDbException ex) { MessageBox.Show(ex.Message); } }
private void ToyConstructorStart() { //if (backgroundWorker1.IsBusy != true) //{ // _loadForm = new SimpleLoadingForm(); // _loadForm.Show(); // this.Hide(); // backgroundWorker1.RunWorkerAsync(); //} Hide(); _toysListForm = new ToysListForm(_context); _toysListForm.ShowDialog(); Show(); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; if (worker.CancellationPending == true) { e.Cancel = true; return; } else { try { _toysListForm = new ToysListForm(_context); worker.ReportProgress(100); _toysListForm.ShowDialog(); } catch (CantConnectToDbException ex) { MessageBox.Show(ex.Message); } } }