Current Progress progressbar
This commit is contained in:
@@ -3,6 +3,7 @@ namespace FileTime.App.Core.ViewModels.Timeline;
|
|||||||
public interface ICommandTimeStateViewModel
|
public interface ICommandTimeStateViewModel
|
||||||
{
|
{
|
||||||
IObservable<int> TotalProgress { get; }
|
IObservable<int> TotalProgress { get; }
|
||||||
|
IObservable<int> CurrentProgress { get; }
|
||||||
IObservable<string> DisplayLabel { get; }
|
IObservable<string> DisplayLabel { get; }
|
||||||
IObservable<bool> IsSelected { get; }
|
IObservable<bool> IsSelected { get; }
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ namespace FileTime.App.Core.ViewModels.Timeline;
|
|||||||
public class CommandTimeStateViewModel : ICommandTimeStateViewModel
|
public class CommandTimeStateViewModel : ICommandTimeStateViewModel
|
||||||
{
|
{
|
||||||
public IObservable<int> TotalProgress { get; }
|
public IObservable<int> TotalProgress { get; }
|
||||||
|
public IObservable<int> CurrentProgress { get; }
|
||||||
|
|
||||||
public IObservable<string> DisplayLabel { get; }
|
public IObservable<string> DisplayLabel { get; }
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ public class CommandTimeStateViewModel : ICommandTimeStateViewModel
|
|||||||
{
|
{
|
||||||
DisplayLabel = commandTimeState.Command.DisplayLabel;
|
DisplayLabel = commandTimeState.Command.DisplayLabel;
|
||||||
TotalProgress = commandTimeState.Command.TotalProgress;
|
TotalProgress = commandTimeState.Command.TotalProgress;
|
||||||
|
CurrentProgress = commandTimeState.Command.CurrentProgress;
|
||||||
//TODO
|
//TODO
|
||||||
IsSelected = new BehaviorSubject<bool>(false);
|
IsSelected = new BehaviorSubject<bool>(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public class CopyCommand : CommandBase, ITransportationCommand
|
|||||||
public FullName Target { get; }
|
public FullName Target { get; }
|
||||||
|
|
||||||
public TransportMode TransportMode { get; }
|
public TransportMode TransportMode { get; }
|
||||||
public IObservable<OperationProgress?> CurrentOperationProgress { get; }
|
|
||||||
|
|
||||||
public CopyCommand(
|
public CopyCommand(
|
||||||
ITimelessContentProvider timelessContentProvider,
|
ITimelessContentProvider timelessContentProvider,
|
||||||
@@ -31,7 +30,14 @@ public class CopyCommand : CommandBase, ITransportationCommand
|
|||||||
{
|
{
|
||||||
_timelessContentProvider = timelessContentProvider;
|
_timelessContentProvider = timelessContentProvider;
|
||||||
_commandSchedulerNotifier = commandSchedulerNotifier;
|
_commandSchedulerNotifier = commandSchedulerNotifier;
|
||||||
CurrentOperationProgress = _currentOperationProgress.AsObservable();
|
_currentOperationProgress
|
||||||
|
.Select(p =>
|
||||||
|
{
|
||||||
|
if (p is null) return Observable.Never<int>();
|
||||||
|
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 (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");
|
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)
|
if (Sources.Count == 1)
|
||||||
{
|
{
|
||||||
SetDisplayLabel($"Copy - {Sources.First().GetName()}");
|
SetDisplayLabel($"Copy - {Sources[0].GetName()}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -279,6 +279,10 @@
|
|||||||
<Border BorderThickness="1" Classes.SelectedTimelineCommand="{Binding IsSelected}">
|
<Border BorderThickness="1" Classes.SelectedTimelineCommand="{Binding IsSelected}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="{Binding DisplayLabel^}" />
|
<TextBlock Text="{Binding DisplayLabel^}" />
|
||||||
|
<ProgressBar
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
Maximum="100"
|
||||||
|
Value="{Binding CurrentProgress^}" />
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
|
|||||||
Reference in New Issue
Block a user