When you show a MessageBox
or another type of Dialog like a OpenFileDialog
or even a window you made and called with ShowDialog()
what is happening inside that method to keep the app from continuing while it waits for DialogResult
to be set?
public static bool MyDialog.Show(string message) {
//what happens here to keep the program from continuing?
//Oh! DialogResult was finally set...
return DialogResult;
}
private void OkButton_Click(object sender, RoutedEventArgs e) {
DialogResult = true
}
Its not like you can just put a while(true) loop and wait for the user to hit ok, so whats actually happening in the background?