App.xaml.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Aitex.Core.RT.Log;
  2. using Aitex.Core.Util;
  3. using Prism.Ioc;
  4. using Prism.Modularity;
  5. using Prism.Services.Dialogs;
  6. using Prism.Unity;
  7. using System;
  8. using System.Threading;
  9. using System.Windows;
  10. using Venus_MainPages.Roles;
  11. using Venus_MainPages.Views;
  12. using Venus_UI.Views;
  13. using WPF.Themes.UserControls;
  14. namespace Venus_UI
  15. {
  16. /// <summary>
  17. /// App.xaml 的交互逻辑
  18. /// </summary>
  19. public partial class App : PrismApplication
  20. {
  21. System.Threading.Mutex mutex;
  22. protected override void OnStartup(StartupEventArgs e)
  23. {
  24. bool ret;
  25. mutex = new System.Threading.Mutex(true, "Venus_UI", out ret);
  26. if (!ret)
  27. {
  28. WPFMessageBox.ShowError("Only One Venus_UI is allowed");
  29. Environment.Exit(0);
  30. }
  31. FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;
  32. DispatcherUnhandledException += App_DispatcherUnhandledException;
  33. Singleton<LogManager>.Instance.Initialize();
  34. //LoginView loginView = new LoginView();
  35. //loginView.ShowDialog();
  36. //CurrentUser = loginView.CurrentUser;
  37. //if (!loginView.IsLoginSuccess)
  38. //{
  39. // Current.Shutdown();
  40. // return;
  41. //}
  42. base.OnStartup(e);
  43. }
  44. void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
  45. {
  46. //MessageBox.Show("程序异常." + Environment.NewLine + e.Exception.Message);
  47. e.Handled = true;
  48. }
  49. protected override Window CreateShell()
  50. {
  51. return Container.Resolve<ShellView>();
  52. }
  53. protected override void RegisterTypes(IContainerRegistry containerRegistry)
  54. {
  55. }
  56. protected override IModuleCatalog CreateModuleCatalog()
  57. {
  58. return new ConfigurationModuleCatalog();
  59. }
  60. }
  61. }