Refactor
This commit is contained in:
parent
e23e267d17
commit
31d6fc8197
@ -14,7 +14,6 @@ namespace LibationWinForms.AvaloniaUI
|
||||
public static IBrush ProcessQueueBookDefaultBrush { get; private set; }
|
||||
public static IBrush SeriesEntryGridBackgroundBrush { get; private set; }
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
@ -84,7 +84,6 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private TimeSpan TimeRemaining { set { ETA = $"ETA: {value:mm\\:ss}"; } }
|
||||
private Processable CurrentProcessable => _currentProcessable ??= Processes.Dequeue().Invoke();
|
||||
private Processable NextProcessable() => _currentProcessable = null;
|
||||
@ -109,7 +108,6 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
|
||||
// Mutable property. Set the field so PropertyChanged isn't fired.
|
||||
using var ms = new System.IO.MemoryStream(picture);
|
||||
_cover = new Bitmap(ms);
|
||||
|
||||
}
|
||||
|
||||
private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e)
|
||||
|
||||
@ -12,15 +12,9 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
|
||||
public class ProcessQueueViewModel : ViewModelBase, ProcessQueue.ILogForm
|
||||
{
|
||||
public ObservableCollection<LogEntry> LogEntries { get; } = new();
|
||||
private TrackedQueue2<ProcessBook2> _items = new();
|
||||
public TrackedQueue2<ProcessBook2> Items
|
||||
{
|
||||
get => _items;
|
||||
set => this.RaiseAndSetIfChanged(ref _items, value);
|
||||
}
|
||||
public TrackedQueue2<ProcessBook2> Items { get; } = new();
|
||||
|
||||
private TrackedQueue2<ProcessBook2> Queue => Items;
|
||||
|
||||
public ProcessBook2 SelectedItem { get; set; }
|
||||
public Task QueueRunner { get; private set; }
|
||||
public bool Running => !QueueRunner?.IsCompleted ?? false;
|
||||
@ -42,15 +36,11 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
|
||||
public int ErrorCount { get => _errorCount; private set { this.RaiseAndSetIfChanged(ref _errorCount, value); this.RaisePropertyChanged(nameof(AnyErrors)); } }
|
||||
public string RunningTime { get => _runningTime; set { this.RaiseAndSetIfChanged(ref _runningTime, value); } }
|
||||
public bool ProgressBarVisible { get => _progressBarVisible; set { this.RaiseAndSetIfChanged(ref _progressBarVisible, value); } }
|
||||
|
||||
public bool AnyCompleted => CompletedCount > 0;
|
||||
public bool AnyQueued => QueuedCount > 0;
|
||||
public bool AnyErrors => ErrorCount > 0;
|
||||
|
||||
public double Progress => 100d * Queue.Completed.Count / Queue.Count;
|
||||
|
||||
|
||||
|
||||
private void Queue_CompletedCountChanged(object sender, int e)
|
||||
{
|
||||
int errCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.FailedAbort or ProcessBookResult.FailedSkip or ProcessBookResult.FailedRetry or ProcessBookResult.ValidationFail);
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
using ApplicationServices;
|
||||
using Avalonia.Collections;
|
||||
using DataLayer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
using ApplicationServices;
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Threading;
|
||||
using Dinah.Core;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
//DONE
|
||||
public partial class MainWindow
|
||||
{
|
||||
private System.ComponentModel.BackgroundWorker updateCountsBw = new();
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
using ApplicationServices;
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Input;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using DataLayer;
|
||||
using DataLayer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
using DataLayer;
|
||||
using DataLayer;
|
||||
using Dinah.Core;
|
||||
using LibationFileManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -2,10 +2,7 @@
|
||||
using LibationFileManager;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@ using System.Linq;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
//WORKING
|
||||
//DONE
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void Configure_RemoveBooks()
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
using ApplicationServices;
|
||||
using AudibleUtilities;
|
||||
using Avalonia.Controls;
|
||||
using Dinah.Core;
|
||||
using LibationFileManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -6,7 +6,6 @@ using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
using ApplicationServices;
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using LibationWinForms.Dialogs;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
using ApplicationServices;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
using DataLayer;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using Dinah.Core.Drawing;
|
||||
using Dinah.Core.Drawing;
|
||||
using LibationFileManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
|
||||
@ -1,15 +1,9 @@
|
||||
using ApplicationServices;
|
||||
using Avalonia;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using DataLayer;
|
||||
using LibationWinForms.AvaloniaUI.Controls;
|
||||
using LibationWinForms.AvaloniaUI.ViewModels;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Avalonia.Threading;
|
||||
using LibationWinForms.AvaloniaUI.Views.ProductsGrid;
|
||||
|
||||
@ -12,24 +12,13 @@ namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
public partial class ProcessQueueControl2 : UserControl
|
||||
{
|
||||
private readonly ProcessQueueViewModel _viewModel;
|
||||
private ItemsRepeater _repeater;
|
||||
private ScrollViewer _scroller;
|
||||
private int _selectedIndex;
|
||||
|
||||
|
||||
private TrackedQueue2<ProcessBook2> Queue => _viewModel.Items;
|
||||
|
||||
private readonly ProcessQueueViewModel _viewModel;
|
||||
private readonly ProcessQueue.LogMe Logger;
|
||||
|
||||
|
||||
public ProcessQueueControl2()
|
||||
{
|
||||
InitializeComponent();
|
||||
_repeater = this.Get<ItemsRepeater>("repeater");
|
||||
_scroller = this.Get<ScrollViewer>("scroller");
|
||||
_repeater.PointerPressed += RepeaterClick;
|
||||
_repeater.KeyDown += RepeaterOnKeyDown;
|
||||
DataContext = _viewModel = new ProcessQueueViewModel();
|
||||
Logger = ProcessQueue.LogMe.RegisterForm(_viewModel);
|
||||
|
||||
@ -178,22 +167,6 @@ namespace LibationWinForms.AvaloniaUI.Views
|
||||
Queue.MoveQueuePosition(item, queueButton);
|
||||
}
|
||||
|
||||
private void RepeaterClick(object sender, PointerPressedEventArgs e)
|
||||
{
|
||||
if ((e.Source as TextBlock)?.DataContext is ProcessBook2 item)
|
||||
{
|
||||
_viewModel.SelectedItem = item;
|
||||
_selectedIndex = _viewModel.Items.IndexOf(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void RepeaterOnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.F5)
|
||||
{
|
||||
//_viewModel.ResetItems();
|
||||
}
|
||||
}
|
||||
public async void CancelAllBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
Queue.ClearQueue();
|
||||
|
||||
@ -11,7 +11,6 @@ namespace LibationWinForms.AvaloniaUI.Views.ProductsGrid
|
||||
{
|
||||
public partial class ProductsDisplay2
|
||||
{
|
||||
|
||||
private GridView.ImageDisplay imageDisplay;
|
||||
private void Configure_Buttons() { }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user