LoginSignup
2
2

More than 5 years have passed since last update.

Xamlで終了後に残りものを出さない

Last updated at Posted at 2018-03-06

C# WPFでメインウィンドウから別スレッドで通信処理を行っている。
メインウィンドウを閉じてアプリケーション終了後に、別スレッドがメモリに残ってしまうことがある。
そんな場合は、プロジェクトのApp.xamlにShutdownMode="OnMainWindowClose"と指定する。

app.xaml
<Application x:Class="GateClient.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml"
             ShutdownMode="OnMainWindowClose"
             Startup="Application_Startup"
             Exit="Application_Exit">
</Application>
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2