App.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. using Aitex.Core.Util;
  11. using Aitex.Core.RT.Log;
  12. using Aitex.Common.Util;
  13. namespace CyberX8_UI
  14. {
  15. /// <summary>
  16. /// App.xaml 的交互逻辑
  17. /// </summary>
  18. public partial class App : PrismApplication
  19. {
  20. System.Threading.Mutex mutex;
  21. protected override void OnStartup(StartupEventArgs e)
  22. {
  23. bool ret;
  24. mutex = new System.Threading.Mutex(true, "CyberX8_UI", out ret);
  25. if (!ret)
  26. {
  27. WPFMessageBox.ShowError("Only One CyberX8_UI is allowed");
  28. Environment.Exit(0);
  29. }
  30. LogDefineManager.Initialize(PathManager.GetCfgDir() + "LogDefine.json");
  31. Singleton<LogManager>.Instance.Initialize();
  32. base.OnStartup(e);
  33. }
  34. protected override Window CreateShell()
  35. {
  36. return Container.Resolve<ShellView>();
  37. }
  38. protected override void RegisterTypes(IContainerRegistry containerRegistry)
  39. {
  40. }
  41. protected override IModuleCatalog CreateModuleCatalog()
  42. {
  43. return new ConfigurationModuleCatalog();
  44. }
  45. }
  46. }