using System;
using System.Windows;
using System.Windows.Input;
class MainClass : Application
{
[STAThread]
public static void Main()
{
MainClass app = new MainClass();
app.Run();
}
protected override void OnStartup(StartupEventArgs args)
{
base.OnStartup(args);
Window win = new Window();
win.Title = "title";
win.Show();
}
protected override void OnSessionEnding(SessionEndingCancelEventArgs args)
{
base.OnSessionEnding(args);
MessageBoxResult result = MessageBox.Show("save?",
MainWindow.Title, MessageBoxButton.YesNoCancel,
MessageBoxImage.Question, MessageBoxResult.Yes);
args.Cancel = (result == MessageBoxResult.Cancel);
}
}
|