Wednesday, November 5, 2008

Obama Mutex

A little something for the Obama supporting programmers out there

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Hope;
using Change;
using ProgUtils.ErrorLog;

namespace PresidentialElection
{
    static class Program
    {
        ///
        /// The main entry point for the application.
        ///
        [STAThread]
        static void Main()
        {
            try
            {
                bool ObamaElected;
                System.Threading.Mutex Obama;
                Obama = new System.Threading.Mutex(true, "ObamaAsPresident", out ObamaElected);

                if (!ObamaElected)
                {
                    MessageBox.Show("Obama has already been elected, you can elect him again in 4 years.");
                    return;
                }

                Application.Run(new Form1());

                GC.KeepAlive(Obama);
            }
            catch (Exception ex)
            {
Log.WriteToLog(ex);
            }
        }
    }
}

1 comment:

Anonymous said...

man, how easy is it to post stuff up on these things. you haven't updated in /months/.