private async void Start_scaning(ScanEngine scn_engine, Scaning scn_window) { await Task.Run(() => { scn_engine.Start_scaning(sgnt); if (flag) { return; } }); scn_window.timer1.Enabled = false; scn_window.progressBar1.Value = 100; }
private void StartScaningButton_Click(object sender, EventArgs e) { try { ScanEngine scn_engine = new ScanEngine(textBox1.Text); Close(); Scaning scn_window = new Scaning(scn_engine); scn_window.Show(); Start_scaning(scn_engine, scn_window); } catch (Exception ex) { MessageBox.Show(ex.Message); } }