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 <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()); if (_options.UseGpu) { AvaloniaLocator.CurrentMutable.Bind <IWindowingPlatformGlFeature>() .ToConstant(_glFeature = new GlPlatformFeature(_factory.ObtainGlDisplay())); } }
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>() ?? new MacOSPlatformOptions(); _factory.MacOptions.SetShowInDock(macOpts.ShowInDock ? 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) .Bind <INativeApplicationCommands>().ToConstant(new MacOSNativeMenuCommands(_factory.CreateApplicationCommands())); 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 } } }