2012-08-04 23:54:00 +00:00
|
|
|
|
using System;
|
2012-08-12 18:12:59 +00:00
|
|
|
|
using System.Diagnostics;
|
2012-08-04 23:54:00 +00:00
|
|
|
|
using System.Windows;
|
2012-08-18 19:38:27 +00:00
|
|
|
|
using MediaBrowser.Common.Logging;
|
2012-08-19 20:38:31 +00:00
|
|
|
|
using MediaBrowser.Common.UI;
|
2012-08-05 00:10:44 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
using MediaBrowser.Model.Progress;
|
|
|
|
|
|
2012-08-04 23:54:00 +00:00
|
|
|
|
namespace MediaBrowser.ServerApplication
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2012-08-05 00:10:44 +00:00
|
|
|
|
LoadKernel();
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-19 15:58:35 +00:00
|
|
|
|
private async void LoadKernel()
|
2012-08-05 00:10:44 +00:00
|
|
|
|
{
|
|
|
|
|
Progress<TaskProgress> progress = new Progress<TaskProgress>();
|
2012-08-19 15:58:35 +00:00
|
|
|
|
Splash splash = new Splash(progress);
|
2012-08-05 00:10:44 +00:00
|
|
|
|
|
2012-08-17 13:16:50 +00:00
|
|
|
|
splash.Show();
|
|
|
|
|
|
2012-08-05 00:10:44 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
2012-08-18 19:38:27 +00:00
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
|
2012-08-19 15:58:35 +00:00
|
|
|
|
await new Kernel().Init(progress);
|
2012-08-18 19:38:27 +00:00
|
|
|
|
|
|
|
|
|
double seconds = (DateTime.Now - now).TotalSeconds;
|
|
|
|
|
|
|
|
|
|
Logger.LogInfo("Kernel.Init completed in {0} seconds.", seconds);
|
2012-08-19 15:58:35 +00:00
|
|
|
|
|
|
|
|
|
// Don't show the system tray icon until the kernel finishes.
|
|
|
|
|
this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible;
|
2012-08-05 00:10:44 +00:00
|
|
|
|
}
|
2012-08-05 01:25:28 +00:00
|
|
|
|
catch (Exception ex)
|
2012-08-05 00:10:44 +00:00
|
|
|
|
{
|
2012-08-17 13:16:50 +00:00
|
|
|
|
MessageBox.Show("There was an error launching Media Browser Server: " + ex.Message);
|
2012-08-18 19:38:27 +00:00
|
|
|
|
Close();
|
2012-08-05 00:10:44 +00:00
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
splash.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Context Menu events
|
|
|
|
|
|
|
|
|
|
private void cmOpenDashboard_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2012-08-05 16:09:45 +00:00
|
|
|
|
App.OpenDashboard();
|
2012-08-04 23:54:00 +00:00
|
|
|
|
}
|
2012-08-05 00:10:44 +00:00
|
|
|
|
|
|
|
|
|
private void cmVisitCT_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2012-08-12 18:12:59 +00:00
|
|
|
|
using (Process process = Process.Start("http://community.mediabrowser.tv/"))
|
|
|
|
|
{
|
|
|
|
|
}
|
2012-08-05 00:10:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmExit_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2012-08-04 23:54:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|