|
@@ -15,87 +15,58 @@ namespace MediaBrowser.Server.Startup.Common.Browser
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="page">The page.</param>
|
|
/// <param name="page">The page.</param>
|
|
/// <param name="appHost">The app host.</param>
|
|
/// <param name="appHost">The app host.</param>
|
|
- /// <param name="logger">The logger.</param>
|
|
|
|
- public static void OpenDashboardPage(string page, IServerApplicationHost appHost, ILogger logger)
|
|
|
|
|
|
+ public static void OpenDashboardPage(string page, IServerApplicationHost appHost)
|
|
{
|
|
{
|
|
var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
|
|
var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
|
|
|
|
|
|
- OpenUrl(url, logger);
|
|
|
|
|
|
+ OpenUrl(appHost, url);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Opens the community.
|
|
/// Opens the community.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="logger">The logger.</param>
|
|
|
|
- public static void OpenCommunity(ILogger logger)
|
|
|
|
|
|
+ public static void OpenCommunity(IServerApplicationHost appHost)
|
|
{
|
|
{
|
|
- OpenUrl("http://emby.media/community", logger);
|
|
|
|
|
|
+ OpenUrl(appHost, "http://emby.media/community");
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Opens the web client.
|
|
/// Opens the web client.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="appHost">The app host.</param>
|
|
/// <param name="appHost">The app host.</param>
|
|
- /// <param name="logger">The logger.</param>
|
|
|
|
- public static void OpenWebClient(IServerApplicationHost appHost, ILogger logger)
|
|
|
|
|
|
+ public static void OpenWebClient(IServerApplicationHost appHost)
|
|
{
|
|
{
|
|
- OpenDashboardPage("index.html", appHost, logger);
|
|
|
|
|
|
+ OpenDashboardPage("index.html", appHost);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Opens the dashboard.
|
|
/// Opens the dashboard.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="appHost">The app host.</param>
|
|
/// <param name="appHost">The app host.</param>
|
|
- /// <param name="logger">The logger.</param>
|
|
|
|
- public static void OpenDashboard(IServerApplicationHost appHost, ILogger logger)
|
|
|
|
|
|
+ public static void OpenDashboard(IServerApplicationHost appHost)
|
|
{
|
|
{
|
|
- OpenDashboardPage("dashboard.html", appHost, logger);
|
|
|
|
|
|
+ OpenDashboardPage("dashboard.html", appHost);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Opens the URL.
|
|
/// Opens the URL.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="url">The URL.</param>
|
|
/// <param name="url">The URL.</param>
|
|
- /// <param name="logger">The logger.</param>
|
|
|
|
- private static void OpenUrl(string url, ILogger logger)
|
|
|
|
|
|
+ private static void OpenUrl(IServerApplicationHost appHost, string url)
|
|
{
|
|
{
|
|
- var process = new Process
|
|
|
|
- {
|
|
|
|
- StartInfo = new ProcessStartInfo
|
|
|
|
- {
|
|
|
|
- FileName = url
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- EnableRaisingEvents = true,
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- process.Exited += ProcessExited;
|
|
|
|
-
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- process.Start();
|
|
|
|
|
|
+ appHost.LaunchUrl(url);
|
|
|
|
+ }
|
|
|
|
+ catch (NotImplementedException)
|
|
|
|
+ {
|
|
|
|
+
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
- logger.ErrorException("Error launching url: {0}", ex, url);
|
|
|
|
-
|
|
|
|
- Console.WriteLine("Error launching url: {0}", ex.Message);
|
|
|
|
|
|
+ Console.WriteLine("Error launching url: " + url);
|
|
Console.WriteLine(ex.Message);
|
|
Console.WriteLine(ex.Message);
|
|
-
|
|
|
|
-//#if !__MonoCS__
|
|
|
|
-// System.Windows.Forms.MessageBox.Show("There was an error launching your web browser. Please check your default browser settings.");
|
|
|
|
-//#endif
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- /// Processes the exited.
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="sender">The sender.</param>
|
|
|
|
- /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
|
|
|
- private static void ProcessExited(object sender, EventArgs e)
|
|
|
|
- {
|
|
|
|
- ((Process)sender).Dispose();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|