App.xaml.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Prism.Ioc;
  2. using Prism.Modularity;
  3. using Prism.Unity;
  4. using System;
  5. using System.Threading;
  6. using System.Windows;
  7. using CyberX8_MainPages.Views;
  8. using CyberX8_UI.Views;
  9. using WPF.Themes.UserControls;
  10. namespace CyberX8_UI
  11. {
  12. /// <summary>
  13. /// App.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class App : PrismApplication
  16. {
  17. System.Threading.Mutex mutex;
  18. protected override void OnStartup(StartupEventArgs e)
  19. {
  20. bool ret;
  21. mutex = new System.Threading.Mutex(true, "CyberX8_UI", out ret);
  22. if (!ret)
  23. {
  24. WPFMessageBox.ShowError("Only One CyberX8_UI is allowed");
  25. Environment.Exit(0);
  26. }
  27. base.OnStartup(e);
  28. }
  29. protected override Window CreateShell()
  30. {
  31. return Container.Resolve<ShellView>();
  32. }
  33. protected override void RegisterTypes(IContainerRegistry containerRegistry)
  34. {
  35. }
  36. protected override IModuleCatalog CreateModuleCatalog()
  37. {
  38. return new ConfigurationModuleCatalog();
  39. }
  40. }
  41. }