|
|
@@ -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;
|
|
|
}
|
|
|
}
|