LineType.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System.Collections.ObjectModel;
  2. using System.Text.Json.Serialization;
  3. using System.Windows.Media;
  4. namespace ProximaAnalizer.Data;
  5. internal partial class LineCollection : ObservableObject
  6. {
  7. public LineCollection()
  8. {
  9. this.LinesDash.Add(new("FF00FF", [2, 2]));
  10. this.LinesDash.Add(new("4B0082", [2, 2]));
  11. this.LinesDash.Add(new("7B68EE", [2, 2]));
  12. this.LinesDash.Add(new("0000FF", [2, 2]));
  13. this.LinesDash.Add(new("1E90FF", [2, 2]));
  14. this.LinesDash.Add(new("32CD32", [2, 2]));
  15. this.LinesDash.Add(new("A0522D", [2, 2]));
  16. this.LinesDash.Add(new("FF8C00", [2, 2]));
  17. this.LinesDash.Add(new("FF0000", [2, 2]));
  18. this.LinesDash.Add(new("696969", [2, 2]));
  19. this.LinesSolid.Add(new("FF00FF", [2, 0]));
  20. this.LinesSolid.Add(new("4B0082", [2, 0]));
  21. this.LinesSolid.Add(new("7B68EE", [2, 0]));
  22. this.LinesSolid.Add(new("0000FF", [2, 0]));
  23. this.LinesSolid.Add(new("1E90FF", [2, 0]));
  24. this.LinesSolid.Add(new("32CD32", [2, 0]));
  25. this.LinesSolid.Add(new("A0522D", [2, 0]));
  26. this.LinesSolid.Add(new("FF8C00", [2, 0]));
  27. this.LinesSolid.Add(new("FF0000", [2, 0]));
  28. this.LinesSolid.Add(new("696969", [2, 0]));
  29. }
  30. [ObservableProperty]
  31. private ObservableCollection<LineType> _LinesSolid = [];
  32. [ObservableProperty]
  33. private ObservableCollection<LineType> _LinesDash = [];
  34. }
  35. internal partial class LineType : ObservableObject
  36. {
  37. public LineType(string color, DoubleCollection dash)
  38. {
  39. this.HexRGB = color;
  40. this.DashArray = dash;
  41. if (dash[1] != 0)
  42. LinePattern = ScottPlot.LinePattern.DenselyDashed;
  43. else
  44. LinePattern = ScottPlot.LinePattern.Solid;
  45. }
  46. [ObservableProperty]
  47. private bool _IsEnable = true;
  48. public ScottPlot.LinePattern LinePattern { get; }
  49. private string? _hex;
  50. public string? HexRGB
  51. {
  52. get { return _hex; }
  53. set
  54. {
  55. _hex = value;
  56. this.Brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + _hex));
  57. }
  58. }
  59. [JsonIgnore]
  60. public Brush? Brush { get; set; }
  61. public DoubleCollection? DashArray { get; set; }
  62. }