diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/ICommandTimeStateViewModel.cs b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/ICommandTimeStateViewModel.cs index 947e820..92f326f 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/ICommandTimeStateViewModel.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/ICommandTimeStateViewModel.cs @@ -3,6 +3,7 @@ namespace FileTime.App.Core.ViewModels.Timeline; public interface ICommandTimeStateViewModel { IObservable TotalProgress { get; } + IObservable CurrentProgress { get; } IObservable DisplayLabel { get; } IObservable IsSelected { get; } } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core/ViewModels/Timeline/CommandTimeStateViewModel.cs b/src/AppCommon/FileTime.App.Core/ViewModels/Timeline/CommandTimeStateViewModel.cs index 99e229d..ce1429f 100644 --- a/src/AppCommon/FileTime.App.Core/ViewModels/Timeline/CommandTimeStateViewModel.cs +++ b/src/AppCommon/FileTime.App.Core/ViewModels/Timeline/CommandTimeStateViewModel.cs @@ -6,6 +6,7 @@ namespace FileTime.App.Core.ViewModels.Timeline; public class CommandTimeStateViewModel : ICommandTimeStateViewModel { public IObservable TotalProgress { get; } + public IObservable CurrentProgress { get; } public IObservable DisplayLabel { get; } @@ -15,6 +16,7 @@ public class CommandTimeStateViewModel : ICommandTimeStateViewModel { DisplayLabel = commandTimeState.Command.DisplayLabel; TotalProgress = commandTimeState.Command.TotalProgress; + CurrentProgress = commandTimeState.Command.CurrentProgress; //TODO IsSelected = new BehaviorSubject(false); } diff --git a/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs b/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs index b298db4..3c077f6 100644 --- a/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs +++ b/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs @@ -19,7 +19,6 @@ public class CopyCommand : CommandBase, ITransportationCommand public FullName Target { get; } public TransportMode TransportMode { get; } - public IObservable CurrentOperationProgress { get; } public CopyCommand( ITimelessContentProvider timelessContentProvider, @@ -31,7 +30,14 @@ public class CopyCommand : CommandBase, ITransportationCommand { _timelessContentProvider = timelessContentProvider; _commandSchedulerNotifier = commandSchedulerNotifier; - CurrentOperationProgress = _currentOperationProgress.AsObservable(); + _currentOperationProgress + .Select(p => + { + if (p is null) return Observable.Never(); + return p.Progress.Select(currentProgress => (int)(currentProgress * 100 / p.TotalCount)); + }) + .Switch() + .Subscribe(SetCurrentProgress); if (sources is null) throw new ArgumentException(nameof(Sources) + " can not be null"); if (targetFullName is null) throw new ArgumentException(nameof(Target) + " can not be null"); @@ -111,7 +117,7 @@ public class CopyCommand : CommandBase, ITransportationCommand if (Sources.Count == 1) { - SetDisplayLabel($"Copy - {Sources.First().GetName()}"); + SetDisplayLabel($"Copy - {Sources[0].GetName()}"); } else { diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml index 76ea137..e70c001 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml @@ -279,6 +279,10 @@ +