58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Reflection;
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace SOH.JianYan.DEC_RT6100
|
|||
|
|
{
|
|||
|
|
#region class SingleInstance
|
|||
|
|
|
|||
|
|
static class SingleInstance
|
|||
|
|
{
|
|||
|
|
private static Mutex mutex = null;
|
|||
|
|
|
|||
|
|
public static bool CreateMutex()
|
|||
|
|
{
|
|||
|
|
return CreateMutex(Assembly.GetEntryAssembly().FullName);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static bool CreateMutex(string name)
|
|||
|
|
{
|
|||
|
|
bool result = false;
|
|||
|
|
mutex = new Mutex(true, name, out result);
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static void ReleaseMutex()
|
|||
|
|
{
|
|||
|
|
if (mutex != null)
|
|||
|
|
{
|
|||
|
|
mutex.Close();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
static class Program
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 应用程序的主入口点。
|
|||
|
|
/// </summary>
|
|||
|
|
[STAThread]
|
|||
|
|
static void Main()
|
|||
|
|
{
|
|||
|
|
string key = Application.StartupPath + "\\SOH.OnLine.exe";
|
|||
|
|
key = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(key, "MD5");
|
|||
|
|
if (!SingleInstance.CreateMutex())
|
|||
|
|
return;
|
|||
|
|
Application.EnableVisualStyles();
|
|||
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|||
|
|
var v = new RT6100();
|
|||
|
|
v.WindowState = FormWindowState.Normal;
|
|||
|
|
Application.Run(v);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|