Exemple #1
0
        /// <summary>
        /// Register's the services needed by Perspex.
        /// </summary>
        protected virtual void RegisterServices()
        {
            PerspexSynchronizationContext.InstallIfNeeded();
            FocusManager = new FocusManager();
            InputManager = new InputManager();

            Locator.CurrentMutable.Register(() => new AccessKeyHandler(), typeof(IAccessKeyHandler));
            Locator.CurrentMutable.Register(() => this, typeof(IGlobalDataTemplates));
            Locator.CurrentMutable.Register(() => this, typeof(IGlobalStyles));
            Locator.CurrentMutable.Register(() => FocusManager, typeof(IFocusManager));
            Locator.CurrentMutable.Register(() => InputManager, typeof(IInputManager));
            Locator.CurrentMutable.Register(() => new KeyboardNavigationHandler(), typeof(IKeyboardNavigationHandler));
            Locator.CurrentMutable.Register(() => _styler, typeof(IStyler));
            Locator.CurrentMutable.Register(() => new LayoutManager(), typeof(ILayoutManager));
            Locator.CurrentMutable.Register(() => new RenderManager(), typeof(IRenderManager));
        }
Exemple #2
0
        /// <summary>
        /// Register's the services needed by Perspex.
        /// </summary>
        protected virtual void RegisterServices()
        {
            PerspexSynchronizationContext.InstallIfNeeded();
            FocusManager = new FocusManager();
            InputManager = new InputManager();

            PerspexLocator.CurrentMutable
                .Bind<IAccessKeyHandler>().ToTransient<AccessKeyHandler>()
                .Bind<IGlobalDataTemplates>().ToConstant(this)
                .Bind<IGlobalStyles>().ToConstant(this)
                .Bind<IFocusManager>().ToConstant(FocusManager)
                .Bind<IInputManager>().ToConstant(InputManager)
                .Bind<IKeyboardNavigationHandler>().ToTransient<KeyboardNavigationHandler>()
                .Bind<IStyler>().ToConstant(_styler)
                .Bind<ILayoutManager>().ToTransient<LayoutManager>()
                .Bind<IRenderQueueManager>().ToTransient<RenderQueueManager>();
        }