jellyfin/MediaBrowser.ServerApplication/App.xaml.cs

69 lines
1.7 KiB
C#
Raw Normal View History

2012-09-13 13:13:43 -07:00
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.UI;
using MediaBrowser.Controller;
2012-09-13 13:13:43 -07:00
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
namespace MediaBrowser.ServerApplication
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
2012-09-13 13:13:43 -07:00
public partial class App : BaseApplication, IApplication
{
[STAThread]
public static void Main()
{
2012-09-13 13:13:43 -07:00
RunApplication<App>("MediaBrowserServer");
}
2012-09-11 12:37:14 -07:00
2012-09-13 13:13:43 -07:00
protected override void OnSecondInstanceLaunched(IList<string> args)
{
2012-09-13 13:13:43 -07:00
base.OnSecondInstanceLaunched(args);
2012-09-13 13:13:43 -07:00
OpenDashboard();
InitializeComponent();
}
public static void OpenDashboard()
{
2012-09-11 12:37:14 -07:00
OpenUrl("http://localhost:" + Kernel.Instance.Configuration.HttpServerPortNumber +
"/mediabrowser/dashboard/index.html");
}
public static void OpenUrl(string url)
{
var process = new Process
{
2012-09-11 12:37:14 -07:00
StartInfo = new ProcessStartInfo
{
FileName = url
},
EnableRaisingEvents = true
};
process.Exited += ProcessExited;
process.Start();
}
static void ProcessExited(object sender, EventArgs e)
{
(sender as Process).Dispose();
}
protected override IKernel InstantiateKernel()
{
return new Kernel();
}
protected override Window InstantiateMainWindow()
{
return new MainWindow();
}
}
}