示例#1
0
        static void Main()
        {
            Mutex mutex = new Mutex(false, "{46A11243-B4F7-43EA-BC19-D3C27BF2218C}");

            try
            {
                // Wait a little while in case we are restarting
                if (!mutex.WaitOne(2000, true))
                {
                    MessageBox.Show("Application already running.");
                    return;
                }
            }
            catch
            {
                // Ignore
            }

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            }

            UiControls.Initialise(new System.Drawing.Font("Segoe UI", 12));
            MainSettings.Initialise();
            CtlError.DefaultIcon = Icon.FromHandle(Resources.IconInputError.GetHicon());
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }