private void btn_ReBuild_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to continue?\n - This will clear the current database!", "Are you Sure?", MessageBoxButtons.YesNo) == DialogResult.Yes) { Enable(false); UComplete = false; var appPath = Path.GetDirectoryName(Application.ExecutablePath); Directory.Delete(appPath + "\\SearchIndex", true); Directory.CreateDirectory(appPath + "\\SearchIndex"); Bgw = Newbgw(); Bgw.ProgressChanged += (o, args) => { lbl_Current.Visible = true; lbl_Current.Text = (String)args.UserState; }; Bgw.DoWork += DeleteAll; Bgw.RunWorkerCompleted += (o, args) => { UComplete = true; if (UClosePending) { MainForms.FRM_Main.Settings.Close(); } else { lbl_Current.Visible = false; Build(); } }; Bgw.RunWorkerAsync(); } }
private void Index() { Bgw = Newbgw(); Bgw.ProgressChanged += (o, args) => { lbl_Current.Text = (String)args.UserState; lbl_Current.Visible = true; }; Bgw.DoWork += UpdateIndex; Bgw.RunWorkerCompleted += (o, args) => { UComplete = true; if (UClosePending) { MainForms.FRM_Main.Settings.Close(); } else { lbl_Current.Text = "Build Complete."; lbl_Current.Visible = true; progressBar1.Enabled = false; Building = false; Enable(true); } }; Bgw.RunWorkerAsync(); }
private void Build() { if (Building) { MessageBox.Show("Build currently in progress!"); } UComplete = false; Building = true; Enable(false); Bgw = Newbgw(); progressBar1.Enabled = true; progressBar1.Value = 0; Bgw.ProgressChanged += (o, args) => { lbl_Current.Visible = true; lbl_Current.Text = (String)args.UserState; progressBar1.Enabled = true; progressBar1.Value = args.ProgressPercentage; }; Bgw.DoWork += Execute; Bgw.RunWorkerCompleted += (o, args) => { UComplete = true; if (UClosePending) { MainForms.FRM_Main.Settings.Close(); } else { progressBar1.Enabled = false; if (Properties.Settings.Default.filmDisplayResults) { if (UserVerification()) { Complete(); } else { lbl_Current.Text = "User Aborted!"; Enable(true); } } else { Complete(); } } }; Bgw.RunWorkerAsync(); }
private void Complete() { Bgw = Newbgw(); Bgw.ProgressChanged += (o, args) => { lbl_Current.Visible = true; lbl_Current.Text = (String)args.UserState; }; Bgw.DoWork += SaveFilms; Bgw.RunWorkerCompleted += (o, args) => { UComplete = true; if (UClosePending) { MainForms.FRM_Main.Settings.Close(); } else { lbl_Current.Visible = false; Index(); } }; Bgw.RunWorkerAsync(); }
private void BtnAceptar_Click(object sender, EventArgs e) { Bgw.RunWorkerAsync(); }