コード例 #1
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool isFirstInstance;

            // Please use a unique name for the mutex to prevent conflicts with other programs
            using (Mutex mtx = new Mutex(true, "AwkEverywhere", out isFirstInstance)) {
                if (isFirstInstance)
                {
                    moNotificationIcon = new NotificationIcon();
                    moNotificationIcon.notifyIcon.Visible = true;
                    if (ConfigurationManager.AppSettings[AppSettingsKey.OPEN_WINDOW_ON_STARTUP_KEY].ToLower() == "true")
                    {
                        moNotificationIcon.moMain.Show();
                        moNotificationIcon.moMain.Activate();
                    }
                    Application.Run();
                    moNotificationIcon.notifyIcon.Dispose();
                }
            }             // releases the Mutex
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool isFirstInstance;
            // Please use a unique name for the mutex to prevent conflicts with other programs
            using (Mutex mtx = new Mutex(true, "AwkEverywhere", out isFirstInstance)) {
                if (isFirstInstance) {
                    moNotificationIcon = new NotificationIcon();
                    moNotificationIcon.notifyIcon.Visible = true;
                    if (ConfigurationManager.AppSettings[AppSettingsKey.OPEN_WINDOW_ON_STARTUP_KEY].ToLower() == "true")
                    {
                        moNotificationIcon.moMain.Show();
                        moNotificationIcon.moMain.Activate();
                    }
                    Application.Run();
                    moNotificationIcon.notifyIcon.Dispose();
                }
            } // releases the Mutex
        }