using MediaBrowser.Controller;
using System;
namespace Emby.Server.Core.Browser
{
///
/// Class BrowserLauncher
///
public static class BrowserLauncher
{
///
/// Opens the dashboard page.
///
/// The page.
/// The app host.
public static void OpenDashboardPage(string page, IServerApplicationHost appHost)
{
var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
OpenUrl(appHost, url);
}
///
/// Opens the community.
///
public static void OpenCommunity(IServerApplicationHost appHost)
{
OpenUrl(appHost, "http://emby.media/community");
}
public static void OpenEmbyPremiere(IServerApplicationHost appHost)
{
OpenDashboardPage("supporterkey.html", appHost);
}
///
/// Opens the web client.
///
/// The app host.
public static void OpenWebClient(IServerApplicationHost appHost)
{
OpenDashboardPage("index.html", appHost);
}
///
/// Opens the dashboard.
///
/// The app host.
public static void OpenDashboard(IServerApplicationHost appHost)
{
OpenDashboardPage("dashboard.html", appHost);
}
///
/// Opens the URL.
///
/// The URL.
private static void OpenUrl(IServerApplicationHost appHost, string url)
{
try
{
appHost.LaunchUrl(url);
}
catch (NotImplementedException)
{
}
catch (Exception ex)
{
Console.WriteLine("Error launching url: " + url);
Console.WriteLine(ex.Message);
}
}
}
}