IApplicationHost.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using MediaBrowser.Model.Updates;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Common.Kernel
  7. {
  8. /// <summary>
  9. /// An interface to be implemented by the applications hosting a kernel
  10. /// </summary>
  11. public interface IApplicationHost
  12. {
  13. /// <summary>
  14. /// Restarts this instance.
  15. /// </summary>
  16. void Restart();
  17. /// <summary>
  18. /// Gets the application version.
  19. /// </summary>
  20. /// <value>The application version.</value>
  21. Version ApplicationVersion { get; }
  22. /// <summary>
  23. /// Gets or sets a value indicating whether this instance can self update.
  24. /// </summary>
  25. /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
  26. bool CanSelfUpdate { get; }
  27. /// <summary>
  28. /// Gets a value indicating whether this instance is first run.
  29. /// </summary>
  30. /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
  31. bool IsFirstRun { get; }
  32. /// <summary>
  33. /// Gets the failed assemblies.
  34. /// </summary>
  35. /// <value>The failed assemblies.</value>
  36. List<string> FailedAssemblies { get; }
  37. /// <summary>
  38. /// Gets all concrete types.
  39. /// </summary>
  40. /// <value>All concrete types.</value>
  41. Type[] AllConcreteTypes { get; }
  42. /// <summary>
  43. /// Gets the exports.
  44. /// </summary>
  45. /// <typeparam name="T"></typeparam>
  46. /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
  47. /// <returns>IEnumerable{``0}.</returns>
  48. IEnumerable<T> GetExports<T>(bool manageLiftime = true);
  49. /// <summary>
  50. /// Checks for update.
  51. /// </summary>
  52. /// <returns>Task{CheckForUpdateResult}.</returns>
  53. Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress);
  54. /// <summary>
  55. /// Updates the application.
  56. /// </summary>
  57. /// <returns>Task.</returns>
  58. Task UpdateApplication(CancellationToken cancellationToken, IProgress<double> progress);
  59. /// <summary>
  60. /// Creates an instance of type and resolves all constructor dependancies
  61. /// </summary>
  62. /// <param name="type">The type.</param>
  63. /// <returns>System.Object.</returns>
  64. object CreateInstance(Type type);
  65. /// <summary>
  66. /// Resolves this instance.
  67. /// </summary>
  68. /// <typeparam name="T"></typeparam>
  69. /// <returns>``0.</returns>
  70. T Resolve<T>();
  71. /// <summary>
  72. /// Resolves this instance.
  73. /// </summary>
  74. /// <typeparam name="T"></typeparam>
  75. /// <returns>``0.</returns>
  76. T TryResolve<T>();
  77. /// <summary>
  78. /// Shuts down.
  79. /// </summary>
  80. void Shutdown();
  81. }
  82. }