Update Avalonia to v.11-Preview-4

This commit is contained in:
Michael Bucari-Tovo 2022-12-07 10:15:12 -07:00
parent 4b2387b621
commit a01a8c4b19
12 changed files with 48 additions and 38 deletions

View File

@ -8,9 +8,9 @@
</Application.DataTemplates> </Application.DataTemplates>
<Application.Styles> <Application.Styles>
<FluentTheme Mode="Light"/> <FluentTheme Mode="Light"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/> <StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentLight.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/> <StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/BaseLight.xaml"/>
<StyleInclude Source="/Assets/DataGridTheme.xaml"/> <StyleInclude Source="/Assets/DataGridTheme.xaml"/>
<StyleInclude Source="/Assets/LibationStyles.xaml"/> <StyleInclude Source="/Assets/LibationStyles.xaml"/>
</Application.Styles> </Application.Styles>

View File

@ -15,15 +15,15 @@ namespace LibationAvalonia.Controls
{ {
InitializeComponent(); InitializeComponent();
} }
protected override void OnPointerEnter(PointerEventArgs e) protected override void OnPointerEntered(PointerEventArgs e)
{ {
this.Cursor = HandCursor; this.Cursor = HandCursor;
base.OnPointerEnter(e); base.OnPointerEntered(e);
} }
protected override void OnPointerLeave(PointerEventArgs e) protected override void OnPointerExited(PointerEventArgs e)
{ {
this.Cursor = Cursor.Default; this.Cursor = Cursor.Default;
base.OnPointerLeave(e); base.OnPointerExited(e);
} }
private void InitializeComponent() private void InitializeComponent()

View File

@ -10,6 +10,7 @@ using LibationAvalonia.ViewModels;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System;
namespace LibationAvalonia.Dialogs namespace LibationAvalonia.Dialogs
{ {
@ -54,7 +55,7 @@ namespace LibationAvalonia.Dialogs
base.SaveAndClose(); base.SaveAndClose();
} }
public void GoToAudible_Tapped(object sender, Avalonia.Interactivity.RoutedEventArgs e) public void GoToAudible_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
{ {
var locale = AudibleApi.Localization.Get(_libraryBook.Book.Locale); var locale = AudibleApi.Localization.Get(_libraryBook.Book.Locale);
var link = $"https://www.audible.{locale.TopDomain}/pd/{_libraryBook.Book.AudibleProductId}"; var link = $"https://www.audible.{locale.TopDomain}/pd/{_libraryBook.Book.AudibleProductId}";

View File

@ -31,7 +31,7 @@ namespace LibationAvalonia.Dialogs.Login
DataContext = this; DataContext = this;
} }
public async void ExternalLoginLink_Tapped(object sender, Avalonia.Interactivity.RoutedEventArgs e) public async void ExternalLoginLink_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
{ {
LoginMethod = LoginMethod.External; LoginMethod = LoginMethod.External;
await SaveAndCloseAsync(); await SaveAndCloseAsync();

View File

@ -28,7 +28,7 @@ namespace LibationAvalonia.Dialogs
DataContext = this; DataContext = this;
} }
private async void GoToGithub_Tapped(object sender, Avalonia.Interactivity.RoutedEventArgs e) private async void GoToGithub_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
{ {
var url = "https://github.com/rmcrackan/Libation/issues"; var url = "https://github.com/rmcrackan/Libation/issues";
try try
@ -41,7 +41,7 @@ namespace LibationAvalonia.Dialogs
} }
} }
private async void GoToLogs_Tapped(object sender, Avalonia.Interactivity.RoutedEventArgs e) private async void GoToLogs_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
{ {
LongPath dir = ""; LongPath dir = "";
try try

View File

@ -6,7 +6,7 @@
mc:Ignorable="d" d:DesignWidth="265" d:DesignHeight="110" mc:Ignorable="d" d:DesignWidth="265" d:DesignHeight="110"
MinWidth="265" MinHeight="110" MinWidth="265" MinHeight="110"
x:Class="LibationAvalonia.Dialogs.MessageBoxWindow" x:Class="LibationAvalonia.Dialogs.MessageBoxWindow"
Title="{Binding Caption}" HasSystemDecorations="True" ShowInTaskbar="True" Title="{Binding Caption}" IsExtendedIntoWindowDecorations="True" ShowInTaskbar="True"
Icon="/Assets/1x1.png"> Icon="/Assets/1x1.png">
<Grid ColumnDefinitions="*" RowDefinitions="*,Auto"> <Grid ColumnDefinitions="*" RowDefinitions="*,Auto">

View File

@ -128,17 +128,19 @@
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Assets\SEGOEUI.TTF" /> <EmbeddedResource Include="Assets\SEGOEUI.TTF" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview4 " />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview4" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.4.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="glass-with-glow_256.svg"> <None Update="glass-with-glow_256.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>

View File

@ -13,6 +13,7 @@ using ApplicationServices;
using AudibleUtilities; using AudibleUtilities;
using LibationAvalonia.Views; using LibationAvalonia.Views;
using LibationAvalonia.Dialogs.Login; using LibationAvalonia.Dialogs.Login;
using Avalonia.Collections;
namespace LibationAvalonia.ViewModels namespace LibationAvalonia.ViewModels
{ {

View File

@ -12,7 +12,7 @@
Name="Form1" Name="Form1"
Icon="/Assets/libation.ico"> Icon="/Assets/libation.ico">
<Border BorderBrush="{DynamicResource DataGridGridLinesBrush}" BorderThickness="2" Padding="15"> <Border BorderBrush="{DynamicResource DataGridGridLinesBrush}" BorderThickness="2" Padding="10,0,10,10">
<Grid RowDefinitions="Auto,Auto,*,Auto"> <Grid RowDefinitions="Auto,Auto,*,Auto">
<Grid Grid.Row="0" ColumnDefinitions="1*,Auto"> <Grid Grid.Row="0" ColumnDefinitions="1*,Auto">
@ -143,23 +143,30 @@
<Style Selector="TextBox"> <Style Selector="TextBox">
<Setter Property="MinHeight" Value="10" /> <Setter Property="MinHeight" Value="10" />
</Style> </Style>
<Style Selector="Button">
<Setter Property="Padding" Value="15,0,15,0" />
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="Height" Value="30" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</Grid.Styles> </Grid.Styles>
<StackPanel Grid.Column="0" Orientation="Horizontal"> <StackPanel Grid.Column="0" Orientation="Horizontal">
<Button Click="filterHelpBtn_Click" Height="30" Width="30" Content="?"/> <Button Margin="0" Click="filterHelpBtn_Click" Content="?"/>
<Button Click="addQuickFilterBtn_Click" Height="30" Width="150" Margin="10,0,10,0" Content="Add To Quick Filters"/> <Button Click="addQuickFilterBtn_Click" Content="Add To Quick Filters"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal"> <StackPanel Grid.Column="1" Orientation="Horizontal">
<Button IsVisible="{Binding RemoveButtonsVisible}" IsEnabled="{Binding RemoveBooksButtonEnabled}" Click="removeBooksBtn_Click" Height="30" Width="220" Content="{Binding RemoveBooksButtonText}"/> <Button IsVisible="{Binding RemoveButtonsVisible}" IsEnabled="{Binding RemoveBooksButtonEnabled}" Click="removeBooksBtn_Click" Content="{Binding RemoveBooksButtonText}"/>
<Button IsVisible="{Binding RemoveButtonsVisible}" Click="doneRemovingBtn_Click" Height="30" Width="160" Margin="10,0,0,0" Content="Done Removing Books"/> <Button IsVisible="{Binding RemoveButtonsVisible}" Click="doneRemovingBtn_Click" Content="Done Removing Books"/>
</StackPanel> </StackPanel>
<TextBox Grid.Column="1" IsVisible="{Binding !RemoveButtonsVisible}" Text="{Binding FilterString, Mode=TwoWay}" KeyDown="filterSearchTb_KeyPress" /> <TextBox Grid.Column="1" Margin="10,0,0,0" IsVisible="{Binding !RemoveButtonsVisible}" Text="{Binding FilterString, Mode=TwoWay}" KeyDown="filterSearchTb_KeyPress" />
<StackPanel Grid.Column="2" Height="30" Orientation="Horizontal"> <StackPanel Grid.Column="2" Height="30" Orientation="Horizontal">
<Button Click="filterBtn_Click" Height="30" Width="80" Margin="10,0,10,0" Content="Filter"/> <Button Click="filterBtn_Click" Height="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="Filter"/>
<Button Click="ToggleQueueHideBtn_Click" Height="30" Width="30" Content="{Binding QueueHideButtonText}"/> <Button Padding="5,0,5,0" Click="ToggleQueueHideBtn_Click" Content="{Binding QueueHideButtonText}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@ -34,11 +34,9 @@
<DataGridTemplateColumn CanUserSort="True" Width="75" Header="Liberate" SortMemberPath="Liberate"> <DataGridTemplateColumn CanUserSort="True" Width="75" Header="Liberate" SortMemberPath="Liberate">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal"> <Button Padding="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="LiberateButton_Click" ToolTip.Tip="{Binding Liberate.ToolTip}">
<Button Width="75" Height="80" Click="LiberateButton_Click" ToolTip.Tip="{Binding Liberate.ToolTip}"> <Image Stretch="None" Source="{Binding Liberate.Image}" />
<Image Stretch="None" Height="80" Source="{Binding Liberate.Image}" /> </Button>
</Button>
</StackPanel>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>

View File

@ -29,6 +29,7 @@ namespace LibationAvalonia.Views
using var context = DbContexts.GetContext(); using var context = DbContexts.GetContext();
List<GridEntry> sampleEntries = new() List<GridEntry> sampleEntries = new()
{ {
new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B00DCD0OXU")),
new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G")),
new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG")),
new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q")),
@ -40,8 +41,8 @@ namespace LibationAvalonia.Views
DataContext = new ProductsDisplayViewModel(sampleEntries); DataContext = new ProductsDisplayViewModel(sampleEntries);
return; return;
} }
Configure_ColumnCustomization(); Configure_ColumnCustomization();
foreach (var column in productsGrid.Columns) foreach (var column in productsGrid.Columns)
{ {
column.CustomSortComparer = new RowComparer(column); column.CustomSortComparer = new RowComparer(column);
@ -198,7 +199,7 @@ namespace LibationAvalonia.Views
//Expanding and collapsing reset the list, which will cause focus to shift //Expanding and collapsing reset the list, which will cause focus to shift
//to the topright cell. Reset focus onto the clicked button's cell. //to the topright cell. Reset focus onto the clicked button's cell.
((sender as Control).Parent.Parent as DataGridCell)?.Focus(); (sender as Button).Parent?.Focus();
} }
else if (button.DataContext is LibraryBookEntry lbEntry) else if (button.DataContext is LibraryBookEntry lbEntry)
{ {
@ -212,7 +213,7 @@ namespace LibationAvalonia.Views
imageDisplayDialog.Close(); imageDisplayDialog.Close();
} }
public void Cover_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) public void Cover_Click(object sender, Avalonia.Input.TappedEventArgs args)
{ {
if (sender is not Image tblock || tblock.DataContext is not GridEntry gEntry) if (sender is not Image tblock || tblock.DataContext is not GridEntry gEntry)
return; return;
@ -252,7 +253,7 @@ namespace LibationAvalonia.Views
imageDisplayDialog.Show(); imageDisplayDialog.Show();
} }
public void Description_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) public void Description_Click(object sender, Avalonia.Input.TappedEventArgs args)
{ {
if (sender is TextBlock tblock && tblock.DataContext is GridEntry gEntry) if (sender is TextBlock tblock && tblock.DataContext is GridEntry gEntry)
{ {