Application closing event in C#

2020-05-06 14:26发布

I'm writing a music player using NAudio. Before I close the player, I would like to call some methods that stop the playback. How do I do this?

标签: c# .net events
2条回答
Evening l夕情丶
2楼-- · 2020-05-06 14:46

I think that Form.closed event would be good as well.

edit: only if you have one form

查看更多
Explosion°爆炸
3楼-- · 2020-05-06 14:54

WinForms

Subscribe to the Application.ApplicationExit event and in the event handler do your shutdown code.

WPF

Subscribe to the Application.Exit event and in the event handler do your shutdown code.

查看更多
登录 后发表回答