using Aitex.Core.RT.Log;
using Aitex.Core.Util;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Unity;
using System;
using System.Threading;
using System.Windows;
using System.Windows.Media.Animation;
using Venus_UI.Views;
using WPF.Themes.UserControls;
using System.Configuration;
namespace Venus_UI
{
///
/// App.xaml 的交互逻辑
///
public partial class App : PrismApplication
{
protected override void OnStartup(StartupEventArgs e)
{
Mutex mutex;
bool ret;
mutex = new Mutex(true, "Venus_UI", out ret);
if (!ret)
{
WPFMessageBox.ShowError("Only One Venus_UI is allowed");
Environment.Exit(0);
}
FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;
DispatcherUnhandledException += App_DispatcherUnhandledException;
Singleton.Instance.Initialize();
var TimelineDesiredFrameRate =Convert.ToInt32( ConfigurationManager.AppSettings["TimelineDesiredFrameRate"]);
Timeline.DesiredFrameRateProperty.OverrideMetadata(
typeof(Timeline),
new FrameworkPropertyMetadata { DefaultValue = TimelineDesiredFrameRate }
);
base.OnStartup(e);
}
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
LOG.Info("UI程序异常." + e.Exception.Message);
e.Handled = true;
}
protected override Window CreateShell()
{
return Container.Resolve();
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
}
protected override IModuleCatalog CreateModuleCatalog()
{
return new ConfigurationModuleCatalog();
}
}
}