コード例 #1
0
        void DoInitialize(Action <AvaloniaNativeOptions> configure)
        {
            var opts = new AvaloniaNativeOptions(_factory);

            configure?.Invoke(opts);
            _factory.Initialize();

            AvaloniaLocator.CurrentMutable
            .Bind <IStandardCursorFactory>().ToTransient <CursorFactoryStub>()
            .Bind <IPlatformIconLoader>().ToSingleton <IconLoader>()

            .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice)
            .Bind <IMouseDevice>().ToConstant(MouseDevice)
            .Bind <IPlatformSettings>().ToConstant(this)
            .Bind <IWindowingPlatform>().ToConstant(this)
            .Bind <IClipboard>().ToSingleton <ClipboardImpl>()
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
            .Bind <ISystemDialogImpl>().ToConstant(new SystemDialogs(_factory.CreateSystemDialogs()))
            .Bind <IPlatformThreadingInterface>().ToConstant(new PlatformThreadingInterface(_factory.CreatePlatformThreadingInterface()));
        }
コード例 #2
0
        void DoInitialize(Action <AvaloniaNativeOptions> configure)
        {
            var opts = new AvaloniaNativeOptions(_factory);

            configure?.Invoke(opts);
            _factory.Initialize();

            AvaloniaLocator.CurrentMutable
            .Bind <IPlatformThreadingInterface>().ToConstant(new PlatformThreadingInterface(_factory.CreatePlatformThreadingInterface()))
            .Bind <IStandardCursorFactory>().ToConstant(new CursorFactory(_factory.CreateCursorFactory()))
            .Bind <IPlatformIconLoader>().ToSingleton <IconLoader>()
            .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice)
            .Bind <IMouseDevice>().ToConstant(MouseDevice)
            .Bind <IPlatformSettings>().ToConstant(this)
            .Bind <IWindowingPlatform>().ToConstant(this)
            .Bind <IClipboard>().ToConstant(new ClipboardImpl(_factory.CreateClipboard()))
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
            .Bind <ISystemDialogImpl>().ToConstant(new SystemDialogs(_factory.CreateSystemDialogs()))
            .Bind <IWindowingPlatformGlFeature>().ToConstant(new GlPlatformFeature(_factory.ObtainGlFeature()))
            .Bind <PlatformHotkeyConfiguration>().ToConstant(new PlatformHotkeyConfiguration(InputModifiers.Windows))
            .Bind <AvaloniaNativeOptions>().ToConstant(opts);
        }