IOptBridge.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using Wayne.Lib;
  3. namespace Wayne.ForecourtControl.OptBridge
  4. {
  5. /// <summary>
  6. /// Root object for the Opt communication using a application-layer bridge. The interface provides functionality to
  7. /// get access to single Opts, and change the configuration.
  8. /// </summary>
  9. public interface IOptBridge : IConnectable, IIdentifiableEntity, IDisposable
  10. {
  11. #region Properties
  12. /// <summary>
  13. /// Collection of the currently configured Opts.
  14. /// </summary>
  15. System.Collections.ObjectModel.ReadOnlyCollection<IOpt> Opts { get;}
  16. /// <summary>
  17. /// The Client id that was specified in the connection string when connecting.
  18. /// </summary>
  19. int ClientId { get;}
  20. /// <summary>
  21. /// The Client name that was specified in the connection string when connecting.
  22. /// </summary>
  23. string ClientName { get;}
  24. #endregion
  25. #region Events
  26. /// <summary>
  27. /// Event that notifies clients that a Opt has been added or removed.
  28. /// </summary>
  29. event EventHandler OnConfigurationChanged;
  30. #endregion
  31. #region Methods
  32. /// <summary>
  33. /// Configure that the specified opt should be handled and polled. If the request completes sucessfully, the new
  34. /// Opt is added to the Opts collection.
  35. /// </summary>
  36. /// <param name="optId"></param>
  37. /// <param name="requestCompleted"></param>
  38. /// <param name="userToken"></param>
  39. void AddOptAsync(int optId, EventHandler<AsyncCompletedEventArgs> requestCompleted, object userToken);
  40. /// <summary>
  41. /// Remove the specified opt from the list of connected opts. If the request completes successfully, the
  42. /// Opts collection is modified.
  43. /// </summary>
  44. /// <param name="optId"></param>
  45. /// <param name="requestCompleted"></param>
  46. /// <param name="userToken"></param>
  47. void RemoveOptAsync(int optId, EventHandler<AsyncCompletedEventArgs> requestCompleted, object userToken);
  48. #endregion
  49. }
  50. }