Update avalonia ro v11-RC1

This commit is contained in:
Mbucari 2023-06-02 23:39:16 -06:00
parent e5708a382b
commit 6c48fc1f5e
7 changed files with 18 additions and 59 deletions

View File

@ -28,8 +28,6 @@ namespace LibationAvalonia
public static IBrush ProcessQueueBookDefaultBrush { get; private set; } public static IBrush ProcessQueueBookDefaultBrush { get; private set; }
public static IBrush SeriesEntryGridBackgroundBrush { get; private set; } public static IBrush SeriesEntryGridBackgroundBrush { get; private set; }
public static IAssetLoader AssetLoader { get; private set; }
public static readonly Uri AssetUriBase = new("avares://Libation/Assets/"); public static readonly Uri AssetUriBase = new("avares://Libation/Assets/");
public static Stream OpenAsset(string assetRelativePath) public static Stream OpenAsset(string assetRelativePath)
=> AssetLoader.Open(new Uri(AssetUriBase, assetRelativePath)); => AssetLoader.Open(new Uri(AssetUriBase, assetRelativePath));
@ -37,7 +35,6 @@ namespace LibationAvalonia
public override void Initialize() public override void Initialize()
{ {
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);
AssetLoader = AvaloniaLocator.Current.GetService<IAssetLoader>();
} }
public static Task<List<DataLayer.LibraryBook>> LibraryTask; public static Task<List<DataLayer.LibraryBook>> LibraryTask;

View File

@ -10,9 +10,9 @@ using System.Windows.Input;
namespace LibationAvalonia.Controls namespace LibationAvalonia.Controls
{ {
public partial class LinkLabel : TextBlock, IStyleable, ICommandSource public partial class LinkLabel : TextBlock, ICommandSource
{ {
Type IStyleable.StyleKey => typeof(LinkLabel); protected override Type StyleKeyOverride => typeof(LinkLabel);
public static readonly StyledProperty<ICommand> CommandProperty = public static readonly StyledProperty<ICommand> CommandProperty =
AvaloniaProperty.Register<LinkLabel, ICommand>(nameof(Command), enableDataValidation: true); AvaloniaProperty.Register<LinkLabel, ICommand>(nameof(Command), enableDataValidation: true);

View File

@ -16,9 +16,15 @@ namespace LibationAvalonia.Controls
{ {
var dir = Math.Sign(e.Delta.Y); var dir = Math.Sign(e.Delta.Y);
if (dir == 1 && SelectedIndex > 0) if (dir == 1 && SelectedIndex > 0)
{
SelectedIndex--; SelectedIndex--;
e.Handled = true;
}
else if (dir == -1 && SelectedIndex < ItemCount - 1) else if (dir == -1 && SelectedIndex < ItemCount - 1)
{
SelectedIndex++; SelectedIndex++;
e.Handled = true;
}
base.OnPointerWheelChanged(e); base.OnPointerWheelChanged(e);
} }

View File

@ -70,13 +70,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview8" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" /> <PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-rc1.1" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />
<PackageReference Include="Avalonia" Version="11.0.0-preview8" /> <PackageReference Include="Avalonia" Version="11.0.0-rc1.1" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0-preview8" /> <PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0-rc1.1" />
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.0-preview8" /> <PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.0-rc1.1" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview8" /> <PackageReference Include="Avalonia.Desktop" Version="11.0.0-rc1.1" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview8" /> <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-rc1.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview8" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-rc1.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,44 +0,0 @@
using Avalonia;
using Avalonia.Input;
namespace LibationAvalonia
{
internal class MacAccessKeyHandler : AccessKeyHandler
{
protected override void OnPreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key is Key.LWin or Key.RWin)
{
var newArgs = new KeyEventArgs { Key = Key.LeftAlt, Handled = e.Handled };
base.OnPreviewKeyDown(sender, newArgs);
e.Handled = newArgs.Handled;
}
else if (e.Key is not Key.LeftAlt and not Key.RightAlt)
base.OnPreviewKeyDown(sender, e);
}
protected override void OnPreviewKeyUp(object sender, KeyEventArgs e)
{
if (e.Key is Key.LWin or Key.RWin)
{
var newArgs = new KeyEventArgs { Key = Key.LeftAlt, Handled = e.Handled };
base.OnPreviewKeyUp(sender, newArgs);
e.Handled = newArgs.Handled;
}
else if (e.Key is not Key.LeftAlt and not Key.RightAlt)
base.OnPreviewKeyDown(sender, e);
}
protected override void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyModifiers.HasAllFlags(KeyModifiers.Meta))
{
var newArgs = new KeyEventArgs { Key = e.Key, Handled = e.Handled, KeyModifiers = KeyModifiers.Alt };
base.OnKeyDown(sender, newArgs);
e.Handled = newArgs.Handled;
}
else if (!e.KeyModifiers.HasFlag(KeyModifiers.Alt))
base.OnPreviewKeyDown(sender, e);
}
}
}

View File

@ -252,8 +252,8 @@ namespace LibationAvalonia.Views
var displayIndices = config.GridColumnsDisplayIndices; var displayIndices = config.GridColumnsDisplayIndices;
var contextMenu = new ContextMenu(); var contextMenu = new ContextMenu();
contextMenu.MenuClosed += ContextMenu_MenuClosed; contextMenu.Closed += ContextMenu_MenuClosed;
contextMenu.ContextMenuOpening += ContextMenu_ContextMenuOpening; contextMenu.Opening += ContextMenu_ContextMenuOpening;
List<Control> menuItems = new(); List<Control> menuItems = new();
contextMenu.ItemsSource = menuItems; contextMenu.ItemsSource = menuItems;

View File

@ -248,7 +248,7 @@ namespace LibationAvalonia
private async Task displayControlAsync(TemplatedControl control) private async Task displayControlAsync(TemplatedControl control)
{ {
await UIThread.InvokeAsync(() => control.IsEnabled = false); await UIThread.InvokeAsync(() => control.IsEnabled = false);
await UIThread.InvokeAsync(MainForm.productsDisplay.Focus); await UIThread.InvokeAsync(() => MainForm.productsDisplay.Focus());
await UIThread.InvokeAsync(() => flashControlAsync(control)); await UIThread.InvokeAsync(() => flashControlAsync(control));
if (control is MenuItem menuItem) await UIThread.InvokeAsync(menuItem.Open); if (control is MenuItem menuItem) await UIThread.InvokeAsync(menuItem.Open);
await Task.Delay(500); await Task.Delay(500);