private void NextAction(object o) { TransitionerIndex++; PreviousCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); CreateCommand.RaiseCanExecuteChanged(); }
protected override void OnModelChanged() { NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); FirstCommand.RaiseCanExecuteChanged(); LastCommand.RaiseCanExecuteChanged(); RaisePropertyChanged(nameof(TotalPages)); }
private void RaiseCommandCanExecuteChanged() { PlayCommand.RaiseCanExecuteChanged(); PauseCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); RaisePropertyChanged(nameof(CurrentMedia)); }
private void SetFrameContent() { var item = this.PrevViewStack.Pop(); this.FrameContent = item; this.NextViewStack.Push(item); CompleteCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); }
private void Previous() { _loggingService.WriteLine($"Navigating one step back. New step: {CurrentStep}"); PreviousCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); if (CurrentStep != 3) { CurrentStep -= 1; } else if (CurrentStep == 3) { CurrentStep = 1; } }
private async Task SetNewPokemon(Pokemon newPokemon) { SelectedPokemon = newPokemon; Moves = await _moveRepository.GetMovesById(SelectedPokemon.Moves.QuickMovesIds, SelectedPokemon.Moves.ChargeMovesIds); IEnumerable <EvolutionLineDataViewModel> foundEvolutionLines = Enumerable.Empty <EvolutionLineDataViewModel>(); if (await _evolutionRepository.HasEvolutions(selectedPokemon.DexNumber)) { var evolutionLinesWithIds = await _evolutionRepository.GetEvolutionLines(selectedPokemon.DexNumber); foundEvolutionLines = (await _pokemonRepository.GetPokemonsFromEvolutionLine(evolutionLinesWithIds)) .Select(line => new EvolutionLineDataViewModel(line)); } EvolutionLines = new EvolutionLinesViewModel(foundEvolutionLines); await InitCombatStats(); NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); }
public VehicleInspectionPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator) : base(navigationService) { try { _navigationService = navigationService; this._eventAggregator = eventAggregator; this.InspectionUserControls = new ObservableCollection <UserControl>(); this.CustomerDetails = new CustomerDetails(); this.PrevViewStack = new Stack <UserControl>(); // LoadDemoAppointments(); this.CompleteCommand = new DelegateCommand(async() => { this.IsBusy = true; this._task.ProcessStep = ProcessStep.AcceptInspection; this._task.ShouldSync = true; this._task.Status = Pithline.FMS.BusinessLogic.Helpers.TaskStatus.AwaitDamageConfirmation; await SqliteHelper.Storage.UpdateSingleRecordAsync(this._task); var currentViewModel = ((BaseViewModel)this.NextViewStack.Peek().DataContext); var currentModel = currentViewModel.Model; if (currentViewModel is TTyreConditionUserControlViewModel) { await((TTyreConditionUserControlViewModel)currentViewModel).SaveTrailerTyreConditions(this._task.VehicleInsRecId); } else { this.SaveCurrentUIDataAsync(currentModel); } _navigationService.Navigate("Main", null); await VIServiceHelper.Instance.UpdateTaskStatusAsync(); this.IsBusy = false; }, () => { var vm = ((BaseViewModel)this.NextViewStack.Peek().DataContext); if (vm is InspectionProofUserControlViewModel) { return((this.NextViewStack.Count == 1) && (((InspectionProofUserControlViewModel)vm).CustSignature != null) && (((InspectionProofUserControlViewModel)vm).PithlineRepSignature != null)); } else if (vm is CPOIUserControlViewModel) { return((this.NextViewStack.Count == 1) && (((CPOIUserControlViewModel)vm).CustSignature != null) && (((CPOIUserControlViewModel)vm).PithlineRepSignature != null)); } else { return(this.NextViewStack.Count == 1); } }); this._eventAggregator.GetEvent <SignChangedEvent>().Subscribe(p => { CompleteCommand.RaiseCanExecuteChanged(); }); this._eventAggregator.GetEvent <ErrorsRaisedEvent>().Subscribe((errors) => { Errors = errors; OnPropertyChanged("Errors"); ShowValidationSummary = true; OnPropertyChanged("ShowValidationSummary"); }, ThreadOption.UIThread); this.NextCommand = new DelegateCommand(async() => { //this.IsCommandBarOpen = false; //this.IsFlyoutOpen = true; ShowValidationSummary = false; var currentViewModel = (BaseViewModel)this.NextViewStack.Peek().DataContext; var currentModel = currentViewModel.Model as BaseModel; if (currentModel.ValidateModel() && await currentModel.VehicleDetailsImagesValidate()) { this.PrevViewStack.Push(this.NextViewStack.Pop()); if (currentViewModel is TTyreConditionUserControlViewModel) { await((TTyreConditionUserControlViewModel)currentViewModel).SaveTrailerTyreConditions(this._task.VehicleInsRecId); } else { this.SaveCurrentUIDataAsync(currentModel); } this.FrameContent = this.NextViewStack.Peek(); CompleteCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); if (this.NextViewStack.FirstOrDefault() != null) { BaseViewModel nextViewModel = this.NextViewStack.FirstOrDefault().DataContext as BaseViewModel; await nextViewModel.LoadModelFromDbAsync(this._task.VehicleInsRecId); } } else { Errors = currentModel.Errors; OnPropertyChanged("Errors"); ShowValidationSummary = true; } }, () => { return(this.NextViewStack.Count > 1); }); this.PreviousCommand = new DelegateCommand(async() => { this.IsCommandBarOpen = false; ShowValidationSummary = false; var currentViewModel = ((BaseViewModel)this.NextViewStack.Peek().DataContext); var currentModel = currentViewModel.Model as BaseModel; if (currentModel is PInspectionProof) { ((InspectionProofUserControlViewModel)this.NextViewStack.Peek().DataContext).CustSignature = null; ((InspectionProofUserControlViewModel)this.NextViewStack.Peek().DataContext).PithlineRepSignature = null; SetFrameContent(); } else if (currentModel is CPOI) { ((CPOIUserControlViewModel)this.NextViewStack.Peek().DataContext).CustSignature = null; ((CPOIUserControlViewModel)this.NextViewStack.Peek().DataContext).PithlineRepSignature = null; SetFrameContent(); } else { if (currentModel.ValidateModel()) { SetFrameContent(); if (currentViewModel is TTyreConditionUserControlViewModel) { await((TTyreConditionUserControlViewModel)currentViewModel).SaveTrailerTyreConditions(this._task.VehicleInsRecId); } else { this.SaveCurrentUIDataAsync(currentModel); } if (this.PrevViewStack.FirstOrDefault() != null) { BaseViewModel nextViewModel = this.PrevViewStack.FirstOrDefault().DataContext as BaseViewModel; await nextViewModel.LoadModelFromDbAsync(this._task.VehicleInsRecId); } } else { Errors = currentModel.Errors; OnPropertyChanged("Errors"); ShowValidationSummary = true; } } }, () => { return(this.PrevViewStack.Count > 0); }); } catch (Exception) { throw; } }
private void This_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { PreviousCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); RegisterCommand.RaiseCanExecuteChanged(); }