using System; using System.Collections.Generic; using System.Drawing; using System.Globalization; using System.Windows.Data; namespace Plugin.TestResult_WPF.Constant { public class CommonStatus { public static readonly string OK = "ok"; public static readonly string NG = "ng"; public static readonly string WAITING = "waiting"; public static readonly string CHECKINFAILED = "checkInFailed"; public static readonly string CHECK_IN = "checkIn"; public static readonly string TESTING = "testing"; public static readonly string ALERT = "alert"; public static readonly string READY = "ready"; private static string[] cache = new string[] { "ok", "ng", "waiting", "checkInFailed", "checkIn", "testing", "alert", "ready" }; public static readonly Dictionary STATUS_MAP = new Dictionary() { { "ok","正常"}, { "ng","异常"}, { "waiting","等待中"}, { "checkInFailed","CheckIn失败"}, { "checkIn","CheckIn"}, { "testing","测试中"}, { "alert","报警"}, { "ready","准备就绪"}, { "abort","手动停止"}, }; public static readonly Dictionary COLOR_MAP = new Dictionary() { { "ok",new SolidBrush(Color.FromArgb(0,0,0,0))}, { "ng",new SolidBrush(Color.FromArgb(0,0,0,0))}, { "waiting",new SolidBrush(Color.FromArgb(0,0,0,0))}, { "testing",new SolidBrush(Color.FromArgb(0,0,0,0))}, { "checkInFailed",new SolidBrush(Color.FromArgb(0,0,0,0))}, { "checkIn",new SolidBrush(Color.FromArgb(0,0,0,0))}, { "abort",new SolidBrush(Color.FromArgb(0,0,0,0))}, }; public static string GetRandomStatus() { return cache[new Random().Next(cache.Length)]; } public static string GetStatusDescription(string status) { if (STATUS_MAP.ContainsKey(status)) return STATUS_MAP[status]; return ""; } } public class StatusColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is string status) { } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }