App.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Windows;
  5. using MediaBrowser.Common.Kernel;
  6. using MediaBrowser.Common.UI;
  7. using MediaBrowser.Controller;
  8. using Microsoft.Shell;
  9. namespace MediaBrowser.ServerApplication
  10. {
  11. /// <summary>
  12. /// Interaction logic for App.xaml
  13. /// </summary>
  14. public partial class App : BaseApplication, ISingleInstanceApp
  15. {
  16. private const string Unique = "MediaBrowser3";
  17. [STAThread]
  18. public static void Main()
  19. {
  20. if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
  21. {
  22. var application = new App();
  23. application.InitializeComponent();
  24. application.Run();
  25. // Allow single instance code to perform cleanup operations
  26. SingleInstance<App>.Cleanup();
  27. }
  28. }
  29. #region ISingleInstanceApp Members
  30. public bool SignalExternalCommandLineArgs(IList<string> args)
  31. {
  32. OpenDashboard();
  33. return true;
  34. }
  35. #endregion
  36. public static void OpenDashboard()
  37. {
  38. using (Process process = Process.Start("http://localhost:" + Kernel.Instance.Configuration.HttpServerPortNumber + "/mediabrowser/dashboard/index.html"))
  39. {
  40. }
  41. }
  42. protected override IKernel InstantiateKernel()
  43. {
  44. return new Kernel();
  45. }
  46. protected override Window InstantiateMainWindow()
  47. {
  48. return new MainWindow();
  49. }
  50. }
  51. }