示例#1
0
        private void Initialize()
        {
            AppRes.Initialize();

            invalidThread = null;

            DefMenu = new UlMenu(viewPanel);
            DefMenu.Add(new CtrlAutoRight(), testButton);
            DefMenu.Add(new CtrlManualRight(), deviceButton);
            DefMenu.Add(new CtrlViewRight(), viewButton);
            DefMenu.Add(new CtrlConfigRight(), configButton);
        }
        static void Main()
        {
            bool  isAlone;
            Mutex mutex = new Mutex(true, @"Global\IsSoft.Sec.LedChecker", out isAlone);

            if (isAlone == true)
            {
                WindowsFormsSettings.ForceDirectXPaint();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                try
                {
                    AppRes.Create();
                    AppRes.TotalLog.Log("Begin program");
                    Application.Run(new FormLedCheckerMain());
                }
                catch (Exception e)
                {
                    AppRes.TotalLog["EXCEPTION"] = e.ToString();
                    MessageBox.Show(e.ToString(), AppRes.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    AppRes.Destroy();
                    AppRes.TotalLog.Log("End program");

                    mutex.ReleaseMutex();
                }
            }
            else
            {
                MessageBox.Show(
                    "Cannot run this program because of running it already!",
                    AppRes.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);

                Application.Exit();
            }
        }