using OpenSEMI.ClientBase; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Media; namespace CyberX8_Themes.Converters { public class StringToColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { switch (value.ToString()) { case "Information": return new SolidColorBrush(Colors.Green); case "Warning": return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ffd400")); case "Alarm": return new SolidColorBrush(Colors.Red); default: return new SolidColorBrush(Colors.Silver); } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(value is bool)) return false; return !(bool)value; } } public class StringToColorConverter1 : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { switch (value.ToString()) { case "Normal": return new SolidColorBrush(Colors.Lime); case "Warning": return new SolidColorBrush(Colors.Yellow); case "Error": return new SolidColorBrush(Colors.Red); default: return new SolidColorBrush(Colors.Gray); } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(value is bool)) return false; return !(bool)value; } } public class StringToColorConverter2 : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { switch (value.ToString()) { case "Full": return new SolidColorBrush(Colors.Lime); case "Empty": return new SolidColorBrush(Colors.Red); case "Warning": return new SolidColorBrush(Colors.Yellow); default: return new SolidColorBrush(Colors.Gray); } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(value is bool)) return false; return !(bool)value; } } public class StringToColorConverter3 : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { switch ((int)value) { //Idle / No Process Job case 1: LinearGradientBrush linearGradientBrush1 = new LinearGradientBrush(); linearGradientBrush1.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFB88700"), 0)); linearGradientBrush1.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFF7E0A0"), 0.5)); linearGradientBrush1.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFB88700"), 1)); linearGradientBrush1.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush1.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush1; //Idle /Process Job case 2: LinearGradientBrush linearGradientBrush2 = new LinearGradientBrush(); linearGradientBrush2.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF3333FF"), 0)); linearGradientBrush2.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFE1E1FF"), 0.5)); linearGradientBrush2.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF3333FF"), 1)); linearGradientBrush2.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush2.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush2; //InProcess case 3: LinearGradientBrush linearGradientBrush3 = new LinearGradientBrush(); linearGradientBrush3.GradientStops.Add(new GradientStop(Colors.Cyan, 0)); linearGradientBrush3.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFE7F5F9"), 0.5)); linearGradientBrush3.GradientStops.Add(new GradientStop(Colors.Cyan, 1)); linearGradientBrush3.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush3.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush3; //Completed case 4: LinearGradientBrush linearGradientBrush4 = new LinearGradientBrush(); linearGradientBrush4.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF00B400"), 0)); linearGradientBrush4.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFA9FFA9"), 0.5)); linearGradientBrush4.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF00B400"), 1)); linearGradientBrush4.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush4.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush4; //Failed case 5: LinearGradientBrush linearGradientBrush5 = new LinearGradientBrush(); linearGradientBrush5.GradientStops.Add(new GradientStop(Colors.Red, 0)); linearGradientBrush5.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFFFD7D7"), 0.5)); linearGradientBrush5.GradientStops.Add(new GradientStop(Colors.Red, 1)); linearGradientBrush5.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush5.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush5; //Dummy wafer case 6: LinearGradientBrush linearGradientBrush6 = new LinearGradientBrush(); linearGradientBrush6.GradientStops.Add(new GradientStop(Colors.DarkKhaki, 0)); linearGradientBrush6.GradientStops.Add(new GradientStop(Colors.Khaki, 0.5)); linearGradientBrush6.GradientStops.Add(new GradientStop(Colors.DarkKhaki, 1)); linearGradientBrush6.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush6.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush6; //Failed case 7: LinearGradientBrush linearGradientBrush7 = new LinearGradientBrush(); linearGradientBrush7.GradientStops.Add(new GradientStop(Colors.DarkGray, 0)); linearGradientBrush7.GradientStops.Add(new GradientStop(Colors.LightGray, 0.5)); linearGradientBrush7.GradientStops.Add(new GradientStop(Colors.DarkGray, 1)); linearGradientBrush7.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush7.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush7; //Failed case 8: LinearGradientBrush linearGradientBrush8 = new LinearGradientBrush(); linearGradientBrush8.GradientStops.Add(new GradientStop(Colors.DarkOrange, 0)); linearGradientBrush8.GradientStops.Add(new GradientStop(Colors.Orange, 0.5)); linearGradientBrush8.GradientStops.Add(new GradientStop(Colors.DarkOrange, 1)); linearGradientBrush8.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush8.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush8; //Empty default: LinearGradientBrush linearGradientBrush = new LinearGradientBrush(); linearGradientBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#00B88700"), 0)); linearGradientBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#00F7E0A0"), 0.5)); linearGradientBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#00B88700"), 1)); linearGradientBrush.StartPoint = new System.Windows.Point(1, 0.5); linearGradientBrush.EndPoint = new System.Windows.Point(0, 0.5); return linearGradientBrush; } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(value is bool)) return false; return !(bool)value; } } }