using System;
|
using System.Diagnostics;
|
using System.IO;
|
using System.Windows.Forms;
|
using Gs.DevApp.DevFrm;
|
|
namespace Gs.DevApp
|
{
|
internal static class Program
|
{
|
/// <summary>
|
/// The main entry point for the application.
|
/// </summary>
|
[STAThread]
|
private static void Main()
|
{
|
var processName =
|
Path.GetFileNameWithoutExtension(Process.GetCurrentProcess()
|
.MainModule.FileName);
|
var processes = Process.GetProcessesByName(processName);
|
if (processes.Length > 1)
|
{
|
MessageBox.Show("程序已经在运行!");
|
Environment.Exit(0);
|
}
|
else
|
{
|
Application.EnableVisualStyles();
|
Application.SetCompatibleTextRenderingDefault(false);
|
_startLogin();
|
}
|
}
|
|
/// <summary>
|
/// 登录页启动
|
/// </summary>
|
private static void _startLogin()
|
{
|
//Application.Run(new TestForm.XtraForm3());
|
//return;
|
|
var fmLogin = new FrmLogin();
|
if (fmLogin.IsDisposed == false)
|
{
|
fmLogin.ShowDialog();
|
if (fmLogin.DialogResult == DialogResult.OK)
|
Application.Run(new FrmMain());
|
}
|
else
|
{
|
Application.Exit();
|
}
|
}
|
}
|
}
|