private void InitData()
        {
            TaskProgressResult currentTaskProgress;

            if (ApplicationContext.TaskProgressDictionary.ContainsKey(_taskItemViewModel.Id))
            {
                currentTaskProgress = ApplicationContext.TaskProgressDictionary[_taskItemViewModel.Id];
            }
            else
            {
                currentTaskProgress = new TaskProgressResult();
                currentTaskProgress.Init();
            }
            if (TaskProgressCollection != null)
            {
                TaskProgressCollection = null;
            }
            TaskProgressCollection = new ObservableCollection <TaskProgressItemView>();
            ColorBrushCollection   = new BrushCollection();

            foreach (var task in currentTaskProgress)
            {
                var solidColor = new SolidColorBrush(_dictColorMap[task.Type]);
                var taskView   = new TaskProgressItemView(task)
                {
                    SolidColor = solidColor
                };
                if (task.TaskCount > 0)
                {
                    ColorBrushCollection.Add(solidColor);
                }
                TaskProgressCollection.Add(taskView);
            }
        }
Exemplo n.º 2
0
 /// <summary>Adds a list of NamedColor as SolidColorBrush to the current BrushCollection</summary>
 public static BrushCollection AddRange(this BrushCollection brushCollection, List <NamedColor> colors)
 {
     foreach (var color in colors)
     {
         brushCollection.Add(color.ToBrush());
     }
     return(brushCollection);
 }
Exemplo n.º 3
0
 /// <summary>Adds a list of LinearGradientBrush to the current BrushCollection</summary>
 public static BrushCollection AddRange(this BrushCollection brushCollection, List <LinearGradientBrush> brushes)
 {
     foreach (var brush in brushes)
     {
         brushCollection.Add(brush);
     }
     return(brushCollection);
 }
Exemplo n.º 4
0
 /// <summary>Adds a list of SolidColorBrush to the current BrushCollection</summary>
 public static BrushCollection AddRange(this BrushCollection brushCollection, List <SolidColorBrush> brushes)
 {
     foreach (var brush in brushes)
     {
         brushCollection.Add(brush);
     }
     return(brushCollection);
 }
Exemplo n.º 5
0
        public static BrushCollection ReverseItems(this BrushCollection brushCollection)
        {
            var newBrushCollection = new BrushCollection();

            for (int i = brushCollection.Count - 1; i >= 0; i--)
            {
                var brush = brushCollection[i];
                newBrushCollection.Add(brush);
            }
            return(newBrushCollection);
        }
Exemplo n.º 6
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            BrushCollection brushes = (BrushCollection)parameter;

            if (brushes == null)
            {
                brushes = new BrushCollection();
                brushes.Add((Brush)App.Current.Resources["ThemeTextForegroundBrush"]);
                brushes.Add(new SolidColorBrush(Colors.Blue));
                brushes.Add(new SolidColorBrush(Colors.Red));
            }

            if (targetType != typeof(Brush))
            {
                return(null);
            }

            if ((int)value == 0)
            {
                return(brushes[1]);
            }

            return((int)value < 0 ? brushes[2] : brushes[0]);
        }