Use IDeclarativeProperty instead of IObservable

This commit is contained in:
2023-08-14 17:55:55 +02:00
parent 4381f1b47a
commit 335433562a
8 changed files with 105 additions and 59 deletions

View File

@@ -1,11 +1,13 @@
using DeclarativeProperty;
namespace FileTime.App.Core.ViewModels.Timeline;
public interface ICommandTimeStateViewModel
{
IObservable<int> TotalProgress { get; }
IObservable<int> CurrentProgress { get; }
IObservable<string> DisplayLabel { get; }
IObservable<string> DisplayDetailLabel { get; }
IObservable<bool> IsSelected { get; }
IDeclarativeProperty<int> TotalProgress { get; }
IDeclarativeProperty<int> CurrentProgress { get; }
IDeclarativeProperty<string> DisplayLabel { get; }
IDeclarativeProperty<string> DisplayDetailLabel { get; }
IDeclarativeProperty<bool> IsSelected { get; }
void Cancel();
}

View File

@@ -1,4 +1,5 @@
using System.Reactive.Subjects;
using DeclarativeProperty;
using FileTime.Core.Timeline;
namespace FileTime.App.Core.ViewModels.Timeline;
@@ -6,13 +7,13 @@ namespace FileTime.App.Core.ViewModels.Timeline;
public class CommandTimeStateViewModel : ICommandTimeStateViewModel
{
private readonly CommandTimeState _commandTimeState;
public IObservable<int> TotalProgress { get; }
public IObservable<int> CurrentProgress { get; }
public IDeclarativeProperty<int> TotalProgress { get; }
public IDeclarativeProperty<int> CurrentProgress { get; }
public IObservable<string> DisplayLabel { get; }
public IObservable<string> DisplayDetailLabel { get; }
public IDeclarativeProperty<string> DisplayLabel { get; }
public IDeclarativeProperty<string> DisplayDetailLabel { get; }
public IObservable<bool> IsSelected { get; }
public IDeclarativeProperty<bool> IsSelected { get; }
public CommandTimeStateViewModel(CommandTimeState commandTimeState)
{
@@ -22,7 +23,7 @@ public class CommandTimeStateViewModel : ICommandTimeStateViewModel
TotalProgress = commandTimeState.Command.TotalProgress;
CurrentProgress = commandTimeState.Command.CurrentProgress;
//TODO
IsSelected = new BehaviorSubject<bool>(false);
IsSelected = new DeclarativeProperty<bool>(false);
}
public void Cancel()