diff --git a/Source/LibationAvalonia/LibationAvalonia.csproj b/Source/LibationAvalonia/LibationAvalonia.csproj index 4d74e348..0e1d2a8b 100644 --- a/Source/LibationAvalonia/LibationAvalonia.csproj +++ b/Source/LibationAvalonia/LibationAvalonia.csproj @@ -17,12 +17,12 @@ - ..\bin\Debug + ..\bin-Avalonia\Debug embedded - ..\bin\Release + ..\bin-Avalonia\Release embedded diff --git a/Source/LibationAvalonia/Properties/PublishProfiles/FolderProfile.pubxml b/Source/LibationAvalonia/Properties/PublishProfiles/FolderProfile.pubxml index 510fb21c..7a5531a3 100644 --- a/Source/LibationAvalonia/Properties/PublishProfiles/FolderProfile.pubxml +++ b/Source/LibationAvalonia/Properties/PublishProfiles/FolderProfile.pubxml @@ -9,8 +9,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121. ..\bin\publish\linux-x64\ FileSystem net6.0 - linux-x64 - false + win-x64 + true false + false \ No newline at end of file diff --git a/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml b/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml new file mode 100644 index 00000000..4f12172b --- /dev/null +++ b/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml @@ -0,0 +1,16 @@ + + + + + Release + Any CPU + ..\bin-Avalonia\publish\linux-x64\ + FileSystem + net6.0 + linux-x64 + false + false + + \ No newline at end of file diff --git a/Source/LibationCli/Properties/PublishProfiles/FolderProfile.pubxml b/Source/LibationCli/Properties/PublishProfiles/FolderProfile.pubxml index f8c490cc..257cfc2b 100644 --- a/Source/LibationCli/Properties/PublishProfiles/FolderProfile.pubxml +++ b/Source/LibationCli/Properties/PublishProfiles/FolderProfile.pubxml @@ -12,5 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-x64 true false + false \ No newline at end of file diff --git a/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml b/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml index b6b51814..fe716d12 100644 --- a/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml +++ b/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - ..\bin\publish\linux-x64 + ..\bin-Avalonia\publish\linux-x64 FileSystem net6.0 linux-x64 diff --git a/Source/LibationWinForms/AvaloniaUI/App.axaml b/Source/LibationWinForms/AvaloniaUI/App.axaml deleted file mode 100644 index f8ef3650..00000000 --- a/Source/LibationWinForms/AvaloniaUI/App.axaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/LibationWinForms/AvaloniaUI/App.axaml.cs b/Source/LibationWinForms/AvaloniaUI/App.axaml.cs deleted file mode 100644 index 82de0d3d..00000000 --- a/Source/LibationWinForms/AvaloniaUI/App.axaml.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; -using Avalonia.Media; -using LibationFileManager; -using LibationWinForms.AvaloniaUI.Views; -using System; - -namespace LibationWinForms.AvaloniaUI -{ - public class App : Application - { - public static IBrush ProcessQueueBookFailedBrush { get; private set; } - public static IBrush ProcessQueueBookCompletedBrush { get; private set; } - public static IBrush ProcessQueueBookCancelledBrush { get; private set; } - public static IBrush ProcessQueueBookDefaultBrush { get; private set; } - public static IBrush SeriesEntryGridBackgroundBrush { get; private set; } - - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } - - public override void OnFrameworkInitializationCompleted() - { - LoadStyles(); - - var SEGOEUI = new Typeface(new FontFamily(new Uri("avares://Libation/AvaloniaUI/Assets/WINGDING.TTF"), "SEGOEUI_Local")); - var gtf = FontManager.Current.GetOrAddGlyphTypeface(SEGOEUI); - - - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - var mainWindow = new MainWindow(); - desktop.MainWindow = mainWindow; - mainWindow.RestoreSizeAndLocation(Configuration.Instance); - mainWindow.OnLoad(); - } - - base.OnFrameworkInitializationCompleted(); - } - - private void LoadStyles() - { - ProcessQueueBookFailedBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookFailedBrush"); - ProcessQueueBookCompletedBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookCompletedBrush"); - ProcessQueueBookCancelledBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookCancelledBrush"); - ProcessQueueBookDefaultBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookDefaultBrush"); - SeriesEntryGridBackgroundBrush = AvaloniaUtils.GetBrushFromResources("SeriesEntryGridBackgroundBrush"); - } - } -} \ No newline at end of file diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/1x1.png b/Source/LibationWinForms/AvaloniaUI/Assets/1x1.png deleted file mode 100644 index 1914264c..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/1x1.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/DataGridTheme.xaml b/Source/LibationWinForms/AvaloniaUI/Assets/DataGridTheme.xaml deleted file mode 100644 index 904b6a2b..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Assets/DataGridTheme.xaml +++ /dev/null @@ -1,658 +0,0 @@ - - - 0.6 - 0.8 - 12,0,12,0 - - M1875 1011l-787 787v-1798h-128v1798l-787 -787l-90 90l941 941l941 -941z - M515 93l930 931l-930 931l90 90l1022 -1021l-1022 -1021z - M1939 1581l90 -90l-1005 -1005l-1005 1005l90 90l915 -915z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/LibationStyles.xaml b/Source/LibationWinForms/AvaloniaUI/Assets/LibationStyles.xaml deleted file mode 100644 index e1e3f5ce..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Assets/LibationStyles.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - #FFE6FFE6 - - - - - - - - - \ No newline at end of file diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Asterisk.png b/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Asterisk.png deleted file mode 100644 index c345a8f9..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Asterisk.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Exclamation.png b/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Exclamation.png deleted file mode 100644 index cc884984..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Exclamation.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Question.png b/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Question.png deleted file mode 100644 index 3aeb017c..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/Question.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/error.png b/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/error.png deleted file mode 100644 index 916e14f1..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/MBIcons/error.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/SEGOEUI.TTF b/Source/LibationWinForms/AvaloniaUI/Assets/SEGOEUI.TTF deleted file mode 100644 index 0f52cbd9..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/SEGOEUI.TTF and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/WINGDING.TTF b/Source/LibationWinForms/AvaloniaUI/Assets/WINGDING.TTF deleted file mode 100644 index 6e38f7fd..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/WINGDING.TTF and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/cancel.png b/Source/LibationWinForms/AvaloniaUI/Assets/cancel.png deleted file mode 100644 index fa34f935..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/cancel.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/completed.png b/Source/LibationWinForms/AvaloniaUI/Assets/completed.png deleted file mode 100644 index 3cd61981..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/completed.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/down.png b/Source/LibationWinForms/AvaloniaUI/Assets/down.png deleted file mode 100644 index 2536c961..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/down.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/edit_25x25.png b/Source/LibationWinForms/AvaloniaUI/Assets/edit_25x25.png deleted file mode 100644 index 12e70d0f..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/edit_25x25.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/errored.png b/Source/LibationWinForms/AvaloniaUI/Assets/errored.png deleted file mode 100644 index bb8ba7ef..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/errored.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/first.png b/Source/LibationWinForms/AvaloniaUI/Assets/first.png deleted file mode 100644 index e470c697..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/first.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/glass-with-glow_16.png b/Source/LibationWinForms/AvaloniaUI/Assets/glass-with-glow_16.png deleted file mode 100644 index 05e40bec..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/glass-with-glow_16.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/import_16x16.png b/Source/LibationWinForms/AvaloniaUI/Assets/import_16x16.png deleted file mode 100644 index 40b582b1..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/import_16x16.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/last.png b/Source/LibationWinForms/AvaloniaUI/Assets/last.png deleted file mode 100644 index 3c3ea886..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/last.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/libation.ico b/Source/LibationWinForms/AvaloniaUI/Assets/libation.ico deleted file mode 100644 index d3e00443..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/libation.ico and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/queued.png b/Source/LibationWinForms/AvaloniaUI/Assets/queued.png deleted file mode 100644 index f30221c3..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/queued.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/Assets/up.png b/Source/LibationWinForms/AvaloniaUI/Assets/up.png deleted file mode 100644 index 7c00155a..00000000 Binary files a/Source/LibationWinForms/AvaloniaUI/Assets/up.png and /dev/null differ diff --git a/Source/LibationWinForms/AvaloniaUI/AvaloniaUtils.cs b/Source/LibationWinForms/AvaloniaUI/AvaloniaUtils.cs deleted file mode 100644 index 200d8cf5..00000000 --- a/Source/LibationWinForms/AvaloniaUI/AvaloniaUtils.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Avalonia.Media; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace LibationWinForms.AvaloniaUI -{ - internal static class AvaloniaUtils - { - public static IBrush GetBrushFromResources(string name) - => GetBrushFromResources(name, Brushes.Transparent); - public static IBrush GetBrushFromResources(string name, IBrush defaultBrush) - { - if (App.Current.Styles.TryGetResource(name, out var value) && value is IBrush brush) - return brush; - return defaultBrush; - } - - public static T ShowDialogSynchronously(this Avalonia.Controls.Window window, Avalonia.Controls.Window owner) - { - using var source = new CancellationTokenSource(); - var dialogTask = window.ShowDialog(owner); - dialogTask.ContinueWith(t => source.Cancel(), TaskScheduler.FromCurrentSynchronizationContext()); - Avalonia.Threading.Dispatcher.UIThread.MainLoop(source.Token); - return dialogTask.Result; - } - } -} diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/DataGridCheckBoxColumnExt.axaml b/Source/LibationWinForms/AvaloniaUI/Controls/DataGridCheckBoxColumnExt.axaml deleted file mode 100644 index d67603fe..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Controls/DataGridCheckBoxColumnExt.axaml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/DataGridCheckBoxColumnExt.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Controls/DataGridCheckBoxColumnExt.axaml.cs deleted file mode 100644 index 2c7ca7be..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Controls/DataGridCheckBoxColumnExt.axaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Avalonia.Controls; -using LibationWinForms.AvaloniaUI.ViewModels; -using System; - -namespace LibationWinForms.AvaloniaUI.Controls -{ - public partial class DataGridCheckBoxColumnExt : DataGridCheckBoxColumn - { - protected override IControl GenerateEditingElementDirect(DataGridCell cell, object dataItem) - { - //Only SeriesEntry types have three-state checks, individual LibraryEntry books are binary. - var ele = base.GenerateEditingElementDirect(cell, dataItem) as CheckBox; - ele.IsThreeState = dataItem is SeriesEntry; - return ele; - } - } -} diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/DirectoryOrCustomSelectControl.axaml b/Source/LibationWinForms/AvaloniaUI/Controls/DirectoryOrCustomSelectControl.axaml deleted file mode 100644 index afda8d61..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Controls/DirectoryOrCustomSelectControl.axaml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxWindow.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxWindow.axaml.cs deleted file mode 100644 index f28c3f56..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxWindow.axaml.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; -using LibationWinForms.AvaloniaUI.ViewModels.Dialogs; - -namespace LibationWinForms.AvaloniaUI.Views.Dialogs -{ - - public partial class MessageBoxWindow : DialogWindow - { - public MessageBoxWindow() - { - InitializeComponent(); - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - - protected override void CancelAndClose() => Close(DialogResult.None); - - protected override void SaveAndClose() { } - - public DialogResult DialogResult { get; private set; } - - public void Button1_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - var vm = DataContext as MessageBoxViewModel; - DialogResult = vm.Buttons switch - { - MessageBoxButtons.OK => DialogResult.OK, - MessageBoxButtons.OKCancel => DialogResult.OK, - MessageBoxButtons.AbortRetryIgnore => DialogResult.Abort, - MessageBoxButtons.YesNoCancel => DialogResult.Yes, - MessageBoxButtons.YesNo => DialogResult.Yes, - MessageBoxButtons.RetryCancel => DialogResult.Retry, - MessageBoxButtons.CancelTryContinue => DialogResult.Cancel, - _ => DialogResult.None - }; - Close(DialogResult); - } - public void Button2_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - var vm = DataContext as MessageBoxViewModel; - DialogResult = vm.Buttons switch - { - MessageBoxButtons.OKCancel => DialogResult.Cancel, - MessageBoxButtons.AbortRetryIgnore => DialogResult.Retry, - MessageBoxButtons.YesNoCancel => DialogResult.No, - MessageBoxButtons.YesNo => DialogResult.No, - MessageBoxButtons.RetryCancel => DialogResult.Cancel, - MessageBoxButtons.CancelTryContinue => DialogResult.TryAgain, - _ => DialogResult.None - }; - Close(DialogResult); - } - public void Button3_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - var vm = DataContext as MessageBoxViewModel; - DialogResult = vm.Buttons switch - { - MessageBoxButtons.AbortRetryIgnore => DialogResult.Ignore, - MessageBoxButtons.YesNoCancel => DialogResult.Cancel, - MessageBoxButtons.CancelTryContinue => DialogResult.Continue, - _ => DialogResult.None - }; - Close(DialogResult); - } - } -} diff --git a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/ScanAccountsDialog.axaml b/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/ScanAccountsDialog.axaml deleted file mode 100644 index 83617c20..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/ScanAccountsDialog.axaml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProcessBookControl.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProcessBookControl.axaml.cs deleted file mode 100644 index 48125801..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/ProcessBookControl.axaml.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Avalonia; -using System; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; -using LibationWinForms.AvaloniaUI.ViewModels; -using ApplicationServices; -using DataLayer; - -namespace LibationWinForms.AvaloniaUI.Views -{ - public delegate void QueueItemPositionButtonClicked(ProcessBookViewModel item, QueuePosition queueButton); - public delegate void QueueItemCancelButtonClicked(ProcessBookViewModel item); - public partial class ProcessBookControl : UserControl - { - public static event QueueItemPositionButtonClicked PositionButtonClicked; - public static event QueueItemCancelButtonClicked CancelButtonClicked; - public ProcessBookControl() - { - InitializeComponent(); - - if (Design.IsDesignMode) - { - using var context = DbContexts.GetContext(); - DataContext = new ProcessBookViewModel( - context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), - LogMe.RegisterForm(default(ILogForm)) - ); - return; - } - } - - private ProcessBookViewModel DataItem => DataContext is null ? null : DataContext as ProcessBookViewModel; - - public void Cancel_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - => CancelButtonClicked?.Invoke(DataItem); - public void MoveFirst_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - => PositionButtonClicked?.Invoke(DataItem, QueuePosition.Fisrt); - public void MoveUp_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - => PositionButtonClicked?.Invoke(DataItem, QueuePosition.OneUp); - public void MoveDown_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - => PositionButtonClicked?.Invoke(DataItem, QueuePosition.OneDown); - public void MoveLast_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - => PositionButtonClicked?.Invoke(DataItem, QueuePosition.Last); - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - } -} diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProcessQueueControl.axaml b/Source/LibationWinForms/AvaloniaUI/Views/ProcessQueueControl.axaml deleted file mode 100644 index d57b3002..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/ProcessQueueControl.axaml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Process Queue - - - - - - - - - - - - - - - - - Queue Log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProcessQueueControl.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProcessQueueControl.axaml.cs deleted file mode 100644 index fcaee7af..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/ProcessQueueControl.axaml.cs +++ /dev/null @@ -1,151 +0,0 @@ -using ApplicationServices; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; -using DataLayer; -using LibationWinForms.AvaloniaUI.ViewModels; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace LibationWinForms.AvaloniaUI.Views -{ - public partial class ProcessQueueControl : UserControl - { - private TrackedQueue Queue => _viewModel.Items; - private ProcessQueueViewModel _viewModel => DataContext as ProcessQueueViewModel; - - public ProcessQueueControl() - { - InitializeComponent(); - - ProcessBookControl.PositionButtonClicked += ProcessBookControl2_ButtonClicked; - ProcessBookControl.CancelButtonClicked += ProcessBookControl2_CancelButtonClicked; - - #region Design Mode Testing - if (Design.IsDesignMode) - { - var vm = new ProcessQueueViewModel(); - var Logger = LogMe.RegisterForm(vm); - DataContext = vm; - using var context = DbContexts.GetContext(); - List testList = new() - { - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), Logger) - { - Result = ProcessBookResult.FailedAbort, - Status = ProcessBookStatus.Failed, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG"), Logger) - { - Result = ProcessBookResult.FailedSkip, - Status = ProcessBookStatus.Failed, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q"), Logger) - { - Result = ProcessBookResult.FailedRetry, - Status = ProcessBookStatus.Failed, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4NUPO"), Logger) - { - Result = ProcessBookResult.ValidationFail, - Status = ProcessBookStatus.Failed, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4NMX4"), Logger) - { - Result = ProcessBookResult.Cancelled, - Status = ProcessBookStatus.Cancelled, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4NOZ0"), Logger) - { - Result = ProcessBookResult.Success, - Status = ProcessBookStatus.Completed, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017WJ5ZK6"), Logger) - { - Result = ProcessBookResult.None, - Status = ProcessBookStatus.Working, - }, - new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), Logger) - { - Result = ProcessBookResult.None, - Status = ProcessBookStatus.Queued, - }, - }; - - vm.Items.Enqueue(testList); - vm.Items.MoveNext(); - vm.Items.MoveNext(); - vm.Items.MoveNext(); - vm.Items.MoveNext(); - vm.Items.MoveNext(); - vm.Items.MoveNext(); - vm.Items.MoveNext(); - return; - } - #endregion - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - - #region Control event handlers - - private async void ProcessBookControl2_CancelButtonClicked(ProcessBookViewModel item) - { - if (item is not null) - await item.CancelAsync(); - Queue.RemoveQueued(item); - } - - private void ProcessBookControl2_ButtonClicked(ProcessBookViewModel item, QueuePosition queueButton) - { - Queue.MoveQueuePosition(item, queueButton); - } - - public async void CancelAllBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - { - Queue.ClearQueue(); - if (Queue.Current is not null) - await Queue.Current.CancelAsync(); - } - - public void ClearFinishedBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - { - Queue.ClearCompleted(); - - if (!_viewModel.Running) - _viewModel.RunningTime = string.Empty; - } - - public void ClearLogBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - { - _viewModel.LogEntries.Clear(); - } - - private async void LogCopyBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - { - string logText = string.Join("\r\n", _viewModel.LogEntries.Select(r => $"{r.LogDate.ToShortDateString()} {r.LogDate.ToShortTimeString()}\t{r.LogMessage}")); - await Application.Current.Clipboard.SetTextAsync(logText); - } - - private async void cancelAllBtn_Click(object sender, EventArgs e) - { - Queue.ClearQueue(); - if (Queue.Current is not null) - await Queue.Current.CancelAsync(); - } - - private void btnClearFinished_Click(object sender, EventArgs e) - { - Queue.ClearCompleted(); - - if (!_viewModel.Running) - _viewModel.RunningTime = string.Empty; - } - - #endregion - } -} diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay.axaml b/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay.axaml deleted file mode 100644 index 99f2dd8f..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay.axaml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay.axaml.cs deleted file mode 100644 index 33426bd3..00000000 --- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay.axaml.cs +++ /dev/null @@ -1,300 +0,0 @@ -using ApplicationServices; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; -using DataLayer; -using FileLiberator; -using LibationFileManager; -using LibationWinForms.AvaloniaUI.ViewModels; -using LibationWinForms.AvaloniaUI.Views.Dialogs; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace LibationWinForms.AvaloniaUI.Views -{ - public partial class ProductsDisplay : UserControl - { - public event EventHandler LiberateClicked; - - private ProductsDisplayViewModel _viewModel => DataContext as ProductsDisplayViewModel; - ImageDisplayDialog imageDisplayDialog; - - public ProductsDisplay() - { - InitializeComponent(); - - if (Design.IsDesignMode) - { - using var context = DbContexts.GetContext(); - List sampleEntries = new() - { - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G")), - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG")), - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q")), - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4NUPO")), - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4NMX4")), - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4NOZ0")), - new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017WJ5ZK6")), - }; - DataContext = new ProductsDisplayViewModel(sampleEntries); - return; - } - - Configure_ColumnCustomization(); - foreach (var column in productsGrid.Columns) - { - column.CustomSortComparer = new RowComparer(column); - } - } - - private void ProductsGrid_Sorting(object sender, DataGridColumnEventArgs e) - { - _viewModel.Sort(e.Column); - } - - private void RemoveColumn_PropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) - { - if (sender is DataGridColumn col && e.Property.Name == nameof(DataGridColumn.IsVisible)) - { - col.DisplayIndex = 0; - col.CanUserReorder = false; - } - } - - public void DataGrid_CopyToClipboard(object sender, DataGridRowClipboardEventArgs e) - { - - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - - productsGrid = this.FindControl(nameof(productsGrid)); - } - - #region Column Customizations - - private void Configure_ColumnCustomization() - { - if (Design.IsDesignMode) return; - - productsGrid.ColumnDisplayIndexChanged += ProductsGrid_ColumnDisplayIndexChanged; - - var config = Configuration.Instance; - var gridColumnsVisibilities = config.GridColumnsVisibilities; - var displayIndices = config.GridColumnsDisplayIndices; - - var contextMenu = new ContextMenu(); - contextMenu.MenuClosed += ContextMenu_MenuClosed; - contextMenu.ContextMenuOpening += ContextMenu_ContextMenuOpening; - List menuItems = new(); - contextMenu.Items = menuItems; - - menuItems.Add(new MenuItem { Header = "Show / Hide Columns" }); - menuItems.Add(new MenuItem { Header = "-" }); - - var HeaderCell_PI = typeof(DataGridColumn).GetProperty("HeaderCell", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - - foreach (var column in productsGrid.Columns) - { - var itemName = column.SortMemberPath; - - if (itemName == nameof(GridEntry.Remove)) - continue; - - menuItems.Add - ( - new MenuItem - { - Header = ((string)column.Header).Replace((char)0xa, ' '), - Tag = column, - Margin = new Thickness(6, 0), - Icon = new CheckBox - { - Width = 50, - } - } - ); - - var headercell = HeaderCell_PI.GetValue(column) as DataGridColumnHeader; - headercell.ContextMenu = contextMenu; - - column.IsVisible = gridColumnsVisibilities.GetValueOrDefault(itemName, true); - } - - //We must set DisplayIndex properties in ascending order - foreach (var itemName in displayIndices.OrderBy(i => i.Value).Select(i => i.Key)) - { - if (!productsGrid.Columns.Any(c => c.SortMemberPath == itemName)) - continue; - - var column = productsGrid.Columns - .Single(c => c.SortMemberPath == itemName); - - column.DisplayIndex = displayIndices.GetValueOrDefault(itemName, productsGrid.Columns.IndexOf(column)); - } - } - - private void ContextMenu_ContextMenuOpening(object sender, System.ComponentModel.CancelEventArgs e) - { - var contextMenu = sender as ContextMenu; - foreach (var mi in contextMenu.Items.OfType()) - { - if (mi.Tag is DataGridColumn column) - { - var cbox = mi.Icon as CheckBox; - cbox.IsChecked = column.IsVisible; - } - } - } - - private void ContextMenu_MenuClosed(object sender, Avalonia.Interactivity.RoutedEventArgs e) - { - var contextMenu = sender as ContextMenu; - var config = Configuration.Instance; - var dictionary = config.GridColumnsVisibilities; - - foreach (var mi in contextMenu.Items.OfType()) - { - if (mi.Tag is DataGridColumn column) - { - var cbox = mi.Icon as CheckBox; - column.IsVisible = cbox.IsChecked == true; - dictionary[column.SortMemberPath] = cbox.IsChecked == true; - } - } - - //If all columns are hidden, register the context menu on the grid so users can unhide. - if (!productsGrid.Columns.Any(c => c.IsVisible)) - productsGrid.ContextMenu = contextMenu; - else - productsGrid.ContextMenu = null; - - config.GridColumnsVisibilities = dictionary; - } - - private void ProductsGrid_ColumnDisplayIndexChanged(object sender, DataGridColumnEventArgs e) - { - var config = Configuration.Instance; - - var dictionary = config.GridColumnsDisplayIndices; - dictionary[e.Column.SortMemberPath] = e.Column.DisplayIndex; - config.GridColumnsDisplayIndices = dictionary; - } - - #endregion - - #region Button Click Handlers - - public void LiberateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - var button = args.Source as Button; - - if (button.DataContext is SeriesEntry sEntry) - { - _viewModel.ToggleSeriesExpanded(sEntry); - - //Expanding and collapsing reset the list, which will cause focus to shift - //to the topright cell. Reset focus onto the clicked button's cell. - ((sender as Control).Parent.Parent as DataGridCell)?.Focus(); - } - else if (button.DataContext is LibraryBookEntry lbEntry) - { - LiberateClicked?.Invoke(this, lbEntry.LibraryBook); - } - } - - public void CloseImageDisplay() - { - if (imageDisplayDialog is not null && imageDisplayDialog.IsVisible) - imageDisplayDialog.Close(); - } - - public void Cover_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - if (sender is not Image tblock || tblock.DataContext is not GridEntry gEntry) - return; - - - if (imageDisplayDialog is null || !imageDisplayDialog.IsVisible) - { - imageDisplayDialog = new ImageDisplayDialog(); - } - - var picDef = new PictureDefinition(gEntry.LibraryBook.Book.PictureLarge ?? gEntry.LibraryBook.Book.PictureId, PictureSize.Native); - - void PictureCached(object sender, PictureCachedEventArgs e) - { - if (e.Definition.PictureId == picDef.PictureId) - imageDisplayDialog.CoverBytes = e.Picture; - - PictureStorage.PictureCached -= PictureCached; - } - - PictureStorage.PictureCached += PictureCached; - (bool isDefault, byte[] initialImageBts) = PictureStorage.GetPicture(picDef); - - - var windowTitle = $"{gEntry.Title} - Cover"; - - - imageDisplayDialog.BookSaveDirectory = AudibleFileStorage.Audio.GetDestinationDirectory(gEntry.LibraryBook); - imageDisplayDialog.PictureFileName = System.IO.Path.GetFileName(AudibleFileStorage.Audio.GetBooksDirectoryFilename(gEntry.LibraryBook, ".jpg")); - imageDisplayDialog.Title = windowTitle; - imageDisplayDialog.CoverBytes = initialImageBts; - - if (!isDefault) - PictureStorage.PictureCached -= PictureCached; - - if (!imageDisplayDialog.IsVisible) - imageDisplayDialog.Show(); - } - - public void Description_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - if (sender is TextBlock tblock && tblock.DataContext is GridEntry gEntry) - { - var pt = tblock.Parent.PointToScreen(tblock.Parent.Bounds.TopRight); - var displayWindow = new DescriptionDisplayDialog - { - SpawnLocation = new Point(pt.X, pt.Y), - DescriptionText = gEntry.LongDescription, - }; - - void CloseWindow(object o, DataGridRowEventArgs e) - { - displayWindow.Close(); - } - productsGrid.LoadingRow += CloseWindow; - displayWindow.Closing += (_, _) => - { - productsGrid.LoadingRow -= CloseWindow; - }; - - displayWindow.Show(); - } - } - - BookDetailsDialog bookDetailsForm; - - public void OnTagsButtonClick(object sender, Avalonia.Interactivity.RoutedEventArgs args) - { - var button = args.Source as Button; - - if (button.DataContext is LibraryBookEntry lbEntry && VisualRoot is Window window) - { - if (bookDetailsForm is null || !bookDetailsForm.IsVisible) - { - bookDetailsForm = new BookDetailsDialog(lbEntry.LibraryBook); - bookDetailsForm.Show(window); - } - else - bookDetailsForm.LibraryBook = lbEntry.LibraryBook; - } - } - - #endregion - } -} diff --git a/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index 1778994a..c32ac641 100644 --- a/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -51,7 +51,6 @@ this.loggingLevelCb = new System.Windows.Forms.ComboBox(); this.tabControl = new System.Windows.Forms.TabControl(); this.tab1ImportantSettings = new System.Windows.Forms.TabPage(); - this.betaOptInCbox = new System.Windows.Forms.CheckBox(); this.booksGb = new System.Windows.Forms.GroupBox(); this.saveEpisodesToSeriesFolderCbox = new System.Windows.Forms.CheckBox(); this.tab2ImportLibrary = new System.Windows.Forms.TabPage(); @@ -111,6 +110,7 @@ this.retainAaxFileCbox = new System.Windows.Forms.CheckBox(); this.downloadCoverArtCbox = new System.Windows.Forms.CheckBox(); this.createCueSheetCbox = new System.Windows.Forms.CheckBox(); + this.betaOptInCbox = new System.Windows.Forms.CheckBox(); this.badBookGb.SuspendLayout(); this.tabControl.SuspendLayout(); this.tab1ImportantSettings.SuspendLayout(); @@ -388,16 +388,6 @@ this.tab1ImportantSettings.Text = "Important settings"; this.tab1ImportantSettings.UseVisualStyleBackColor = true; // - // betaOptInCbox - // - this.betaOptInCbox.AutoSize = true; - this.betaOptInCbox.Location = new System.Drawing.Point(13, 358); - this.betaOptInCbox.Name = "betaOptInCbox"; - this.betaOptInCbox.Size = new System.Drawing.Size(107, 19); - this.betaOptInCbox.TabIndex = 6; - this.betaOptInCbox.Text = "[Opt in to Beta]"; - this.betaOptInCbox.UseVisualStyleBackColor = true; - // // booksGb // this.booksGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -1060,6 +1050,17 @@ this.createCueSheetCbox.UseVisualStyleBackColor = true; this.createCueSheetCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); // + // betaOptInCbox + // + this.betaOptInCbox.AutoSize = true; + this.betaOptInCbox.Enabled = false; + this.betaOptInCbox.Location = new System.Drawing.Point(13, 358); + this.betaOptInCbox.Name = "betaOptInCbox"; + this.betaOptInCbox.Size = new System.Drawing.Size(107, 19); + this.betaOptInCbox.TabIndex = 6; + this.betaOptInCbox.Text = "[Opt in to Beta]"; + this.betaOptInCbox.UseVisualStyleBackColor = true; + // // SettingsDialog // this.AcceptButton = this.saveBtn; diff --git a/Source/LibationWinForms/LibationWinForms.csproj b/Source/LibationWinForms/LibationWinForms.csproj index 6b70a8d1..dcd48471 100644 --- a/Source/LibationWinForms/LibationWinForms.csproj +++ b/Source/LibationWinForms/LibationWinForms.csproj @@ -38,44 +38,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -104,23 +73,7 @@ - - - - MSBuild:Compile - - - - - ProcessBookControl.axaml - - - ProcessQueueControl.axaml - - - ProductsDisplay.axaml - True True @@ -135,12 +88,4 @@ - - - - - - - - \ No newline at end of file