WPF mutex for single app instance not working

前端 未结 7 1643
梦谈多话
梦谈多话 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:10

    I did this from this link just add the given class and a single line in you App.Xaml.cs http://wpfsingleinstance.codeplex.com/

    public partial class App : Application    
    {
      protected override void OnStartup(StartupEventArgs e) 
      {
            WpfSingleInstance.Make(); //added this is the function of that class 
            base.OnStartup(e);
      }
    }
    

提交回复
热议问题