App.xaml.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 System.Windows.Media.Animation;
  11. using Venus_MainPages.Roles;
  12. using Venus_MainPages.Views;
  13. using Venus_UI.Views;
  14. using WPF.Themes.UserControls;
  15. namespace Venus_UI
  16. {
  17. /// <summary>
  18. /// App.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class App : PrismApplication
  21. {
  22. System.Threading.Mutex mutex;
  23. protected override void OnStartup(StartupEventArgs e)
  24. {
  25. bool ret;
  26. mutex = new System.Threading.Mutex(true, "Venus_UI", out ret);
  27. if (!ret)
  28. {
  29. WPFMessageBox.ShowError("Only One Venus_UI is allowed");
  30. Environment.Exit(0);
  31. }
  32. FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;
  33. DispatcherUnhandledException += App_DispatcherUnhandledException;
  34. Singleton<LogManager>.Instance.Initialize();
  35. //LoginView loginView = new LoginView();
  36. //loginView.ShowDialog();
  37. //CurrentUser = loginView.CurrentUser;
  38. //if (!loginView.IsLoginSuccess)
  39. //{
  40. // Current.Shutdown();
  41. // return;
  42. //}
  43. //Timeline.DesiredFrameRateProperty.OverrideMetadata(
  44. //typeof(Timeline),
  45. //new FrameworkPropertyMetadata { DefaultValue = 20 }
  46. //);
  47. base.OnStartup(e);
  48. }
  49. void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
  50. {
  51. //MessageBox.Show("程序异常." + Environment.NewLine + e.Exception.Message);
  52. e.Handled = true;
  53. }
  54. protected override Window CreateShell()
  55. {
  56. return Container.Resolve<ShellView>();
  57. }
  58. protected override void RegisterTypes(IContainerRegistry containerRegistry)
  59. {
  60. }
  61. protected override IModuleCatalog CreateModuleCatalog()
  62. {
  63. return new ConfigurationModuleCatalog();
  64. }
  65. }
  66. }