diff --git a/src/shared/Core/Core.csproj b/src/shared/Core/Core.csproj
index d537e8c83..644d07e4e 100644
--- a/src/shared/Core/Core.csproj
+++ b/src/shared/Core/Core.csproj
@@ -14,24 +14,24 @@
-
+
-
+
-
-
-
+
+
+
-
+
diff --git a/src/shared/Core/UI/AvaloniaUi.cs b/src/shared/Core/UI/AvaloniaUi.cs
index f71d7dd18..65b681884 100644
--- a/src/shared/Core/UI/AvaloniaUi.cs
+++ b/src/shared/Core/UI/AvaloniaUi.cs
@@ -124,11 +124,11 @@ private static void SetParentExternal(Window window, IntPtr parentHandle)
return;
}
- IntPtr ourHandle = window.PlatformImpl.Handle.Handle;
+ IntPtr ourHandle = window.TryGetPlatformHandle()!.Handle;
// Get the desktop scaling factor from our window instance so we
// can calculate rects correctly for both our window, and the parent window.
- double scaling = window.PlatformImpl.DesktopScaling;
+ double scaling = window.RenderScaling;
// Get our window rect
var ourRect = new PixelRect(
diff --git a/src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs b/src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs
index 3be8497b1..524bc959e 100644
--- a/src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs
+++ b/src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs
@@ -5,7 +5,6 @@
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Input;
-using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
@@ -22,8 +21,6 @@ public partial class SixDigitInput : UserControl, IFocusable
(o, v) => o.Text = v,
defaultBindingMode: BindingMode.TwoWay);
- private PlatformHotkeyConfiguration _keyMap;
- private IClipboard _clipboard;
private bool _ignoreTextBoxUpdate;
private TextBox[] _textBoxes;
private string _text;
@@ -37,8 +34,6 @@ private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
- _keyMap = AvaloniaLocator.Current.GetService();
- _clipboard = AvaloniaLocator.Current.GetService();
_textBoxes = new[]
{
this.FindControl("one"),
@@ -89,7 +84,7 @@ public void SetFocus()
{
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
- KeyboardDevice.Instance.SetFocusedElement(_textBoxes[0], NavigationMethod.Tab, KeyModifiers.None);
+ _textBoxes[0].Focus(NavigationMethod.Tab, KeyModifiers.None);
}
private void SetUpTextBox(TextBox textBox)
@@ -99,7 +94,7 @@ private void SetUpTextBox(TextBox textBox)
void OnPreviewKeyDown(object sender, KeyEventArgs e)
{
// Handle paste
- if (_keyMap.Paste.Any(x => x.Matches(e)))
+ if (TopLevel.GetTopLevel(this)?.PlatformSettings?.HotkeyConfiguration.Paste.Any(x => x.Matches(e)) ?? false)
{
OnPaste();
e.Handled = true;
@@ -166,8 +161,7 @@ void OnPreviewKeyDown(object sender, KeyEventArgs e)
private void OnPaste()
{
- string text = _clipboard.GetTextAsync().GetAwaiter().GetResult();
- Text = text;
+ Text = TopLevel.GetTopLevel(this)?.Clipboard?.GetTextAsync().GetAwaiter().GetResult();
}
private bool MoveNext() => MoveFocus(true);
@@ -177,7 +171,7 @@ private void OnPaste()
private bool MoveFocus(bool next)
{
// Get currently focused text box
- if (FocusManager.Instance.Current is TextBox textBox)
+ if (TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement() is TextBox textBox)
{
int textBoxIndex = Array.IndexOf(_textBoxes, textBox);
if (textBoxIndex > -1)
@@ -186,7 +180,7 @@ private bool MoveFocus(bool next)
? Math.Min(_textBoxes.Length - 1, textBoxIndex + 1)
: Math.Max(0, textBoxIndex - 1);
- KeyboardDevice.Instance.SetFocusedElement(_textBoxes[nextIndex], NavigationMethod.Tab, KeyModifiers.None);
+ _textBoxes[nextIndex].Focus(NavigationMethod.Tab, KeyModifiers.None);
return true;
}
}
diff --git a/src/shared/GitHub/UI/Views/SelectAccountView.axaml b/src/shared/GitHub/UI/Views/SelectAccountView.axaml
index 2e497283c..417d58387 100644
--- a/src/shared/GitHub/UI/Views/SelectAccountView.axaml
+++ b/src/shared/GitHub/UI/Views/SelectAccountView.axaml
@@ -43,7 +43,7 @@
-