示例#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, "Notpod", out isFirstInstance)) {
                if (isFirstInstance) {
                    NotpodIcon applicationInstance = new NotpodIcon();
                    applicationInstance.notifyIcon.Visible = true;
                    Application.Run();
                    applicationInstance.notifyIcon.Dispose();
                } else {
                    // The application is already running
                    MessageBox.Show("Notpod is already running in your system tray. Look for it's icon there and right-click it to get started.","Notpod",MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            } // 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, "Notpod", out isFirstInstance)) {
                if (isFirstInstance)
                {
                    NotpodIcon applicationInstance = new NotpodIcon();
                    applicationInstance.notifyIcon.Visible = true;
                    Application.Run();
                    applicationInstance.notifyIcon.Dispose();
                }
                else
                {
                    // The application is already running
                    MessageBox.Show("Notpod is already running in your system tray. Look for it's icon there and right-click it to get started.", "Notpod", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            } // releases the Mutex
        }