2020-01-05 02:33:38 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reactive.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using ReactiveUI;
|
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
public class BackNavigatingVM : ViewModel
|
|
|
|
|
{
|
|
|
|
|
[Reactive]
|
|
|
|
|
public ViewModel NavigateBackTarget { get; set; }
|
|
|
|
|
public ICommand BackCommand { get; }
|
|
|
|
|
|
|
|
|
|
public BackNavigatingVM(MainWindowVM mainWindowVM)
|
|
|
|
|
{
|
|
|
|
|
BackCommand = ReactiveCommand.Create(
|
2020-01-05 02:50:05 +00:00
|
|
|
|
execute: () => Utils.CatchAndLog(() => mainWindowVM.NavigateTo(NavigateBackTarget)),
|
2020-01-05 02:33:38 +00:00
|
|
|
|
canExecute: this.WhenAny(x => x.NavigateBackTarget)
|
|
|
|
|
.Select(x => x != null)
|
|
|
|
|
.ObserveOnGuiThread());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|