public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || value.GetType() != typeof(SyntaxChecker.Result)) { return(Binding.DoNothing); } Brush brush; SyntaxChecker.Result result = (SyntaxChecker.Result)value; switch (result) { case SyntaxChecker.Result.Clean: brush = Brushes.Green; break; case SyntaxChecker.Result.Warning: brush = Brushes.OrangeRed; break; case SyntaxChecker.Result.Error: brush = Brushes.Red; break; default: brush = Brushes.Gray; break; } return(brush); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || value.GetType() != typeof(SyntaxChecker.Result)) { return(Binding.DoNothing); } PackIconMaterialKind icon; SyntaxChecker.Result result = (SyntaxChecker.Result)value; switch (result) { case SyntaxChecker.Result.Clean: icon = PackIconMaterialKind.Check; break; case SyntaxChecker.Result.Warning: icon = PackIconMaterialKind.Alert; break; case SyntaxChecker.Result.Error: icon = PackIconMaterialKind.Close; break; default: icon = PackIconMaterialKind.Magnify; break; } return(icon); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || value.GetType() != typeof(SyntaxChecker.Result)) { return(null); } Brush brush; SyntaxChecker.Result result = (SyntaxChecker.Result)value; switch (result) { case SyntaxChecker.Result.Clean: brush = new SolidColorBrush(Colors.Green); break; case SyntaxChecker.Result.Warning: brush = new SolidColorBrush(Colors.OrangeRed); break; case SyntaxChecker.Result.Error: brush = new SolidColorBrush(Colors.Red); break; default: brush = new SolidColorBrush(Colors.Gray); break; } return(brush); }