private void btnUnsave_Click(object sender, EventArgs e) { btnCopyPosts.Enabled = false; btnLoadSaved.Enabled = false; btnUnsave.Enabled = false; //btnExport.Enabled = false; FilterPosts(chkMatchRows.Checked); DialogResult result = MessageBox.Show("This will UNSAVE " + toSave.Count + " posts! Are you sure you want to do this?", "Sure about that?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { FilterPosts(chkMatchRows.Checked); var savePostThread = new SavePostThread(redditCookie1, toSave, false); savePostThread.Thread.ProgressChanged += UnSavePosts_ProgressChanged; savePostThread.Thread.RunWorkerCompleted += UnSavePosts_Completed; savePostThread.Start(); } else if (result == DialogResult.No) { btnCopyPosts.Enabled = true; btnLoadSaved.Enabled = true; btnUnsave.Enabled = true; Console.WriteLine("Unsave Canceled."); } }
void SavePosts_Completed(object sender, RunWorkerCompletedEventArgs e) { statusLabel.Text = "DONE SAVING"; //If we need to unsave the posts in the LEFT account if (chkUnsaveAfter.Checked) { var savePostThread = new SavePostThread(redditCookie1, toSave, false); savePostThread.Thread.ProgressChanged += UnSavePosts_ProgressChanged; savePostThread.Thread.RunWorkerCompleted += UnSavePosts_Completed; savePostThread.Start(); } else { Console.WriteLine("DONE"); MessageBox.Show("Finished saving " + toSave.Count + " posts."); btnCopyPosts.Enabled = true; btnLoadSaved.Enabled = true; btnUnsave.Enabled = true; toolStripProgressBar1.Value = 100; } }
void SavePosts() { //Filter the list of posts to be saved FilterPosts(chkMatchRows.Checked); //Start the save thread var davePostThread = new SavePostThread(redditCookie2, toSave, true); davePostThread.Thread.ProgressChanged += SavePosts_ProgressChanged; davePostThread.Thread.RunWorkerCompleted += SavePosts_Completed; davePostThread.Start(); }