コード例 #1
0
        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;
        }
コード例 #2
0
        // Get a color corresponding to workday progress by percent
        public static Colour getProgressColor(int percent)
        {
            int previous = 0;

            foreach (Threshold threshold in UserData.getThresholds())
            {
                if (percent >= previous && percent <= threshold.value)
                {
                    return(threshold.colour);
                }

                previous = threshold.value;
            }

            return(new Colour(Colors.Pink));
        }