Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#

Gmail for Windows 7

Rate me:
Please Sign up or sign in to vote.
4.94/5 (42 votes)
24 Jan 2010CPOL15 min read 150.4K   8.5K   111  
A little application to notify you of new Gmail using new Windows 7 features
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;
using System.Text;

namespace GmailForWin7
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            // See if this is the first instance
            bool firstInstance = false;
            using (Mutex appMutex = new Mutex(true, "GmailForWin7", out firstInstance))
            {
                if (firstInstance)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new GmailMain());
                }
                else
                {
                    // Send argument to running window
                    HandleCmdLineArgs(args);
                }
            }
        }

        public static void HandleCmdLineArgs(string[] args)
        {
            if (args.Length >= 1)
            {
                switch (args[0])
                {
                    case "CheckNow":
                        WindowsMessageHelper.SendMessage(GmailMain.FormTitle, WindowsMessageHelper.CheckNowMsgId);
                        break;
                    case "Settings":
                        WindowsMessageHelper.SendMessage(GmailMain.FormTitle, WindowsMessageHelper.ShowSettingsMsgId);
                        break;
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I have been developing .NET applications since 2001 and have been working in software development since 1989.

Comments and Discussions