ConnectableWrongStateException.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/WayneLibraries/Wrk/Common/ConnectableWrongStateException.cs $
  4. *
  5. * 2 07-05-18 14:41 Mattias.larsson
  6. * Added comments.
  7. *
  8. * 1 07-05-03 10:48 Mattias.larsson
  9. * Added ConnectableWrongStateException.
  10. */
  11. #endregion
  12. using System;
  13. namespace Wayne.Lib
  14. {
  15. /// <summary>
  16. /// The wrong state of the connection to a device.
  17. /// </summary>
  18. public enum WrongDeviceConnectionState
  19. {
  20. #region Fields
  21. /// <summary>
  22. /// Device is not Disconnected.
  23. /// </summary>
  24. NotDisconnected,
  25. /// <summary>
  26. /// Device is not Connecting.
  27. /// </summary>
  28. NotConnecting,
  29. /// <summary>
  30. /// Device is not Connected.
  31. /// </summary>
  32. NotConnected,
  33. /// <summary>
  34. /// Device is not Disconnecting.
  35. /// </summary>
  36. NotDisconnecting
  37. #endregion
  38. }
  39. /// <summary>
  40. /// The ConnectableWrongStateException is thrown when trying to access an IConnectable-object that
  41. /// is is a wrong state.
  42. /// </summary>
  43. public class ConnectableWrongStateException : Exception
  44. {
  45. #region Fields
  46. WrongDeviceConnectionState wrongState;
  47. #endregion
  48. #region Construction
  49. /// <summary>
  50. /// Initializes a new instance of the class.
  51. /// </summary>
  52. public ConnectableWrongStateException(WrongDeviceConnectionState wrongState) { this.wrongState = wrongState; }
  53. /// <summary>
  54. /// Initializes a new instance of the class.
  55. /// </summary>
  56. public ConnectableWrongStateException(WrongDeviceConnectionState wrongState, string message) : base(message) { this.wrongState = wrongState; }
  57. /// <summary>
  58. /// Initializes a new instance of the class.
  59. /// </summary>
  60. public ConnectableWrongStateException(WrongDeviceConnectionState wrongState, string message, Exception inner) : base(message, inner) { this.wrongState = wrongState; }
  61. #endregion
  62. #region Properties
  63. /// <summary>
  64. /// The wrong state of the connection to a device.
  65. /// </summary>
  66. public WrongDeviceConnectionState WrongState
  67. {
  68. get { return wrongState; }
  69. }
  70. #endregion
  71. }
  72. }