Я обновил Mvvmcross с 5.7 до 6.x. Навигация работает, но она не работает, когда я представляю BaseViewModel. Это образец моей StartPageViewModel
public class StartPageViewModel : MvxViewModel
{
protected readonly IUserSettings _userSettings;
private readonly IMvxNavigationService _navigationService;
public StartPageViewModel(IUserSettings userSettings,
IMvxNavigationService navigationService)
{
_userSettings = userSettings;
_navigationService = navigationService;
}
public IUserSettings UserSettings
{
get
{
return _userSettings;
}
}
]private IMvxCommand _loginCommand;
public IMvxCommand LoginCommand
{
get
{
return _loginCommand ?? (_loginCommand = new MvxCommand(() =>
_navigationService.Navigate<LoginViewModel>()));
}
}
public void NavigateToDashboardIfAlreadyLoggedIn()
{
}
public override void Start()
{
base.Start();
NavigateToDashboardIfAlreadyLoggedIn();
}
}
Пример LoginViewModel
public class LoginViewModel : BaseValidationViewModel
{
public LoginViewModel(IMvxLogProvider logProvider,
IUserSettings userSettings,
IAuthenticationManager authenticationManager,
IEventLogger eventLogger,
IMvxNavigationService navigationService)
: base(userSettings, eventLogger, authenticationManager, navigationService)
{
_navigationService = navigationService;
}
}
Я хочу перейти к LoginViewModel с помощью BaseViewModel, но моя модель представления не может видеть представление, т.е. LoginView.
образец BaseValidationViewModel
public abstract class BaseValidationViewModel : BaseViewModel
{
protected BaseValidationViewModel(IUserSettings userSettings,
IEventLogger eventLogger,
IAuthenticationManager authenticationManager,
IMvxNavigationService navigationService)
: base(userSettings, eventLogger, authenticationManager, navigationService)
{
//Some Code
}
//Some Code
public override void Start()
{
base.Start();
}
}
BaseViewModel
public abstract class BaseViewModel : MvxViewModel
{
protected readonly IUserSettings _userSettings;
protected readonly IEventLogger _eventLogger;
protected readonly IAuthenticationManager _authenticationManager;
private readonly IMvxNavigationService _navigationService;
protected BaseViewModel(IUserSettings userSettings,
IEventLogger eventLogger,
IAuthenticationManager authenticationManager,
IMvxNavigationService navigationService)
{
_userSettings = userSettings;
_eventLogger = eventLogger;
_authenticationManager = authenticationManager;
_navigationService = navigationService;
}
public override void Start()
{
base.Start();
}
}
образец LoginView
`[Register("LoginView")]
[MvxViewFor(typeof(LoginViewModel))]
public partial class LoginView : MvxViewController<LoginViewModel>
{
}`