AnAppADay.TimeManagement.WinApp.Program.Main C# (CSharp) Method

Main() private method

private Main ( ) : void
return void
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                desktopWin = GetDesktopWindow();

                //read config file
                try
                {
                    using (FileStream iniIn = new FileStream("AnAppADay.TimeManagement.WinApp.jedi", FileMode.Open, FileAccess.Read))
                    {
                        using (StreamReader iniRead = new StreamReader(iniIn))
                        {
                            pollRate = Int32.Parse(iniRead.ReadLine());
                            filename = iniRead.ReadLine();
                        }
                    }
                }
                catch (Exception)
                {
                    filename = "TimeManagement.csv";
                }

                //setup the output file
                OpenOutputFile();

                //setup the systray
                ntfy = new NotifyIcon();
                MenuItem[] menuItems = new MenuItem[3];
                menuItems[0] = new MenuItem("Options");
                menuItems[0].Click += new EventHandler(Options_Select);
                menuItems[1] = new MenuItem("About");
                menuItems[1].Click += new EventHandler(About_Select);
                menuItems[2] = new MenuItem("Exit");
                menuItems[2].Click += new EventHandler(Exit_Select);
                ContextMenu menu = new ContextMenu(menuItems);
                ntfy.ContextMenu = menu;
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
                ntfy.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
                ntfy.Visible = true;

                //start watching the apps
                _t = new Thread(RecordApplications);
                _t.Start();

                //start the gui msg loop
                Application.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An unknown error occurred: " + ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }