I am using a OpenFileDialog to Open a File i want to process in my application, but the processing takes few seconds, and during that processing time the OpenFileDialog stays visible, and it's bothering!!! i want to hide my OpenFileDialog during the processing time ! Same problem goes to the SaveFileDialog
private void ofdImportation_FileOk(object sender, CancelEventArgs e)
{
Processing(); //Takes Few Seconds
//ofdImportation remains visible during that time...
//i want to hide it...
}
thank you everybody...
if (OpenFileDialog.ShowDialog() == DialogResult.Ok)
{
// Do stuff
}
The OK and Cancel events should be for UI specific behaviour irrespective of whatever the resulting file is for.
Separation of concerns
Clicking ok gives you a file, cancel gives you say a null, then you have a class with a process method that you pass the file name from the dialog to. It shouldn't care where the file name came from.
Think about the hurdles you'd have to leap to unit test Processing()