using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using System.Linq;
namespace MediaBrowser.ServerApplication
{
///
/// Class StartupWizard
///
public class StartupWizard : IServerEntryPoint
{
///
/// The _app host
///
private readonly IApplicationHost _appHost;
///
/// The _user manager
///
private readonly IUserManager _userManager;
private readonly IConfigurationManager _configurationManager;
///
/// Initializes a new instance of the class.
///
/// The app host.
/// The user manager.
public StartupWizard(IApplicationHost appHost, IUserManager userManager, IConfigurationManager configurationManager)
{
_appHost = appHost;
_userManager = userManager;
_configurationManager = configurationManager;
}
///
/// Runs this instance.
///
public void Run()
{
if (_appHost.IsFirstRun)
{
LaunchStartupWizard();
}
}
///
/// Launches the startup wizard.
///
private void LaunchStartupWizard()
{
var user = _userManager.Users.FirstOrDefault(u => u.Configuration.IsAdministrator);
App.OpenDashboardPage("wizardStart.html", user, _configurationManager);
}
///
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
///
public void Dispose()
{
}
}
}