LineType.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Collections.ObjectModel;
  2. using System.Windows.Media;
  3. namespace ProximaAnalizer.Data;
  4. internal partial class LineCollection : ObservableObject
  5. {
  6. public LineCollection()
  7. {
  8. this.LinesDash.Add(new("FF00FF", [2, 2]));
  9. this.LinesDash.Add(new("4B0082", [2, 2]));
  10. this.LinesDash.Add(new("7B68EE", [2, 2]));
  11. this.LinesDash.Add(new("0000FF", [2, 2]));
  12. this.LinesDash.Add(new("1E90FF", [2, 2]));
  13. this.LinesDash.Add(new("32CD32", [2, 2]));
  14. this.LinesDash.Add(new("A0522D", [2, 2]));
  15. this.LinesDash.Add(new("FF8C00", [2, 2]));
  16. this.LinesDash.Add(new("FF0000", [2, 2]));
  17. this.LinesDash.Add(new("696969", [2, 2]));
  18. this.LinesSolid.Add(new("FF00FF", [2, 0]));
  19. this.LinesSolid.Add(new("4B0082", [2, 0]));
  20. this.LinesSolid.Add(new("7B68EE", [2, 0]));
  21. this.LinesSolid.Add(new("0000FF", [2, 0]));
  22. this.LinesSolid.Add(new("1E90FF", [2, 0]));
  23. this.LinesSolid.Add(new("32CD32", [2, 0]));
  24. this.LinesSolid.Add(new("A0522D", [2, 0]));
  25. this.LinesSolid.Add(new("FF8C00", [2, 0]));
  26. this.LinesSolid.Add(new("FF0000", [2, 0]));
  27. this.LinesSolid.Add(new("696969", [2, 0]));
  28. }
  29. [ObservableProperty]
  30. private ObservableCollection<LineType> _LinesSolid = [];
  31. [ObservableProperty]
  32. private ObservableCollection<LineType> _LinesDash = [];
  33. }
  34. internal partial class LineType : ObservableObject
  35. {
  36. public LineType(string color, DoubleCollection dash)
  37. {
  38. this.Brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + color));
  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. public string HexRGB { get; }
  50. public Brush? Brush { get; set; }
  51. public DoubleCollection? DashArray { get; set; }
  52. }