Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

45 linhas
1.3 KiB

  1. using System;
  2. namespace ThunderboltTimeSync.TimeProviders {
  3. /// <summary>
  4. /// Called when the time provider has a new time and date available.
  5. /// </summary>
  6. /// <param name="time">The current time and date, according to the time provider.</param>
  7. public delegate void TimeAvailableEventHandler(DateTime dateTime);
  8. /// <summary>
  9. /// Called when the time provider wishes to log a message or an error.
  10. /// </summary>
  11. /// <param name="message">The message for the log.</param>
  12. /// <param name="isError">True if the message constitutes an error, false otherwise.</param>
  13. public delegate void LogEventHandler(string message, LogLevel logLevel);
  14. public enum LogLevel {
  15. Info,
  16. Warning,
  17. Error
  18. }
  19. public interface ITimeProvider {
  20. /// <summary>
  21. /// Called when the time provider has a new time and date available.
  22. /// </summary>
  23. event TimeAvailableEventHandler TimeAvailable;
  24. /// <summary>
  25. /// Called when the time provider wishes to log a message or an error.
  26. /// </summary>
  27. event LogEventHandler Log;
  28. /// <summary>
  29. /// Begins providing time information by firing the TimeAvailable event, and log information through the Log event.
  30. /// </summary>
  31. void Start();
  32. /// <summary>
  33. /// Stops providing time information through the TimeAvailable event, and log information through the Log event.
  34. /// </summary>
  35. void Stop();
  36. }
  37. }