More migrations to Avalonia 11.0.0-preview6

This commit is contained in:
Michael Bucari-Tovo 2023-03-26 22:16:58 -06:00 committed by Mbucari
parent 68af6a5ebb
commit 090871f50d
81 changed files with 380 additions and 469 deletions

View file

@ -6,7 +6,7 @@ using System;
namespace LibationAvalonia.ViewModels
{
public class AvaloniaEntryStatus : EntryStatus, IEntryStatus, IComparable
public class AvaloniaEntryStatus : EntryStatus, IEntryStatus, IComparable
{
public override IBrush BackgroundBrush => IsEpisode ? App.SeriesEntryGridBackgroundBrush : Brushes.Transparent;

View file

@ -22,8 +22,8 @@ namespace LibationAvalonia.ViewModels.Dialogs
public bool HasButton3 => !string.IsNullOrEmpty(Button3Text);
public bool HasButton2 => !string.IsNullOrEmpty(Button2Text);
public int WindowHeight { get;private set; }
public int WindowWidth { get;private set; }
public int WindowHeight { get; private set; }
public int WindowWidth { get; private set; }
public string Button1Text => _button switch
{
@ -47,7 +47,7 @@ namespace LibationAvalonia.ViewModels.Dialogs
MessageBoxButtons.CancelTryContinue => "Try",
_ => string.Empty,
};
public string Button3Text => _button switch
{
MessageBoxButtons.AbortRetryIgnore => "Ignore",

View file

@ -1,4 +1,6 @@
using ApplicationServices;
using Avalonia.Collections;
using Avalonia.Controls;
using LibationFileManager;
using ReactiveUI;
@ -41,24 +43,25 @@ namespace LibationAvalonia.ViewModels
/// <summary> Auto scanning accounts is enables </summary>
public bool AutoScanChecked
{
get => _autoScanChecked;
set
{
public bool AutoScanChecked
{
get => _autoScanChecked;
set
{
if (value != _autoScanChecked)
Configuration.Instance.AutoScan = value;
this.RaiseAndSetIfChanged(ref _autoScanChecked, value);
}
}
}
public AvaloniaList<Control> QuickFilterMenuItems { get; } = new();
/// <summary> Indicates if the first quick filter is the default filter </summary>
public bool FirstFilterIsDefault
{
get => _firstFilterIsDefault;
set
{
{
get => _firstFilterIsDefault;
set
{
if (value != _firstFilterIsDefault)
QuickFilters.UseDefault = value;
this.RaiseAndSetIfChanged(ref _firstFilterIsDefault, value);

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ApplicationServices;
using ApplicationServices;
using AudibleApi;
using AudibleApi.Common;
using Avalonia.Media;
@ -15,6 +11,10 @@ using FileLiberator;
using LibationFileManager;
using LibationUiBase;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LibationAvalonia.ViewModels
{
@ -65,7 +65,7 @@ namespace LibationAvalonia.ViewModels
public string Author { get => _author; set => Dispatcher.UIThread.Post(() => this.RaiseAndSetIfChanged(ref _author, value)); }
public string Title { get => _title; set => Dispatcher.UIThread.Post(() => this.RaiseAndSetIfChanged(ref _title, value)); }
public int Progress { get => _progress; private set => Dispatcher.UIThread.Post(() => this.RaiseAndSetIfChanged(ref _progress, value)); }
public string ETA { get => _eta; private set => Dispatcher.UIThread.Post(() =>this.RaiseAndSetIfChanged(ref _eta, value)); }
public string ETA { get => _eta; private set => Dispatcher.UIThread.Post(() => this.RaiseAndSetIfChanged(ref _eta, value)); }
public Bitmap Cover { get => _cover; private set => Dispatcher.UIThread.Post(() => this.RaiseAndSetIfChanged(ref _cover, value)); }
public bool IsFinished => Status is not ProcessBookStatus.Queued and not ProcessBookStatus.Working;
public bool IsDownloading => Status is ProcessBookStatus.Working;
@ -315,36 +315,36 @@ namespace LibationAvalonia.ViewModels
Logger.Info($"{((Processable)sender).Name} Step, Completed: {libraryBook.Book}");
UnlinkProcessable((Processable)sender);
if (Processes.Count == 0)
{
Completed?.Invoke(this, EventArgs.Empty);
if (Processes.Count == 0)
{
Completed?.Invoke(this, EventArgs.Empty);
return;
}
}
NextProcessable();
LinkProcessable(CurrentProcessable);
NextProcessable();
LinkProcessable(CurrentProcessable);
StatusHandler result;
try
try
{
result = await CurrentProcessable.ProcessSingleAsync(libraryBook, validate: true);
}
catch (Exception ex)
{
Serilog.Log.Logger.Error(ex, $"{nameof(Processable_Completed)} error");
}
catch (Exception ex)
{
Serilog.Log.Logger.Error(ex, $"{nameof(Processable_Completed)} error");
result = new StatusHandler();
result.AddError($"{nameof(Processable_Completed)} error. See log for details. Error summary: {ex.Message}");
}
result = new StatusHandler();
result.AddError($"{nameof(Processable_Completed)} error. See log for details. Error summary: {ex.Message}");
}
if (result.HasErrors)
{
foreach (var errorMessage in result.Errors.Where(e => e != "Validation failed"))
Logger.Error(errorMessage);
if (result.HasErrors)
{
foreach (var errorMessage in result.Errors.Where(e => e != "Validation failed"))
Logger.Error(errorMessage);
Completed?.Invoke(this, EventArgs.Empty);
}
}
Completed?.Invoke(this, EventArgs.Empty);
}
}
#endregion

View file

@ -33,7 +33,7 @@ namespace LibationAvalonia.ViewModels
Queue.CompletedCountChanged += Queue_CompletedCountChanged;
if (Design.IsDesignMode)
_ = Configuration.Instance.LibationFiles;
_ = Configuration.Instance.LibationFiles;
SpeedLimit = Configuration.Instance.DownloadSpeedLimit / 1024m / 1024;
}

View file

@ -133,12 +133,12 @@ namespace LibationAvalonia.ViewModels
}
private void GridEntries_CollectionChanged(object sender = null, EventArgs e = null)
{
{
var count
= FilteredInGridEntries?.OfType<ILibraryBookEntry>().Count()
?? SOURCE.OfType<ILibraryBookEntry>().Count();
VisibleCountChanged?.Invoke(this, count);
VisibleCountChanged?.Invoke(this, count);
}
/// <summary>

View file

@ -1,8 +1,4 @@
using Avalonia.Controls;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Text;
namespace LibationAvalonia.ViewModels
{