/// <summary> /// StartUp event handler for applications to use. /// Loads Nova's resource dictionaries into the application's resource dictionary. /// </summary> /// <param name="sender">The application</param> /// <param name="startupEventArgs">Start up event arguments. These aren't used.</param> public static void Initialize(object sender, StartupEventArgs startupEventArgs) { var app = sender as Application; if (app == null) return; app.Startup -= Initialize; var currentThread = Thread.CurrentThread; if (!string.IsNullOrEmpty(currentThread.Name)) { currentThread.Name = "Nova GUI Thread"; } CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CurrentUICulture; app.DispatcherUnhandledException += ExceptionHandler.DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += ExceptionHandler.UnhandledException; InitiateEventHandlers(); var nova = new NovaFramework(); foreach (var dictionary in nova.MergedDictionaries) { app.Resources.MergedDictionaries.Add(dictionary); } }
/// <summary> /// StartUp event handler for applications to use. /// Loads Nova's resource dictionaries into the application's resource dictionary. /// </summary> /// <param name="sender">The application</param> /// <param name="startupEventArgs">Start up event arguments. These aren't used.</param> public static void Initialize(object sender, StartupEventArgs startupEventArgs) { var app = sender as Application; if (app == null) { return; } app.Startup -= Initialize; var currentThread = Thread.CurrentThread; if (!string.IsNullOrEmpty(currentThread.Name)) { currentThread.Name = "Nova GUI Thread"; } CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CurrentUICulture; app.DispatcherUnhandledException += ExceptionHandler.DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += ExceptionHandler.UnhandledException; InitiateEventHandlers(); var nova = new NovaFramework(); foreach (var dictionary in nova.MergedDictionaries) { app.Resources.MergedDictionaries.Add(dictionary); } }