Skip to content

Commit

Permalink
Bump Avalonia.* from 11.0.0-preview4 to 11.0.4
Browse files Browse the repository at this point in the history
- Bump Avalonia from 11.0.0-preview4 to 11.0.4
- Bump Avalonia.Controls.DataGrid from 11.0.0-preview4 to 11.0.4
- Bump Avalonia.Desktop from 11.0.0-preview4 to 11.0.4
- Bump Avalonia.ReactiveUI from 11.0.0-preview4 to 11.0.4
- Bump Avalonia.Themes.Fluent from 11.0.0-preview4 to 11.0.4
- Bump Avalonia.Xaml.Behaviors from 11.0.0-preview4 to 11.0.2
  • Loading branch information
felipe19930 committed Sep 12, 2023
1 parent 52f8fff commit a29a419
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 61 deletions.
5 changes: 3 additions & 2 deletions VDF.GUI/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
x:Class="VDF.GUI.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VDF.GUI">
xmlns:local="clr-namespace:VDF.GUI"
RequestedThemeVariant="Dark">

<Application.Styles>
<FluentTheme Mode="Dark" />
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
<!--<StyleInclude Source="resm:Avalonia.Controls.DataGrid.Themes.Fluent.xaml?assembly=Avalonia.Controls.DataGrid" />-->
<StyleInclude Source="/Styles/Styles.xaml" />
Expand Down
1 change: 0 additions & 1 deletion VDF.GUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions { UseDBusFilePicker = false })
.With(new Win32PlatformOptions { UseWindowsUIComposition = true })
.UseReactiveUI();
}
}
12 changes: 6 additions & 6 deletions VDF.GUI/Utils/PickerDialogUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ private static string GetLocalPath(Uri uriPath) {

if (paths != null &&
paths.Count > 0 &&
paths[0].TryGetUri(out Uri? uriPath))
return GetLocalPath(uriPath);
paths[0].TryGetLocalPath() is string uriPath)
return uriPath;

return null;
}
internal static async Task<string?> SaveFilePicker(FilePickerSaveOptions options) {
var path = await ApplicationHelpers.MainWindow.StorageProvider.SaveFilePickerAsync(options);

if (path != null && path.TryGetUri(out Uri? uriPath))
return GetLocalPath(uriPath);
if (path != null && path.TryGetLocalPath() is string uriPath)
return uriPath;

return null;
}
Expand All @@ -69,8 +69,8 @@ private static string GetLocalPath(Uri uriPath) {

List<string> results = new();
foreach (var item in paths) {
if (item.TryGetUri(out Uri? uriPath))
results.Add(GetLocalPath(uriPath));
if (item.TryGetLocalPath() is string uriPath)
results.Add(uriPath);
}
return results;
}
Expand Down
4 changes: 2 additions & 2 deletions VDF.GUI/Utils/TreeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
namespace VDF.GUI.Utils {
static class TreeHelper {

static List<T> GetVisualTreeObjects<T>(this IVisual obj) where T : IVisual {
static List<T> GetVisualTreeObjects<T>(this Control obj) where T : Control {
var objects = new List<T>();
foreach (var child in obj.GetVisualChildren()) {
foreach (Control child in obj.GetVisualChildren()) {
if (child is T requestedType)
objects.Add(requestedType);
objects.AddRange(child.GetVisualTreeObjects<T>());
Expand Down
12 changes: 6 additions & 6 deletions VDF.GUI/VDF.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<None Remove="Styles\Styles.xaml" />
</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.ReactiveUI" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia" Version="11.0.4" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.4" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.4" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.4" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.2" />
<PackageReference Include="DynamicExpresso.Core" Version="2.16.1" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions VDF.GUI/ViewModels/CustomSelectionVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public CustomSelectionData Data {
[JsonIgnore]
public ReactiveCommand<Unit, Unit> SaveCommand => ReactiveCommand.CreateFromTask(async () => {
var result = await Utils.PickerDialogUtils.SaveFilePicker(new FilePickerSaveOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
DefaultExtension = ".vdfselection",
FileTypeChoices = new FilePickerFileType[] {
new FilePickerFileType("Selection File") { Patterns = new string[] { "*.vdfselection" }}}
Expand All @@ -100,7 +100,7 @@ public CustomSelectionData Data {
[JsonIgnore]
public ReactiveCommand<Unit, Unit> LoadCommand => ReactiveCommand.CreateFromTask(async () => {
var result = await Utils.PickerDialogUtils.OpenFilePicker(new FilePickerOpenOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
FileTypeFilter = new FilePickerFileType[] {
new FilePickerFileType("Selection File") { Patterns = new string[] { "*.vdfselection" }}}
});
Expand Down
2 changes: 1 addition & 1 deletion VDF.GUI/ViewModels/DuplicateItemVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public DuplicateItemVM(DuplicateItem item) {
Thumbnail = ImageUtils.JoinImages(ItemInfo.ImageList)!;
Dispatcher.UIThread.Post(() => {
this.RaisePropertyChanged(nameof(Thumbnail));
}, DispatcherPriority.Layout);
}, DispatcherPriority.Render); // DispatcherPriority.Layout was removed in https://github.com/AvaloniaUI/Avalonia/commit/f300a24402afc9f7f3c177e835a0cec10ce52e6c
};
}
public DuplicateItem ItemInfo { get; set; }
Expand Down
19 changes: 8 additions & 11 deletions VDF.GUI/ViewModels/MainWindowVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ public MainWindowVM() {
Scanner.ThumbnailsRetrieved += Scanner_ThumbnailsRetrieved;
Scanner.DatabaseCleaned += Scanner_DatabaseCleaned;
Scanner.FilesEnumerated += Scanner_FilesEnumerated;
var assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
Scanner.NoThumbnailImage = SixLabors.ImageSharp.Image.Load(assets!.Open(new Uri("avares://VDF.GUI/Assets/icon.png")));
Scanner.NoThumbnailImage = SixLabors.ImageSharp.Image.Load(AssetLoader.Open(new Uri("avares://VDF.GUI/Assets/icon.png")));

try {
File.Delete(Path.Combine(CoreUtils.CurrentFolder, "log.txt"));
Expand Down Expand Up @@ -346,7 +345,7 @@ void BuildDuplicatesView() {
view = new DataGridCollectionView(Duplicates);
view.GroupDescriptions.Add(new DataGridPathGroupDescription($"{nameof(DuplicateItemVM.ItemInfo)}.{nameof(DuplicateItem.GroupId)}"));
view.Filter += DuplicatesFilter;
GetDataGrid.Items = view;
GetDataGrid.ItemsSource = view;
TotalDuplicates = Duplicates.Count;
TotalDuplicatesSize = Duplicates.Sum(x => x.ItemInfo.SizeLong).BytesToString();
TotalSizeRemovedInternal = 0;
Expand Down Expand Up @@ -392,7 +391,7 @@ void BuildDuplicatesView() {
});
public static ReactiveCommand<Unit, Unit> ImportDataBaseFromJsonCommand => ReactiveCommand.CreateFromTask(async () => {
var result = await Utils.PickerDialogUtils.OpenFilePicker(new FilePickerOpenOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
FileTypeFilter = new FilePickerFileType[] {
new FilePickerFileType("Json File") { Patterns = new string[] { "*.json" }}}
});
Expand Down Expand Up @@ -464,7 +463,7 @@ async void ExportScanResultsToJson(JsonSerializerOptions options) {
});
async Task ExportScanResultsIncludingThumbnails(string? path = null) {
path ??= await Utils.PickerDialogUtils.SaveFilePicker(new FilePickerSaveOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
DefaultExtension = ".json",
FileTypeChoices = new FilePickerFileType[] {
new FilePickerFileType("Scan Results") { Patterns = new string[] { "*.scanresults" }}}
Expand Down Expand Up @@ -494,7 +493,7 @@ async Task ExportScanResultsIncludingThumbnails(string? path = null) {
}
public ReactiveCommand<Unit, Unit> ImportScanResultsFromFileCommand => ReactiveCommand.CreateFromTask(async () => {
var result = await Utils.PickerDialogUtils.OpenFilePicker(new FilePickerOpenOptions {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
FileTypeFilter = new FilePickerFileType[] {
new FilePickerFileType("Scan Results") { Patterns = new string[] { "*.scanresults" }}}
});
Expand All @@ -509,7 +508,7 @@ async void ImportScanResultsIncludingThumbnails(string? path = null) {

if (path == null) {
path = await Utils.PickerDialogUtils.OpenFilePicker(new FilePickerOpenOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
FileTypeFilter = new FilePickerFileType[] {
new FilePickerFileType("Scan Results") { Patterns = new string[] { "*.scanresults" }}}
});
Expand Down Expand Up @@ -951,8 +950,7 @@ async void DeleteInternal(bool fromDisk,
}
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
#pragma warning disable CS8602 // Dereference of a possibly null reference.
await ((IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard)))
.SetTextAsync(sb.ToString().TrimEnd(new char[2] { '\r', '\n' }));
await (ApplicationHelpers.MainWindow.Clipboard.SetTextAsync(sb.ToString().TrimEnd(new char[2] { '\r', '\n' })));
#pragma warning restore CS8602 // Dereference of a possibly null reference.
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
});
Expand All @@ -964,8 +962,7 @@ async void DeleteInternal(bool fromDisk,
}
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
#pragma warning disable CS8602 // Dereference of a possibly null reference.
await ((IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard)))
.SetTextAsync(sb.ToString().TrimEnd(new char[2] { '\r', '\n' }));
await (ApplicationHelpers.MainWindow.Clipboard.SetTextAsync(sb.ToString().TrimEnd(new char[2] { '\r', '\n' })));
#pragma warning restore CS8602 // Dereference of a possibly null reference.
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
});
Expand Down
4 changes: 2 additions & 2 deletions VDF.GUI/ViewModels/MainWindowVM_Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void Instance_LogItemAdded(string message) =>
});
public ReactiveCommand<Unit, Unit> SaveSettingsProfileCommand => ReactiveCommand.CreateFromTask(async () => {
var result = await Utils.PickerDialogUtils.SaveFilePicker(new FilePickerSaveOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
DefaultExtension = ".json",
FileTypeChoices = new FilePickerFileType[] {
new FilePickerFileType("Setting File") { Patterns = new string[] { "*.json" }}}
Expand All @@ -175,7 +175,7 @@ void Instance_LogItemAdded(string message) =>
});
public ReactiveCommand<Unit, Unit> LoadSettingsProfileCommand => ReactiveCommand.CreateFromTask(async () => {
var result = await Utils.PickerDialogUtils.OpenFilePicker(new FilePickerOpenOptions() {
SuggestedStartLocation = new BclStorageFolder(CoreUtils.CurrentFolder),
SuggestedStartLocation = await ApplicationHelpers.MainWindow.StorageProvider.TryGetFolderFromPathAsync(CoreUtils.CurrentFolder),
FileTypeFilter = new FilePickerFileType[] {
new FilePickerFileType("Setting File") { Patterns = new string[] { "*.json", "*.xml" }}}
});
Expand Down
4 changes: 2 additions & 2 deletions VDF.GUI/Views/CustomSelectionView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
Grid.Row="1"
MinHeight="70"
BorderThickness="1"
Items="{Binding Data.PathContains}"
ItemsSource="{Binding Data.PathContains}"
SelectionMode="Multiple" />
<TextBlock
Grid.Row="2"
Expand Down Expand Up @@ -235,7 +235,7 @@
Grid.Row="1"
MinHeight="70"
BorderThickness="1"
Items="{Binding Data.PathNotContains}"
ItemsSource="{Binding Data.PathNotContains}"
SelectionMode="Multiple" />
<TextBlock
Grid.Row="2"
Expand Down
2 changes: 1 addition & 1 deletion VDF.GUI/Views/CustomSelectionView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CustomSelectionView(string a) {
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
Environment.OSVersion.Version.Build >= 22000) {
Background = null;
TransparencyLevelHint = WindowTransparencyLevel.Mica;
TransparencyLevelHint = new List<WindowTransparencyLevel> { WindowTransparencyLevel.Mica };
ExtendClientAreaChromeHints = Avalonia.Platform.ExtendClientAreaChromeHints.PreferSystemChrome;
if (SettingsFile.Instance.DarkMode)
this.FindControl<ExperimentalAcrylicBorder>("ExperimentalAcrylicBorderBackgroundBlack")!.IsVisible = true;
Expand Down
2 changes: 1 addition & 1 deletion VDF.GUI/Views/DatabaseViewer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<TextBlock Text="Search:" VerticalAlignment="Center"/>
<TextBox Text="{Binding SearchText}" Margin="10,0,0,0" Grid.Column="1"/>
</Grid>
<controls:DataGrid x:Name="datagridDatabase" Grid.Row="1" Items="{Binding DatabaseFilesView}" AutoGenerateColumns="True">
<controls:DataGrid x:Name="datagridDatabase" Grid.Row="1" ItemsSource="{Binding DatabaseFilesView}" AutoGenerateColumns="True">
<controls:DataGrid.KeyBindings>
<KeyBinding Command="{Binding DeleteSelectedEntries}" Gesture="Delete"/>
</controls:DataGrid.KeyBindings>
Expand Down
18 changes: 9 additions & 9 deletions VDF.GUI/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
<ComboBox
MinWidth="150"
Margin="5,0,0,0"
Items="{Binding SortOrders}"
ItemsSource="{Binding SortOrders}"
SelectedItem="{Binding SortOrder}">
<ComboBox.ItemTemplate>
<DataTemplate>
Expand All @@ -761,7 +761,7 @@
<ComboBox
MinWidth="150"
Margin="5,0,0,0"
Items="{Binding TypeFilters}"
ItemsSource="{Binding TypeFilters}"
SelectedItem="{Binding FileType}">
<ComboBox.ItemTemplate>
<DataTemplate>
Expand Down Expand Up @@ -1470,7 +1470,7 @@
<ComboBox
x:Name="ComboboxHardwareAccelerationMode"
VerticalAlignment="Center"
Items="{Binding HardwareAccelerationModes}"
ItemsSource="{Binding HardwareAccelerationModes}"
SelectedItem="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=HardwareAccelerationMode}"
ToolTip.Tip="Hardware acceleration mode of ffmpeg" />
<TextBlock
Expand All @@ -1480,7 +1480,7 @@
<ComboBox
Width="200"
VerticalAlignment="Center"
Items="{Binding CustomCommandList}"
ItemsSource="{Binding CustomCommandList}"
SelectedItem="{Binding SelectedCustomCommand}"
ToolTip.Tip="Enter your own commands to open single or multiple files." />
<TextBox
Expand Down Expand Up @@ -1559,7 +1559,7 @@
Grid.Row="1"
BorderThickness="1"
DragDrop.AllowDrop="True"
Items="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=Includes}" />
ItemsSource="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=Includes}" />
</Grid>
<TextBlock
Grid.Row="0"
Expand Down Expand Up @@ -1624,7 +1624,7 @@
Grid.Row="1"
BorderThickness="1"
DragDrop.AllowDrop="True"
Items="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=Blacklists}" />
ItemsSource="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=Blacklists}" />
</Grid>
</Grid>
</Grid>
Expand Down Expand Up @@ -1731,7 +1731,7 @@
MinHeight="70"
BorderThickness="1"
IsEnabled="{Binding #CheckboxFilterByFilePathContains.IsChecked}"
Items="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=FilePathContainsTexts}" />
ItemsSource="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=FilePathContainsTexts}" />
<TextBlock Grid.Row="2" Text="Note: Supports the following wildcards: '*' and '?'. The backslash character '\' escapes." />
</Grid>
<CheckBox
Expand Down Expand Up @@ -1788,7 +1788,7 @@
MinHeight="70"
BorderThickness="1"
IsEnabled="{Binding #CheckboxFilterByFilePathNotContains.IsChecked}"
Items="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=FilePathNotContainsTexts}" />
ItemsSource="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=FilePathNotContainsTexts}" />
<TextBlock Grid.Row="2" Text="Note: Supports the following wildcards: '*' and '?'. The backslash character '\' escapes." />
</Grid>
<!--<TextBox
Expand Down Expand Up @@ -1909,7 +1909,7 @@
Grid.Row="1"
MinHeight="70"
Margin="5"
Items="{Binding LogItems}"
ItemsSource="{Binding LogItems}"
ScrollViewer.HorizontalScrollBarVisibility="Visible" />
</Grid>
</TabItem>
Expand Down
Loading

0 comments on commit a29a419

Please sign in to comment.