/// <summary> /// Start the framework. /// </summary> protected void Initialize() { if (_isInitialized) { return; } _isInitialized = true; UIContext.Initialize(new ViewAdapter()); try { if (!ViewHelper.IsInDesignTool) { PrepareApplication(); } Configure(); } catch { _isInitialized = false; throw; } }
/// <summary> /// Initialize the framework. /// </summary> public void Initialize() { if (_isInitialized) { return; } _isInitialized = true; try { Application = Application.Current; if (Application != null) { PrepareApplication(); } else { UIContext.Initialize(new ViewAdapter()); } Configure(); } catch { _isInitialized = false; throw; } }
/// <summary> /// Invoked when the application creates a window. /// </summary> /// <param name="args">Event data for the event.</param> protected override void OnWindowCreated(WindowCreatedEventArgs args) { base.OnWindowCreated(args); // Because dispatchers are tied to windows Execute will fail in // scenarios when the app has multiple windows open (though contract // activation, this keeps Excute up to date with the currently activated window args.Window.Activated += (s, e) => UIContext.Initialize(new ViewAdapter()); }
private void OnStartup(object sender, StartupEventArgs e) { UIContext.Initialize(new ViewAdapter()); OnStartup(e); }