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) { //Import configuration into temporary variables iWorkDuration = UserData.getWorkDuration(); cTrayIconColor = UserData.getTrayIconColor(); lBreak = new ObservableCollection <Break>(UserData.getBreaks()); lSubtitle = new ObservableCollection <Subtitle>(UserData.getSubtitles()); lThreshold = new ObservableCollection <Threshold>(UserData.getThresholds()); //Intitialize user control values iudWorkDuration.Value = iWorkDuration; cpTrayIcon.SelectedColor = cTrayIconColor; lvBreaks.ItemsSource = lBreak; lvSubtitles.ItemsSource = lSubtitle; lvThresholds.ItemsSource = lThreshold; }