예제 #1
0
 public static Brush EnumToColor(Models.Colors color)
 {
     if (color == Models.Colors.None)
     {
         return(Brushes.Black);
     }
     if (color == Models.Colors.Blue)
     {
         return(Brushes.Blue);
     }
     if (color == Models.Colors.Gray)
     {
         return(Brushes.Gray);
     }
     if (color == Models.Colors.Green)
     {
         return(Brushes.Green);
     }
     if (color == Models.Colors.Orange)
     {
         return(Brushes.Orange);
     }
     if (color == Models.Colors.Red)
     {
         return(Brushes.Red);
     }
     if (color == Models.Colors.Yellow)
     {
         return(Brushes.Yellow);
     }
     return(null);
 }
예제 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(Brush))
            {
                throw new InvalidOperationException("The target must be Brush.");
            }

            Models.Colors color = (Models.Colors)value;
            return(EnumToColor(color));
        }
예제 #3
0
        private byte[] getIconCategory(Models.Category category)
        {
            Models.Colors enumColor = Models.Colors.None;
            if (category != null)
            {
                enumColor = category.Color;
            }
            Brush color = EnumToColorConverter.EnumToColor(enumColor);

            string iconPath = System.Windows.Application.Current.TryFindResource("TaskIncompleteIconPath") as string;

            return(getImageBytes(createImageSource(iconPath, color) as DrawingImage));
        }
예제 #4
0
        private Image getIconCategory(Category category)
        {
            Models.Colors enumColor = Models.Colors.None;
            if (category != null)
            {
                enumColor = category.Color;
            }
            Brush color = EnumToColorConverter.EnumToColor(enumColor);

            string iconPath = Application.Current.TryFindResource("TaskIncompleteIconPath") as string;

            return(createImage(iconPath, color));;
        }
예제 #5
0
        private Image getIconTask(Models.Task task)
        {
            Models.Colors enumColor = Models.Colors.None;
            if (task.Category != null)
            {
                enumColor = task.Category.Color;
            }
            Brush color = EnumToColorConverter.EnumToColor(enumColor);

            string iconPath = Application.Current.TryFindResource("TaskIncompleteIconPath") as string;

            if (task.IsCompleted)
            {
                iconPath = Application.Current.TryFindResource("TaskCompletedIconPath") as string;
            }

            return(createImage(iconPath, color));
        }