jellyfin-server/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs
Sven Van den brande 219cba7506 Removed redundant Collection Initializers
Removed Using directives that are not required
2016-07-29 21:18:03 +02:00

71 lines
2.0 KiB
C#

using MediaBrowser.Controller;
using System;
namespace MediaBrowser.Server.Startup.Common.Browser
{
/// <summary>
/// Class BrowserLauncher
/// </summary>
public static class BrowserLauncher
{
/// <summary>
/// Opens the dashboard page.
/// </summary>
/// <param name="page">The page.</param>
/// <param name="appHost">The app host.</param>
public static void OpenDashboardPage(string page, IServerApplicationHost appHost)
{
var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
OpenUrl(appHost, url);
}
/// <summary>
/// Opens the community.
/// </summary>
public static void OpenCommunity(IServerApplicationHost appHost)
{
OpenUrl(appHost, "http://emby.media/community");
}
/// <summary>
/// Opens the web client.
/// </summary>
/// <param name="appHost">The app host.</param>
public static void OpenWebClient(IServerApplicationHost appHost)
{
OpenDashboardPage("index.html", appHost);
}
/// <summary>
/// Opens the dashboard.
/// </summary>
/// <param name="appHost">The app host.</param>
public static void OpenDashboard(IServerApplicationHost appHost)
{
OpenDashboardPage("dashboard.html", appHost);
}
/// <summary>
/// Opens the URL.
/// </summary>
/// <param name="url">The URL.</param>
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);
}
}
}
}