diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-11 00:43:57 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-11 00:43:57 -0500 |
| commit | 68b3ca63837e572756e6670547ea2e27d995cbe3 (patch) | |
| tree | bc9629a21e7ed9779b5cf04474732962bb9e789b /Emby.Server.Core/Browser/BrowserLauncher.cs | |
| parent | b3f22fd05237e589d79e3f06de7e5db27effcc93 (diff) | |
update core project
Diffstat (limited to 'Emby.Server.Core/Browser/BrowserLauncher.cs')
| -rw-r--r-- | Emby.Server.Core/Browser/BrowserLauncher.cs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Emby.Server.Core/Browser/BrowserLauncher.cs b/Emby.Server.Core/Browser/BrowserLauncher.cs new file mode 100644 index 000000000..4ccc41c30 --- /dev/null +++ b/Emby.Server.Core/Browser/BrowserLauncher.cs @@ -0,0 +1,75 @@ +using MediaBrowser.Controller; +using System; + +namespace Emby.Server.Core.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"); + } + + public static void OpenEmbyPremiere(IServerApplicationHost appHost) + { + OpenDashboardPage("supporterkey.html", appHost); + } + + /// <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); + } + } + } +} |
