DoubleParam.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace RecipeEditorLib.RecipeModel.Params
  7. {
  8. public class DoubleParam : Param
  9. {
  10. public override bool UndoChanges()
  11. {
  12. Value = OldValue;
  13. IsSaved = true;
  14. return true;
  15. }
  16. private string _oldValue;
  17. public string OldValue
  18. {
  19. get { return this._oldValue; }
  20. set
  21. {
  22. this._oldValue = value;
  23. this.NotifyOfPropertyChange("OldValue");
  24. }
  25. }
  26. private string _value;
  27. public string Value
  28. {
  29. get { return this._value; }
  30. set
  31. {
  32. this._value = value;
  33. if (IsSaved)
  34. {
  35. OldValue = value;
  36. }
  37. if (this.Feedback != null)
  38. this.Feedback(this);
  39. this.NotifyOfPropertyChange("Value");
  40. }
  41. }
  42. private double _minimun;
  43. public double Minimun
  44. {
  45. get { return this._minimun; }
  46. set
  47. {
  48. this._minimun = value;
  49. this.NotifyOfPropertyChange("Minimun");
  50. }
  51. }
  52. private double _maximun;
  53. public double Maximun
  54. {
  55. get { return this._maximun; }
  56. set
  57. {
  58. this._maximun = value;
  59. this.NotifyOfPropertyChange("Maximun");
  60. }
  61. }
  62. private int _resolution;
  63. public int Resolution
  64. {
  65. get { return this._resolution; }
  66. set
  67. {
  68. this._resolution = value;
  69. this.NotifyOfPropertyChange("Resolution");
  70. }
  71. }
  72. public override void SetValue(string value)
  73. {
  74. IsSaved = false;
  75. this.Value = value;
  76. }
  77. }
  78. }