IApplicationHost.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using MediaBrowser.Model.Updates;
  2. using System;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. namespace MediaBrowser.Common.Kernel
  6. {
  7. /// <summary>
  8. /// An interface to be implemented by the applications hosting a kernel
  9. /// </summary>
  10. public interface IApplicationHost
  11. {
  12. /// <summary>
  13. /// Restarts this instance.
  14. /// </summary>
  15. void Restart();
  16. /// <summary>
  17. /// Reloads the logger.
  18. /// </summary>
  19. void ReloadLogger();
  20. /// <summary>
  21. /// Gets the log file path.
  22. /// </summary>
  23. /// <value>The log file path.</value>
  24. string LogFilePath { get; }
  25. /// <summary>
  26. /// Gets or sets a value indicating whether this instance can self update.
  27. /// </summary>
  28. /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
  29. bool CanSelfUpdate { get; }
  30. /// <summary>
  31. /// Checks for update.
  32. /// </summary>
  33. /// <returns>Task{CheckForUpdateResult}.</returns>
  34. Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress);
  35. /// <summary>
  36. /// Updates the application.
  37. /// </summary>
  38. /// <returns>Task.</returns>
  39. Task UpdateApplication(CancellationToken cancellationToken, IProgress<double> progress);
  40. /// <summary>
  41. /// Creates an instance of type and resolves all constructor dependancies
  42. /// </summary>
  43. /// <param name="type">The type.</param>
  44. /// <returns>System.Object.</returns>
  45. object CreateInstance(Type type);
  46. /// <summary>
  47. /// Registers a service that other classes can use as a dependancy.
  48. /// </summary>
  49. /// <typeparam name="T"></typeparam>
  50. /// <param name="obj">The obj.</param>
  51. void Register<T>(T obj) where T : class;
  52. /// <summary>
  53. /// Resolves this instance.
  54. /// </summary>
  55. /// <typeparam name="T"></typeparam>
  56. /// <returns>``0.</returns>
  57. T Resolve<T>() where T : class;
  58. }
  59. }