private void Searcher_ThreadEnded(File_ThreadEndedEventArgs e) { if (!m_closing) { // Invoke the method "this_ThreadEnded" through a delegate, // so it is executed in the same thread as MainWindow: this.Invoke(ThreadEnded, new object[] { e }); } }
private void this_ThreadEnded(File_ThreadEndedEventArgs e) { // Enable all buttons except stop button: EnableButtons(); // Show an error message if necessary: if (!e.Success) { MessageBox.Show(e.ErrorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }