NetworkInterfaceInfoParam.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. namespace Vinno.FIS.Sonopost.Features.Network
  3. {
  4. public class NetworkInterfaceInfoParam<T> : INamedObject<string>
  5. {
  6. private T _value;
  7. public EventHandler ValueChanged;
  8. public T Value
  9. {
  10. get
  11. {
  12. return _value;
  13. }
  14. set
  15. {
  16. if (!object.Equals(_value, value))
  17. {
  18. _value = value;
  19. ValueChanged?.Invoke(this, EventArgs.Empty);
  20. }
  21. }
  22. }
  23. public string Name
  24. {
  25. get;
  26. private set;
  27. }
  28. public T DefaultValue
  29. {
  30. get;
  31. internal set;
  32. }
  33. public bool Dirty => !object.Equals(Value, DefaultValue);
  34. public NetworkInterfaceInfoParam(string name, T value)
  35. {
  36. Name = name;
  37. _value = value;
  38. DefaultValue = value;
  39. }
  40. internal void UpdateDefaultValue(T value)
  41. {
  42. Value = value;
  43. DefaultValue = value;
  44. }
  45. }
  46. }