Проблема в том, что сообщение "уверены, что хотите закрыть?" всплывает, но когда я нажимаю «нет», программа все равно закрывается. Какие-либо предложения? Вот мой код:
protected override void OnFormClosing(FormClosingEventArgs e)
{
CloseCancel();
}
public static void CloseCancel()
{
const string message = "Are you sure that you would like to cancel the installer?";
const string caption = "Cancel Installer";
var result = MessageBox.Show(message, caption,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.Yes)
Environment.Exit(0);
}