public TimeTrackerTrayApp()
        {
            _logFile = ConfigurationManager.AppSettings["LogFile"];

            Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch);
            trayMenu = new System.Windows.Forms.ContextMenu();
            trayMenu.MenuItems.Add("Update Effort", OnPromptForCurrentEffort);
            trayMenu.MenuItems.Add("Exit", OnExit);

            trayIcon = new NotifyIcon();
            trayIcon.Text = "Time Tracker";
            trayIcon.Icon = new Icon(typeof(TimeTrackerTrayApp), "stopwatch.ico");
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;
            trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick);
            trayIcon.BalloonTipClicked += new EventHandler(trayIcon_BalloonTipClicked);

            taskbarNotifier1 = new TaskbarNotifier();
            taskbarNotifier1.SetBackgroundBitmap(new Bitmap(GetType(), "skin.bmp"), Color.FromArgb(255, 0, 255));
            taskbarNotifier1.SetCloseBitmap(new Bitmap(GetType(), "close.bmp"), Color.FromArgb(255, 0, 255), new Point(177, 8));
            taskbarNotifier1.TitleRectangle = new Rectangle(50, 9, 120, 25);
            taskbarNotifier1.ContentRectangle = new Rectangle(8, 41, 180, 68);
            taskbarNotifier1.TitleClick += new EventHandler(taskbarNotifier1_TitleClick);
            taskbarNotifier1.ContentClick += new EventHandler(taskbarNotifier1_ContentClick);
            taskbarNotifier1.CloseClick += new EventHandler(taskbarNotifier1_CloseClick);
            taskbarNotifier1.OnHide += new EventHandler(taskbarNotifier1_OnHide);

            #region listen for computer lock

            //WTSRegisterSessionNotification(this.Handle, NotifyForThisSession);

            #endregion listen for computer lock

            #region listen for active window change

            // Listen for foreground changes across all processes/threads on current desktop...
            _hhook1 = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, IntPtr.Zero,
                    procDelegate, 0, 0, WINEVENT_OUTOFCONTEXT);

            _hhook2 = SetWinEventHook(EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_NAMECHANGE, IntPtr.Zero,
                    procDelegate, 0, 0, WINEVENT_OUTOFCONTEXT);

            #endregion listen for active window change

            timer.Enabled = true;
            timer.Interval = ((60 * MINUTES_BETWEEN_PROMPTS) * 1000); // 60 seconds * min * millisecond
            timer.Tick += new EventHandler(OnTimer);

            logTimer = new Timer();
            logTimer.Interval = BALOON_VISIBILITY_TIME;
            logTimer.Tick += delegate (System.Object o, System.EventArgs e) { LogEffort(_logFile); };
            logTimer.Enabled = false;

            ShowPopup();
        }
        public TimeTrackerTrayApp()
        {
            _logFile = ConfigurationManager.AppSettings["LogFile"];

            Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch);
            trayMenu = new System.Windows.Forms.ContextMenu();
            trayMenu.MenuItems.Add("Update Effort", OnPromptForCurrentEffort);
            trayMenu.MenuItems.Add("Exit", OnExit);

            trayIcon = new NotifyIcon();
            trayIcon.Text = "Time Tracker";
            trayIcon.Icon = new Icon(typeof(TimeTrackerTrayApp), "stopwatch.ico");
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;
            trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick);
            trayIcon.BalloonTipClicked += new EventHandler(trayIcon_BalloonTipClicked);

            taskbarNotifier1 = new TaskbarNotifier();
            taskbarNotifier1.SetBackgroundBitmap(new Bitmap(GetType(), "skin.bmp"), Color.FromArgb(255, 0, 255));
            taskbarNotifier1.SetCloseBitmap(new Bitmap(GetType(), "close.bmp"), Color.FromArgb(255, 0, 255), new Point(177, 8));
            taskbarNotifier1.TitleRectangle = new Rectangle(50, 9, 120, 25);
            taskbarNotifier1.ContentRectangle = new Rectangle(8, 41, 180, 68);
            taskbarNotifier1.TitleClick += new EventHandler(taskbarNotifier1_TitleClick);
            taskbarNotifier1.ContentClick += new EventHandler(taskbarNotifier1_ContentClick);
            taskbarNotifier1.CloseClick += new EventHandler(taskbarNotifier1_CloseClick);
            taskbarNotifier1.OnHide += new EventHandler(taskbarNotifier1_OnHide);

            #region listen for computer lock

            //WTSRegisterSessionNotification(this.Handle, NotifyForThisSession);

            #endregion

            #region listen for active window change

            // Listen for foreground changes across all processes/threads on current desktop...
            _hhook1 = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, IntPtr.Zero,
                    procDelegate, 0, 0, WINEVENT_OUTOFCONTEXT);

            _hhook2 = SetWinEventHook(EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_NAMECHANGE, IntPtr.Zero,
                    procDelegate, 0, 0, WINEVENT_OUTOFCONTEXT);

            #endregion

            timer.Enabled = true;
            timer.Interval = ((60 * MINUTES_BETWEEN_PROMPTS) * 1000); // 60 seconds * min * millisecond
            timer.Tick += new EventHandler(OnTimer);

            logTimer = new Timer();
            logTimer.Interval = BALOON_VISIBILITY_TIME;
            logTimer.Tick += delegate(System.Object o, System.EventArgs e) { LogEffort(_logFile); };
            logTimer.Enabled = false;

            ShowPopup();
        }