MainWindow.xaml.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using MediaBrowser.Controller;
  16. using MediaBrowser.Model.Progress;
  17. namespace MediaBrowser.ServerApplication
  18. {
  19. /// <summary>
  20. /// Interaction logic for MainWindow.xaml
  21. /// </summary>
  22. public partial class MainWindow : Window
  23. {
  24. protected static Kernel kernel;
  25. public MainWindow()
  26. {
  27. InitializeComponent();
  28. LoadKernel();
  29. }
  30. private static void LoadKernel()
  31. {
  32. Progress<TaskProgress> progress = new Progress<TaskProgress>();
  33. SplashScreen splash = new SplashScreen(progress);
  34. try
  35. {
  36. DateTime now = DateTime.Now;
  37. splash.Show();
  38. kernel = new Kernel();
  39. kernel.Init(progress);
  40. var time = DateTime.Now - now;
  41. }
  42. catch
  43. {
  44. }
  45. finally
  46. {
  47. splash.Close();
  48. }
  49. }
  50. #region Main Window Events
  51. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  52. {
  53. // Don't show the system tray icon until the app has loaded.
  54. this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible;
  55. }
  56. private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  57. {
  58. kernel.Dispose();
  59. }
  60. #endregion
  61. #region Context Menu events
  62. private void cmOpenDashboard_click(object sender, RoutedEventArgs e)
  63. {
  64. }
  65. private void cmVisitCT_click(object sender, RoutedEventArgs e)
  66. {
  67. }
  68. private void cmExit_click(object sender, RoutedEventArgs e)
  69. {
  70. this.Close();
  71. }
  72. #endregion
  73. }
  74. }