Switch.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // System.Diagnostics.Switch.cs
  3. //
  4. // Author:
  5. // John R. Hicks ([email protected])
  6. //
  7. // (C) 2001
  8. //
  9. namespace System.Diagnostics
  10. {
  11. /// <summary>
  12. /// Abstract base class to create new debugging and tracing switches
  13. /// </summary>
  14. public abstract class Switch
  15. {
  16. private string desc = "";
  17. private string display_name = "";
  18. private int iSwitch;
  19. // ================= Constructors ===================
  20. /// <summary>
  21. /// Initialize a new instance
  22. /// </summary>
  23. protected Switch(string displayName, string description)
  24. {
  25. display_name = displayName;
  26. desc = description;
  27. }
  28. /// <summary>
  29. /// Allows an Object to attempt to free resources and
  30. /// perform cleanup before the Object is reclaimed
  31. /// by the Garbage Collector
  32. /// </summary>
  33. ~Switch()
  34. {
  35. }
  36. // ================ Instance Methods ================
  37. // ==================== Properties ==================
  38. /// <summary>
  39. /// Returns a description of the switch
  40. /// </summary>
  41. public string Description
  42. {
  43. get
  44. {
  45. return desc;
  46. }
  47. }
  48. /// <summary>
  49. /// Returns a name used to identify the switch
  50. /// </summary>
  51. public string DisplayName
  52. {
  53. get
  54. {
  55. return display_name;
  56. }
  57. }
  58. /// <summary>
  59. /// Gets or sets the current setting for this switch
  60. /// </summary>
  61. protected int SwitchSetting
  62. {
  63. get
  64. {
  65. return iSwitch;
  66. }
  67. set
  68. {
  69. if(iSwitch != value)
  70. {
  71. iSwitch = value;
  72. OnSwitchSettingChanged();
  73. }
  74. }
  75. }
  76. /// <summary>
  77. /// Raises the SwitchSettingChanged event
  78. /// </summary>
  79. protected virtual void OnSwitchSettingChanged()
  80. {
  81. // TODO: implement me
  82. }
  83. }
  84. }