2014-05-08 16:09:53 -04:00
|
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
|
using MediaBrowser.Model.Events;
|
2013-03-02 21:47:04 -05:00
|
|
|
|
using MediaBrowser.Model.Updates;
|
2013-02-21 23:23:06 -05:00
|
|
|
|
using System;
|
2013-02-24 16:53:54 -05:00
|
|
|
|
using System.Collections.Generic;
|
2013-02-21 23:23:06 -05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2013-03-04 00:43:06 -05:00
|
|
|
|
namespace MediaBrowser.Common
|
2013-02-21 20:26:35 -05:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// An interface to be implemented by the applications hosting a kernel
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IApplicationHost
|
|
|
|
|
{
|
2014-11-23 18:10:41 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the display name of the operating system.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The display name of the operating system.</value>
|
|
|
|
|
string OperatingSystemDisplayName { get; }
|
|
|
|
|
|
2014-01-25 16:07:19 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the name.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
string Name { get; }
|
|
|
|
|
|
2014-09-06 13:46:09 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the device identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The device identifier.</value>
|
|
|
|
|
string SystemId { get; }
|
|
|
|
|
|
2013-03-11 15:36:32 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [application updated].
|
|
|
|
|
/// </summary>
|
2014-04-30 11:07:02 -04:00
|
|
|
|
event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
|
2013-03-11 15:36:32 -04:00
|
|
|
|
|
2013-03-07 00:34:00 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether this instance has pending kernel reload.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value>
|
|
|
|
|
bool HasPendingRestart { get; }
|
|
|
|
|
|
2013-10-07 10:38:31 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value indicating whether this instance can self restart.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
|
|
|
|
bool CanSelfRestart { get; }
|
|
|
|
|
|
2013-03-07 00:34:00 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [has pending restart changed].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler HasPendingRestartChanged;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Notifies the pending restart.
|
|
|
|
|
/// </summary>
|
|
|
|
|
void NotifyPendingRestart();
|
|
|
|
|
|
2013-02-21 20:26:35 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Restarts this instance.
|
|
|
|
|
/// </summary>
|
2013-09-20 13:32:10 -04:00
|
|
|
|
Task Restart();
|
2013-02-21 20:26:35 -05:00
|
|
|
|
|
2013-02-25 22:43:04 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the application version.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The application version.</value>
|
|
|
|
|
Version ApplicationVersion { get; }
|
|
|
|
|
|
2013-02-21 23:23:06 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether this instance can self update.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
|
|
|
|
bool CanSelfUpdate { get; }
|
|
|
|
|
|
2013-02-25 22:43:04 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value indicating whether this instance is first run.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
|
|
|
|
|
bool IsFirstRun { get; }
|
|
|
|
|
|
2013-02-24 16:53:54 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the failed assemblies.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The failed assemblies.</value>
|
2013-02-25 22:43:04 -05:00
|
|
|
|
List<string> FailedAssemblies { get; }
|
2013-02-24 16:53:54 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all concrete types.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>All concrete types.</value>
|
|
|
|
|
Type[] AllConcreteTypes { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the exports.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
|
|
|
|
|
/// <returns>IEnumerable{``0}.</returns>
|
|
|
|
|
IEnumerable<T> GetExports<T>(bool manageLiftime = true);
|
|
|
|
|
|
2013-02-21 23:23:06 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks for update.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Task{CheckForUpdateResult}.</returns>
|
|
|
|
|
Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the application.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Task.</returns>
|
2013-02-28 16:03:59 -05:00
|
|
|
|
Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress<double> progress);
|
2013-02-22 22:49:00 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves this instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <returns>``0.</returns>
|
2013-02-23 02:57:11 -05:00
|
|
|
|
T Resolve<T>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves this instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <returns>``0.</returns>
|
|
|
|
|
T TryResolve<T>();
|
2013-02-26 11:10:55 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Shuts down.
|
|
|
|
|
/// </summary>
|
2013-09-20 13:32:10 -04:00
|
|
|
|
Task Shutdown();
|
2013-03-02 21:47:04 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the plugins.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The plugins.</value>
|
2016-10-23 15:14:57 -04:00
|
|
|
|
IPlugin[] Plugins { get; }
|
2013-03-02 21:47:04 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes the plugin.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="plugin">The plugin.</param>
|
|
|
|
|
void RemovePlugin(IPlugin plugin);
|
2013-03-03 02:27:40 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Inits this instance.
|
|
|
|
|
/// </summary>
|
2013-12-13 10:48:35 -05:00
|
|
|
|
/// <param name="progress">The progress.</param>
|
2013-03-03 02:27:40 -05:00
|
|
|
|
/// <returns>Task.</returns>
|
2013-12-13 10:48:35 -05:00
|
|
|
|
Task Init(IProgress<double> progress);
|
2013-10-03 10:14:40 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates the instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type">The type.</param>
|
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
|
object CreateInstance(Type type);
|
2017-04-09 21:51:36 -04:00
|
|
|
|
|
|
|
|
|
PackageVersionClass SystemUpdateLevel { get; }
|
2013-02-21 20:26:35 -05:00
|
|
|
|
}
|
|
|
|
|
}
|