public UIAutomationService()
        {
            InitializeComponent();

            log = new EventLogWrapper("CasterUIAutomationLogSource", "CasterUIAutomationLog");

            timer.Interval = 10000; // 10 seconds
            timer.Elapsed += timer_Elapsed;;
            timer.Start();
        }
        static void Main(string[] args)
        {
            if (args.Length > 1)
            {
                Console.WriteLine("Maximum of one argument accepted.");
                Environment.Exit(1);
            }

            log = new EventLogWrapper("CasterUIAutomationLogSource", "CasterUIAutomationLog");

            string message = "args =";

            foreach (string arg in args)
            {
                message += " " + arg;
            }
            log.WriteEntry(message);

            if (args.Length == 1 && args[0].ToLower() == "client")
            {
                for (int i = 0; i < 10; i++)
                {
                    try
                    {
                        System.Threading.Thread.Sleep(10000);
                        timer_Elapsed();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            log.WriteEntry(ex.ToString());
                        }
                        catch (Exception) { }
                    }
                }
            }
            else
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new UIAutomationService()
                };
                ServiceBase.Run(ServicesToRun);
            }
        }