Created
June 20, 2021 13:32
-
-
Save rdelrosario/3b0325f7866d076ac5b122e48098984d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ReactiveToDoSample.ViewModels | |
{ | |
public abstract class ViewModelBase : ReactiveObject, IDisposable, INavigable | |
{ | |
protected ViewModelBase(IParameterViewStackService viewStackService) => NavigationService = viewStackService; | |
public abstract string Id { get; } | |
public virtual IObservable<Unit> WhenNavigatedFrom(INavigationParameter parameter) => Observable.Return(Unit.Default); | |
public virtual IObservable<Unit> WhenNavigatedTo(INavigationParameter parameter) => Observable.Return(Unit.Default); | |
public virtual IObservable<Unit> WhenNavigatingTo(INavigationParameter parameter) => Observable.Return(Unit.Default); | |
protected IParameterViewStackService NavigationService { get; } | |
public void Dispose() | |
{ | |
Dispose(true); | |
GC.SuppressFinalize(this); | |
} | |
protected virtual void Dispose(bool disposing) | |
{ | |
if (disposing) | |
{ | |
Subscriptions?.Dispose(); | |
} | |
} | |
protected readonly CompositeDisposable Subscriptions = new CompositeDisposable(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment