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