public void CanExecute_false_if_username_and_password_are_null() { _loginViewModel.Username = null; _loginViewModel.Password = null; Assert.IsFalse(_command.CanExecute(null)); }
private void SwitchMenuFlyoutItem_Tapped(object sender, TappedRoutedEventArgs e) { if (IsLoggedIn) { if (IsSelected) { return; } if (SwitchUserTapped != null) { SwitchUserTapped(this, e); } if (SwitchUserCommand.CanExecute(Header)) { SwitchUserCommand.Execute(Header); } } else { if (LoginTapped != null) { LoginTapped(this, e); } if (LoginCommand.CanExecute(Header)) { LoginCommand.Execute(Header); } } }
private void LoginLogoutMenuFlyoutItem_Tapped(object sender, TappedRoutedEventArgs e) { if (IsLoggedIn) { if (LogoutTapped != null) { LogoutTapped(this, e); } if (LogoutCommand.CanExecute(Header)) { LogoutCommand.Execute(Header); } } else { if (LoginTapped != null) { LoginTapped(this, e); } if (LoginCommand.CanExecute(Header)) { LoginCommand.Execute(Header); } } }
public override async void TryInitializeModules() { _logger.Debug(string.Format("{0} tries to initialize the view models", this)); _states.ChangeToLoadingState(); try { Action <string> updateInitializationMessage = m => ModuleInInitialization = m; await _provideInitializationState.SubscribeForInitializationEvents(updateInitializationMessage); bool modulesInitialized = await _provideInitializationState.AreAllModulesInitialized(); if (modulesInitialized) { InitializeScreens(); await _provideInitializationState.UnsubscribeFromInitializationEvents(updateInitializationMessage); _states.ChangeToContentState(); LoginCommand.CanExecute(null); _logger.Debug(string.Format("{0} successfully initialized the modules.", this)); } } catch (Exception exception) { string errorMessage = new StringBuilder() .AppendLine("An error occured while intializing the Remote UI:") .Append(exception).ToString(); _logger.ErrorFormat("{0} failed to initalize the modules: '{1}'", this, errorMessage); _states.ChangeToErrorState(errorMessage); } }
private void passwordBox_KeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == VirtualKey.Enter && LoginCommand.CanExecute()) { LoginCommand.Execute(); InputPane.GetForCurrentView().TryHide(); } }
public virtual void TryInitializeModules() { _logger.Debug(string.Format("{0} tries to initialize the view models", this)); _states.ChangeToLoadingState(); try { Action <string> updateInitializationMessage = m => ModuleInInitialization = m; InitializeScreens(); HeadBarViewModel.BreadcrumbBarViewModel = new BreadcrumbBarViewModel(_homeScreen); NavigateToHome(); _states.ChangeToContentState(); LoginCommand.CanExecute(null); _logger.Debug(string.Format("{0} successfully initialized the modules.", this)); } catch (Exception exception) { string errorMessage = new StringBuilder() .AppendLine("An error occured while intializing the Remote UI:") .Append(exception).ToString(); _logger.ErrorFormat("{0} failed to initalize the modules: '{1}'", this, errorMessage); _states.ChangeToErrorState(errorMessage); } }