StringParam.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 StringParam : 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 _oldValue; }
  20. set
  21. {
  22. _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. public override void SetValue(string value)
  43. {
  44. IsSaved = false;
  45. this.Value = value;
  46. }
  47. }
  48. }