using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;

namespace Kivii.Client.SamplePackages
{
    internal static class Program
    {
        #region 设置单进程，开机启动
        private static Mutex _mutex = null;
        private static bool isProgramExisted()
        {
            bool rtns = false;
            _mutex = new Mutex(true, "UHFReader18CSharp.dll", out rtns);
            //mutex.Dispose();
            return !rtns;
        }
        #endregion
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (isProgramExisted())
            {
                MessageBox.Show($"读卡器被占用正在被使用。", "通讯冲突", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                Application.Exit();
                return;
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
    }
}
