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)); }
void DoInitialize(AvaloniaNativePlatformOptions options) { _options = options; var applicationPlatform = new AvaloniaNativeApplicationPlatform(); _factory.Initialize(new GCHandleDeallocator(), applicationPlatform); if (_factory.MacOptions != null) { var macOpts = AvaloniaLocator.Current.GetService <MacOSPlatformOptions>(); _factory.MacOptions.SetShowInDock(macOpts?.ShowInDock != false ? 1 : 0); _factory.MacOptions.SetDisableDefaultApplicationMenuItems( macOpts?.DisableDefaultApplicationMenuItems == true ? 1 : 0); } AvaloniaLocator.CurrentMutable .Bind <IPlatformThreadingInterface>() .ToConstant(new PlatformThreadingInterface(_factory.CreatePlatformThreadingInterface())) .Bind <ICursorFactory>().ToConstant(new CursorFactory(_factory.CreateCursorFactory())) .Bind <IPlatformIconLoader>().ToSingleton <IconLoader>() .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice) .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 <PlatformHotkeyConfiguration>().ToConstant(new PlatformHotkeyConfiguration(KeyModifiers.Meta, wholeWordTextActionModifiers: KeyModifiers.Alt)) .Bind <IMountedVolumeInfoProvider>().ToConstant(new MacOSMountedVolumeInfoProvider()) .Bind <IPlatformDragSource>().ToConstant(new AvaloniaNativeDragSource(_factory)) .Bind <IPlatformLifetimeEventsImpl>().ToConstant(applicationPlatform); var hotkeys = AvaloniaLocator.Current.GetService <PlatformHotkeyConfiguration>(); hotkeys.MoveCursorToTheStartOfLine.Add(new KeyGesture(Key.Left, hotkeys.CommandModifiers)); hotkeys.MoveCursorToTheStartOfLineWithSelection.Add(new KeyGesture(Key.Left, hotkeys.CommandModifiers | hotkeys.SelectionModifiers)); hotkeys.MoveCursorToTheEndOfLine.Add(new KeyGesture(Key.Right, hotkeys.CommandModifiers)); hotkeys.MoveCursorToTheEndOfLineWithSelection.Add(new KeyGesture(Key.Right, hotkeys.CommandModifiers | hotkeys.SelectionModifiers)); if (_options.UseGpu) { try { AvaloniaLocator.CurrentMutable.Bind <IPlatformOpenGlInterface>() .ToConstant(_platformGl = new AvaloniaNativePlatformOpenGlInterface(_factory.ObtainGlDisplay())); } catch (Exception) { // ignored } } }
void DoInitialize(AvaloniaNativePlatformOptions options) { _options = options; _factory.Initialize(new GCHandleDeallocator()); if (_factory.MacOptions != null) { var macOpts = AvaloniaLocator.Current.GetService <MacOSPlatformOptions>(); _factory.MacOptions.SetShowInDock(macOpts?.ShowInDock != false ? 1 : 0); _factory.MacOptions.SetDisableDefaultApplicationMenuItems( macOpts?.DisableDefaultApplicationMenuItems == true ? 1 : 0); } AvaloniaLocator.CurrentMutable .Bind <IPlatformThreadingInterface>() .ToConstant(new PlatformThreadingInterface(_factory.CreatePlatformThreadingInterface())) .Bind <ICursorFactory>().ToConstant(new CursorFactory(_factory.CreateCursorFactory())) .Bind <IPlatformIconLoader>().ToSingleton <IconLoader>() .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice) .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 <PlatformHotkeyConfiguration>().ToConstant(new PlatformHotkeyConfiguration(KeyModifiers.Meta)) .Bind <IMountedVolumeInfoProvider>().ToConstant(new MacOSMountedVolumeInfoProvider()) .Bind <IPlatformDragSource>().ToConstant(new AvaloniaNativeDragSource(_factory)); if (_options.UseGpu) { try { AvaloniaLocator.CurrentMutable.Bind <IPlatformOpenGlInterface>() .ToConstant(_platformGl = new AvaloniaNativePlatformOpenGlInterface(_factory.ObtainGlDisplay())); } catch (Exception) { // ignored } } }
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); }