var response = MessageBox.Show("Do you really want to exit?", "Exiting...",
MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (response == MessageBoxResult.No)
{
e.Cancel = true;
}
else
{
Environment.Exit(0);
}
// This one for WPF
if (MessageBox.Show("Close Application?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
{
//do no stuff
}
else
{
//do yes stuff
}