Browse Source

修复客户端只启动一次的验证

yuzhengyang 8 years ago
parent
commit
4046bbfd29

BIN
Fork.Net/.vs/Fork.Net/v15/sqlite3/storage.ide


+ 10 - 5
Fork.Net/Fork.Net.Tools/Y.Utils/AppUtils/AppUnique.cs

@@ -1,22 +1,27 @@
-//############################################################
+//************************************************************************
 //      https://github.com/yuzhengyang
-//      author:yuzhengyang
-//############################################################
+//      author:     yuzhengyang
+//      date:       2017.10.12 - 2017.10.12
+//      desc:       App唯一启动工具
+//      Copyright (c) yuzhengyang. All rights reserved.
+//************************************************************************
 using System.Threading;
 
 namespace Y.Utils.AppUtils
 {
     public sealed class AppUnique
     {
+        private Mutex Mutex { get; set; }
+
         /// <summary>
         /// 判断应用在当前系统实例下是否唯一
         /// </summary>
         /// <param name="appName"></param>
         /// <returns></returns>
-        public static bool IsUnique(string appName)
+        public bool IsUnique(string appName)
         {
             bool unique;
-            Mutex run = new Mutex(true, appName, out unique);
+            Mutex = new Mutex(true, appName, out unique);
             return unique;
         }
     }