I'm processing large files after they are selected by the user. My code looks like the following:
if (FileDialog.ShowDialog() == true) {
// process really big file
}
This freezes up the UI so I tried to display a loading message first before a user selected the file to give them a visual cue that something was happening:
loadingMessage.Visibility = Visibility.Visible;
if (FileDialog.ShowDialog() == true) {
// process really big file
}
Unfortunately, this still completely freezes up the UI while the file is being processed.
What I have found that works perfectly is if I fire a MessageBox right after the file selection. I think it does a "DoEvents" type call under the hood to get flush event/ui items in the runtime.
loadingMessage.Visibility = Visibility.Visible;
if (FileDialog.ShowDialog() == true) {
MessageBox.Show("Sync!");
// process really big file
}
In cases like this the big file is still processed as slowly but the loading message is displayed and the screen UI gets synched up (I'm doing some other things in the real thing such as showing a wait cursor).
Question:
Silverlight has no DoEvents functionality. Is there a call I can make besides MessageBox.Show to have the same effect of synchronizing the UI and preventing the OpenFileDialog from freezing up the UI?