Ejemplo n.º 1
0
        public wndMain()
        {
            try
            {
                //Config.Import();
                //UserData.ExportOldConfig();

                // read user settings
                // ConfigHandler.Save();

                UserData.ReadConfig();

                if (WorkdayHandler.getIsStarted())
                {
                    WorkdayHandler.WorkdayStart(UserData.getWorkDuration(), UserData.getWorkTimeStart());
                }

                ui_NotifyIcon Icon = new ui_NotifyIcon();
                Icon.trayIcon.Click += OnTrayClick;
                Icon.trayIcon.ContextMenu.MenuItems["settings"].Click += OnSettingsClick;
                Icon.trayIcon.ContextMenu.MenuItems["history"].Click  += OnHistoryClick;
                Icon.trayIcon.ContextMenu.MenuItems["exit"].Click     += OnExitClick;

                SessionHandler UserSession = new SessionHandler();
                UserSession.MyWorkdayEvent += new SessionHandler.EventDelegate(OnSessionStateChange);
                UserSession.VerifySessionState();
            }
            catch (Exception e) { MessageBox.Show(e.Source + "-----" + e.Message + "-------" + e.StackTrace + "-----------" + e.Data);
                                  Application.Current.Shutdown(1); }
        }
Ejemplo n.º 2
0
        private void tUpdateIcon_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (!WorkdayHandler.getIsStarted())
            {
                trayIcon.Icon = Helper.getTrayIcon(UserData.getTrayIconColor(), new Colour(Color.Transparent));
            }
            else
            {
                if (WorkdayHandler.getPercent(UserData.getWorkTimeStart()) == 100)
                {
                    if (bIcon)
                    {
                        trayIcon.Icon = Helper.getTrayIcon(UserData.getTrayIconColor(), Helper.getProgressColor(WorkdayHandler.getPercent(UserData.getWorkTimeStart())));
                        bIcon         = false;
                    }
                    else
                    {
                        trayIcon.Icon = Helper.getTrayIcon(Helper.getProgressColor(WorkdayHandler.getPercent(UserData.getWorkTimeStart())), UserData.getTrayIconColor());
                        bIcon         = true;
                    }
                }
                else
                {
                    trayIcon.Icon = Helper.getTrayIcon(UserData.getTrayIconColor(), Helper.getProgressColor(WorkdayHandler.getPercent(UserData.getWorkTimeStart())));
                }
            }

            GC.WaitForPendingFinalizers();
            GC.Collect();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Helper.EnableAeroBorder(5, this);

            labelHeaderSubtitle.Text       = Helper.getSubtitle(WorkdayHandler.getPercent(UserData.getWorkTimeStart()));
            labelRemainingTime.Text        = WorkdayHandler.getWorkTimeRemaining(UserData.getWorkTimeStart()).ToString("hh\\:mm");
            labelRemainingText.Text        = WorkdayHandler.getWorkTimeRemaining(UserData.getWorkTimeStart()) < TimeSpan.Zero ? "Overtime:" : "Remaining Time";
            labelElapsedTime.Text          = WorkdayHandler.getWorkTimeElapsed(UserData.getWorkTimeStart()).ToString("hh\\:mm");
            labelEndTime.Text              = WorkdayHandler.getWorkTimeEnd(UserData.getWorkTimeStart()).ToShortTimeString();
            labelStartTime.Text            = UserData.getWorkTimeStart().ToShortTimeString();
            labelPercentage.Text           = WorkdayHandler.getPercent(UserData.getWorkTimeStart()).ToString() + "%";
            progressbarWorktime.Value      = WorkdayHandler.getPercent(UserData.getWorkTimeStart());
            progressbarWorktime.Foreground = new SolidColorBrush(Helper.getProgressColor(WorkdayHandler.getPercent(UserData.getWorkTimeStart())));

            if (!WorkdayHandler.getIsStarted())
            {
                grid.Children.Remove(labelWorkdayModify);
                labelWorkdayStartEnd.Text   = "Start new Workday";
                labelWorkdayStartEnd.Margin = new Thickness(0, 10, 0, 15);
            }
            else
            {
                labelWorkdayStartEnd.Text = "End current Workday";
            }
        }
        private void labelStartEnd_OnMouseClick(object sender, MouseButtonEventArgs e)
        {
            if (!WorkdayHandler.getIsStarted())
            {
                UserData.setOpenWindow(OpenForm.StartModify);
            }
            else
            {
                UserData.setOpenWindow(OpenForm.End);
            }

            Close();
        }
Ejemplo n.º 5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Helper.EnableAeroBorder(5, this);

            if (!WorkdayHandler.getIsStarted())
            {
                labelHeaderTitle.Text = "Start new Workday";
                pickerStartTime.Value = DateTime.Now;
            }
            else
            {
                labelHeaderTitle.Text = "Modify current Workday";
                pickerStartTime.Value = UserData.getWorkTimeStart();
            }

            pickerWorkDuration.Value = UserData.getWorkDuration();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DateTime dtTempNow = DateTime.Now;

            if (!WorkdayHandler.getIsStarted())
            {
                Title = "First daily logon detected - No workday active";
                cbEndWorkday.IsEnabled  = false;
                cbEndWorkday.IsChecked  = false;
                pickerEndTime.IsEnabled = false;
                pickerStartTime.Value   = dtTempNow;
            }
            else
            {
                Title = "First daily logon detected - Workday on '" + UserData.getLastLockTime().ToShortDateString() + "' still active";
                pickerStartTime.Value = dtTempNow;
                pickerEndTime.Value   = UserData.getLastLockTime();
            }
        }