How to use Application.Exit Event in WPF?

后端 未结 5 752
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 14:29

I need to delete some certain files, then user closes program in WPF. So I tried MDSN code from here http://msdn.microsoft.com/en-us/library/system.windows.application.exit.

5条回答
  •  抹茶落季
    2020-12-05 15:06

    If you don't like adding Exit event to XAML, you could try this alternative.

    Add following method to your App.xaml.cs:

    protected override void OnExit(ExitEventArgs e)
    {
        base.OnExit(e);
        // Your code here
    }
    

提交回复
热议问题