using System; using System.Windows.Data; using DominionBase; using DominionBase.Cards; namespace Dominion.NET_WPF.Converters { public sealed class CardToBackgroundBrushConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var @event = value as Event; if (@event != null) return Caching.BrushRepository.GetForegroundBrush(((IDisplayable)value).Category); var displayable = value as IDisplayable; if (displayable != null) return Caching.BrushRepository.GetBackgroundBrush(displayable.Category); return System.Windows.Media.Brushes.Transparent; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } public sealed class CardToForegroundBrushConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var @event = value as Event; if (@event != null) return Caching.BrushRepository.GetBackgroundBrush(((IDisplayable)value).Category); var displayable = value as IDisplayable; if (displayable != null) return Caching.BrushRepository.GetForegroundBrush(displayable.Category); return System.Windows.Media.Brushes.Transparent; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }