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 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 Timer_Elapsed(object sender, ElapsedEventArgs e) { Dispatcher.Invoke(new Action(() => { 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()))); })); }