private void button1_Click(object sender, EventArgs e) { string location = Data.GetGroupLastLocation(listBox1.SelectedValue.ToString()); if (location != null && Directory.Exists(location)) { folderBrowserDialog1.SelectedPath = location; } if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { btn_export.Enabled = false; currentlyProcessing.Add(listBox1.SelectedValue.ToString()); ArchivingOp archive = new ArchivingOp(c => { Archiver.GetAllPosts(c, folderBrowserDialog1.SelectedPath, cbx_newpostsonly.Checked?Data.GetGroupLastUpdate(c):null); }); archive.BeginInvoke(listBox1.SelectedValue.ToString(), new AsyncCallback(c => { MessageBox.Show("Done Archiving " + ((group)c.AsyncState).name); currentlyProcessing.Remove(((group)c.AsyncState).id); if ((string)this.Invoke(new Func <string>(() => { return(listBox1.SelectedValue.ToString()); })) == ((group)c.AsyncState).id) { this.Invoke(new Action(() => { btn_export.Enabled = true; })); } }) , listBox1.SelectedItem); } }
private void button1_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ArchivingOp archive = new ArchivingOp(c => Archiver.GetAllPosts(c,folderBrowserDialog1.SelectedPath)); archive.BeginInvoke(listBox1.SelectedValue.ToString(), new AsyncCallback(c => MessageBox.Show("Done Archiving " + ((group)c.AsyncState).name)), listBox1.SelectedItem); } }
private void button1_Click(object sender, EventArgs e) { string location = Data.GetGroupLastLocation(listBox1.SelectedValue.ToString()); if (location!=null&&Directory.Exists(location)) { folderBrowserDialog1.SelectedPath = location; } if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { btn_export.Enabled = false; currentlyProcessing.Add(listBox1.SelectedValue.ToString()); ArchivingOp archive = new ArchivingOp(c => { Archiver.GetAllPosts(c, folderBrowserDialog1.SelectedPath,cbx_newpostsonly.Checked?Data.GetGroupLastUpdate(c):null); }); archive.BeginInvoke(listBox1.SelectedValue.ToString(), new AsyncCallback(c => { MessageBox.Show("Done Archiving " + ((group)c.AsyncState).name); currentlyProcessing.Remove(((group)c.AsyncState).id); if ((string)this.Invoke(new Func<string>(() => { return listBox1.SelectedValue.ToString(); })) == ((group)c.AsyncState).id) { this.Invoke(new Action(() => { btn_export.Enabled = true; })); } }) , listBox1.SelectedItem); } }