MainWindow.xaml.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Diagnostics;
  3. using System.Windows;
  4. using MediaBrowser.Controller;
  5. using MediaBrowser.Model.Progress;
  6. namespace MediaBrowser.ServerApplication
  7. {
  8. /// <summary>
  9. /// Interaction logic for MainWindow.xaml
  10. /// </summary>
  11. public partial class MainWindow : Window
  12. {
  13. public MainWindow()
  14. {
  15. InitializeComponent();
  16. LoadKernel();
  17. }
  18. private void LoadKernel()
  19. {
  20. Progress<TaskProgress> progress = new Progress<TaskProgress>();
  21. Common.UI.Splash splash = new Common.UI.Splash(progress);
  22. splash.Show();
  23. try
  24. {
  25. new Kernel().Init(progress);
  26. }
  27. catch (Exception ex)
  28. {
  29. MessageBox.Show("There was an error launching Media Browser Server: " + ex.Message);
  30. }
  31. finally
  32. {
  33. splash.Close();
  34. }
  35. }
  36. #region Main Window Events
  37. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  38. {
  39. // Don't show the system tray icon until the app has loaded.
  40. this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible;
  41. }
  42. #endregion
  43. #region Context Menu events
  44. private void cmOpenDashboard_click(object sender, RoutedEventArgs e)
  45. {
  46. App.OpenDashboard();
  47. }
  48. private void cmVisitCT_click(object sender, RoutedEventArgs e)
  49. {
  50. using (Process process = Process.Start("http://community.mediabrowser.tv/"))
  51. {
  52. }
  53. }
  54. private void cmExit_click(object sender, RoutedEventArgs e)
  55. {
  56. this.Close();
  57. }
  58. #endregion
  59. }
  60. }