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 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()))); })); }