Exemplo n.º 1
0
        public static void Initialize(Win32PlatformOptions options)
        {
            Options = options;
            AvaloniaLocator.CurrentMutable
            .Bind <IClipboard>().ToSingleton <ClipboardImpl>()
            .Bind <ICursorFactory>().ToConstant(CursorFactory.Instance)
            .Bind <IKeyboardDevice>().ToConstant(WindowsKeyboardDevice.Instance)
            .Bind <IPlatformSettings>().ToConstant(s_instance)
            .Bind <IPlatformThreadingInterface>().ToConstant(s_instance)
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
            .Bind <ISystemDialogImpl>().ToSingleton <SystemDialogImpl>()
            .Bind <IWindowingPlatform>().ToConstant(s_instance)
            .Bind <PlatformHotkeyConfiguration>().ToConstant(new PlatformHotkeyConfiguration(KeyModifiers.Control)
            {
                OpenContextMenu =
                {
                    // Add Shift+F10
                    new KeyGesture(Key.F10, KeyModifiers.Shift)
                }
            })
            .Bind <IPlatformIconLoader>().ToConstant(s_instance)
            .Bind <NonPumpingLockHelper.IHelperImpl>().ToConstant(new NonPumpingSyncContext.HelperImpl())
            .Bind <IMountedVolumeInfoProvider>().ToConstant(new WindowsMountedVolumeInfoProvider());

            Win32GlManager.Initialize();

            _uiThread = Thread.CurrentThread;

            if (OleContext.Current != null)
            {
                AvaloniaLocator.CurrentMutable.Bind <IPlatformDragSource>().ToSingleton <DragSource>();
            }
        }
Exemplo n.º 2
0
        public static void Initialize(bool deferredRendering = true)
        {
            UnmanagedMethods.SetProcessDPIAware();

            AvaloniaLocator.CurrentMutable
            .Bind <IClipboard>().ToSingleton <ClipboardImpl>()
            .Bind <IStandardCursorFactory>().ToConstant(CursorFactory.Instance)
            .Bind <IKeyboardDevice>().ToConstant(WindowsKeyboardDevice.Instance)
            .Bind <IPlatformSettings>().ToConstant(s_instance)
            .Bind <IPlatformThreadingInterface>().ToConstant(s_instance)
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <IRenderTimer>().ToConstant(new RenderTimer(60))
            .Bind <ISystemDialogImpl>().ToSingleton <SystemDialogImpl>()
            .Bind <IWindowingPlatform>().ToConstant(s_instance)
            .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>()
            .Bind <IPlatformIconLoader>().ToConstant(s_instance);
            Win32GlManager.Initialize();
            UseDeferredRendering = deferredRendering;
            _uiThread            = UnmanagedMethods.GetCurrentThreadId();

            if (OleContext.Current != null)
            {
                AvaloniaLocator.CurrentMutable.Bind <IPlatformDragSource>().ToSingleton <DragSource>();
            }
        }
Exemplo n.º 3
0
        public static void Initialize(Win32PlatformOptions options)
        {
            Options = options;
            AvaloniaLocator.CurrentMutable
            .Bind <IClipboard>().ToSingleton <ClipboardImpl>()
            .Bind <IStandardCursorFactory>().ToConstant(CursorFactory.Instance)
            .Bind <IKeyboardDevice>().ToConstant(WindowsKeyboardDevice.Instance)
            .Bind <IPlatformSettings>().ToConstant(s_instance)
            .Bind <IPlatformThreadingInterface>().ToConstant(s_instance)
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <IRenderTimer>().ToConstant(new RenderTimer(60))
            .Bind <ISystemDialogImpl>().ToSingleton <SystemDialogImpl>()
            .Bind <IWindowingPlatform>().ToConstant(s_instance)
            .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>()
            .Bind <IPlatformIconLoader>().ToConstant(s_instance);
            if (options.AllowEglInitialization)
            {
                Win32GlManager.Initialize();
            }

            _uiThread = Thread.CurrentThread;

            if (OleContext.Current != null)
            {
                AvaloniaLocator.CurrentMutable.Bind <IPlatformDragSource>().ToSingleton <DragSource>();
            }
        }
Exemplo n.º 4
0
        public static void Initialize(Win32PlatformOptions options)
        {
            Options = options;
            AvaloniaLocator.CurrentMutable
            .Bind <IClipboard>().ToSingleton <ClipboardImpl>()
            .Bind <IStandardCursorFactory>().ToConstant(CursorFactory.Instance)
            .Bind <IKeyboardDevice>().ToConstant(WindowsKeyboardDevice.Instance)
            .Bind <IPlatformSettings>().ToConstant(s_instance)
            .Bind <IPlatformThreadingInterface>().ToConstant(s_instance)
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
            .Bind <ISystemDialogImpl>().ToSingleton <SystemDialogImpl>()
            .Bind <IWindowingPlatform>().ToConstant(s_instance)
            .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>()
            .Bind <IPlatformIconLoader>().ToConstant(s_instance)
            .Bind <AvaloniaSynchronizationContext.INonPumpingPlatformWaitProvider>().ToConstant(new NonPumpingWaitProvider())
            .Bind <IMountedVolumeInfoProvider>().ToConstant(new WindowsMountedVolumeInfoProvider());

            Win32GlManager.Initialize();

            _uiThread = Thread.CurrentThread;

            if (OleContext.Current != null)
            {
                AvaloniaLocator.CurrentMutable.Bind <IPlatformDragSource>().ToSingleton <DragSource>();
            }
        }