What is the correct way to create a single-instance WPF application?

前端 未结 30 3182
耶瑟儿~
耶瑟儿~ 2020-11-21 05:14

Using C# and WPF under .NET (rather than Windows Forms or console), what is the correct way to create an application that can only be run as a single instance?

I kno

30条回答
  •  不知归路
    2020-11-21 05:44

    It looks like there is a really good way to handle this:

    WPF Single Instance Application

    This provides a class you can add that manages all the mutex and messaging cruff to simplify the your implementation to the point where it's simply trivial.

提交回复
热议问题