protected BaseViewModel(IViewStackService viewStackService = null) { this.Log().Write("", GetType(), LogLevel.Info); ViewStackService = viewStackService ?? Locator.Current.GetService <IViewStackService>(); GoBack = ReactiveCommand.CreateFromObservable(() => ViewStackService.PopPages()); GoBackModal = ReactiveCommand.CreateFromObservable(() => ViewStackService.PopModal()); GoBackToRoot = ReactiveCommand.CreateFromObservable(() => ViewStackService.PopToRoot()); this.WhenActivated((CompositeDisposable disposable) => { GoBack .ThrownExceptions .Subscribe(x => { this.Log().ErrorException(nameof(GoBack), x); }).DisposeWith(disposable); GoBackModal .ThrownExceptions .Subscribe(x => { this.Log().ErrorException(nameof(GoBackModal), x); }).DisposeWith(disposable); GoBackToRoot .ThrownExceptions .Subscribe(x => { this.Log().ErrorException(nameof(GoBackToRoot), x); }).DisposeWith(disposable); }); }
public IObservable <Unit> PopModal() => _viewStackService.PopModal();
public void BenchmarkCleanup() { _viewStackService.PopModal(); _viewModel = null; }