Esempio n. 1
0
        void DoInitialize(AvaloniaNativePlatformOptions options)
        {
            _options = options;
            _factory.Initialize();
            if (_factory.MacOptions != null)
            {
                var macOpts = AvaloniaLocator.Current.GetService <MacOSPlatformOptions>();
                _factory.MacOptions.ShowInDock = macOpts?.ShowInDock != false ? 1 : 0;
            }

            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));
        }
Esempio n. 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 <AvaloniaNativeOptions>().ToConstant(opts);
        }