using MediaBrowser.Common.Events;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Updates;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Common
{
///
/// An interface to be implemented by the applications hosting a kernel
///
public interface IApplicationHost
{
///
/// Gets the name.
///
/// The name.
string Name { get; }
///
/// Occurs when [application updated].
///
event EventHandler> ApplicationUpdated;
///
/// Gets a value indicating whether this instance is running as service.
///
/// true if this instance is running as service; otherwise, false.
bool IsRunningAsService { get; }
///
/// Gets or sets a value indicating whether this instance has pending kernel reload.
///
/// true if this instance has pending kernel reload; otherwise, false.
bool HasPendingRestart { get; }
///
/// Gets a value indicating whether this instance can self restart.
///
/// true if this instance can self restart; otherwise, false.
bool CanSelfRestart { get; }
///
/// Occurs when [has pending restart changed].
///
event EventHandler HasPendingRestartChanged;
///
/// Notifies the pending restart.
///
void NotifyPendingRestart();
///
/// Restarts this instance.
///
Task Restart();
///
/// Gets the application version.
///
/// The application version.
Version ApplicationVersion { get; }
///
/// Gets or sets a value indicating whether this instance can self update.
///
/// true if this instance can self update; otherwise, false.
bool CanSelfUpdate { get; }
///
/// Gets a value indicating whether this instance is first run.
///
/// true if this instance is first run; otherwise, false.
bool IsFirstRun { get; }
///
/// Gets the failed assemblies.
///
/// The failed assemblies.
List FailedAssemblies { get; }
///
/// Gets all concrete types.
///
/// All concrete types.
Type[] AllConcreteTypes { get; }
///
/// Gets the exports.
///
///
/// if set to true [manage liftime].
/// IEnumerable{``0}.
IEnumerable GetExports(bool manageLiftime = true);
///
/// Checks for update.
///
/// Task{CheckForUpdateResult}.
Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress);
///
/// Updates the application.
///
/// Task.
Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress progress);
///
/// Resolves this instance.
///
///
/// ``0.
T Resolve();
///
/// Resolves this instance.
///
///
/// ``0.
T TryResolve();
///
/// Shuts down.
///
Task Shutdown();
///
/// Gets the plugins.
///
/// The plugins.
IEnumerable Plugins { get; }
///
/// Removes the plugin.
///
/// The plugin.
void RemovePlugin(IPlugin plugin);
///
/// Inits this instance.
///
/// The progress.
/// Task.
Task Init(IProgress progress);
///
/// Creates the instance.
///
/// The type.
/// System.Object.
object CreateInstance(Type type);
}
public interface IDependencyContainer
{
void RegisterSingleInstance(T obj, bool manageLifetime = true)
where T : class;
void RegisterSingleInstance(Func func)
where T : class;
void Register(Type typeInterface, Type typeImplementation);
}
}