WPF mutex for single app instance not working

前端 未结 7 1744
梦谈多话
梦谈多话 2020-12-30 01:24

I\'m trying to use the mutex method for only allowing one instance of my app to run. That is - I only want a max of one instance for all users on a machine. I\'ve read throu

7条回答
  •  离开以前
    2020-12-30 02:20

    You're also disposing the mutex in the same method, so the mutex only lives for the duration of the method. Store the mutex in a static field, and keep it alive for the duration of your application.

提交回复
热议问题