using Avalonia.Collections; using Avalonia.Media; using ReactiveUI; namespace detect.gui.Commons; public static class ConstantHelper { public static AvaloniaList YesNoList(bool hasAll = true) { var result = new AvaloniaList { new() { Name = "全部" }, new() { Name = "是", Value = "YES" }, new() { Name = "否", Value = "NO" }, }; if (!hasAll) result.RemoveAt(0); return result; } public static AvaloniaList MessageTypeList(bool hasAll = true) { var result = new AvaloniaList { new() { Name = "全部" }, new() { Name = "错误", Value = "ERROR" }, new() { Name = "警告", Value = "WARING" }, new() { Name = "通知", Value = "NOTICE" }, }; if (!hasAll) result.RemoveAt(0); return result; } public static Brush Dark { get; set; } = new SolidColorBrush(Color.FromRgb(52,58,64)); public static Brush LightGray { get; set; } = new SolidColorBrush(Color.FromRgb(204,204,204)); public static Brush BrightGreen { get; set; } = new SolidColorBrush(Color.FromRgb(167,221,36)); public static Brush LightGreen { get; set; } = new SolidColorBrush(Color.FromRgb(65,156,16)); public static Brush Green { get; set; } = new SolidColorBrush(Color.FromRgb(40,167,69)); public static Brush Orange { get; set; } = new SolidColorBrush(Color.FromRgb(253,126,20)); public static Brush BrightRed { get; set; } = new SolidColorBrush(Color.FromRgb(250,153,169)); public static Brush Danger { get; set; } = new SolidColorBrush(Color.FromRgb(220,53,69)); } public class SelectItem : ReactiveObject { private string? _name; public string? Name { get => _name; set => this.RaiseAndSetIfChanged(ref _name, value); } private string? _value; public string? Value { get => _value; set => this.RaiseAndSetIfChanged(ref _value, value); } private bool _isSelected; public SelectItem() { } public SelectItem(string? name, string? value) { Name = name; Value = value; } public bool IsSelected { get => _isSelected; set => this.RaiseAndSetIfChanged(ref _isSelected, value); } }