using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Media; using Venus_Core; namespace Venus_MainPages.Converters { internal class TMStateConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null)return new SolidColorBrush(Colors.WhiteSmoke); TMState currentState = (TMState)Enum.Parse(typeof(TMState), value.ToString()); switch (currentState) { case TMState.Init: //return new SolidColorBrush(Colors.Yellow); return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D79C11")); case TMState.Idle: return new SolidColorBrush(Colors.WhiteSmoke); case TMState.Error: return new SolidColorBrush(Colors.Red); default: //return new SolidColorBrush(Colors.Lime); return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#07B699")); } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return null; } } }