Beispiel #1
0
 private void NextAction(object o)
 {
     TransitionerIndex++;
     PreviousCommand.RaiseCanExecuteChanged();
     NextCommand.RaiseCanExecuteChanged();
     CreateCommand.RaiseCanExecuteChanged();
 }
Beispiel #2
0
        protected override void OnModelChanged()
        {
            NextCommand.RaiseCanExecuteChanged();
            PreviousCommand.RaiseCanExecuteChanged();
            FirstCommand.RaiseCanExecuteChanged();
            LastCommand.RaiseCanExecuteChanged();

            RaisePropertyChanged(nameof(TotalPages));
        }
Beispiel #3
0
 private void RaiseCommandCanExecuteChanged()
 {
     PlayCommand.RaiseCanExecuteChanged();
     PauseCommand.RaiseCanExecuteChanged();
     StopCommand.RaiseCanExecuteChanged();
     NextCommand.RaiseCanExecuteChanged();
     PreviousCommand.RaiseCanExecuteChanged();
     RaisePropertyChanged(nameof(CurrentMedia));
 }
Beispiel #4
0
        private void SetFrameContent()
        {
            var item = this.PrevViewStack.Pop();

            this.FrameContent = item;
            this.NextViewStack.Push(item);
            CompleteCommand.RaiseCanExecuteChanged();
            PreviousCommand.RaiseCanExecuteChanged();
            NextCommand.RaiseCanExecuteChanged();
        }
        public NavigatorViewModel(IObservable <int> currentPage, IObservable <int> pageSize)
        {
            Size = new ReactiveProperty <int>(pageSize);

            var obs = currentPage.DistinctUntilChanged().CombineLatest(Size, (a, b) =>
                                                                       new { page = a, size = b });

            Output = NextCommand.WithLatestFrom(obs, (a, b) => new PageRequest(b.page + 1, b.size)).Merge
                         (PreviousCommand.WithLatestFrom(obs, (a, b) =>
                                                         new PageRequest(b.page - 1, b.size))).StartWith(new PageRequest(1, 25)).ToReactiveProperty();
        }
Beispiel #6
0
 public PhotoViewModel(IMessenger messenger, IImageService imageService, PhotoModel model)
 {
     Messenger       = messenger;
     ImageService    = imageService;
     Model           = model;
     FullScale       = false;
     NextCommand     = new NextCommand(this);
     PreviousCommand = new PreviousCommand(this);
     ScaleCommand    = new ScaleCommand(this);
     CloseCommand    = new CloseCommand(this);
     PrepareIcons();
 }
Beispiel #7
0
        public void Previous_should_be_called_properly()
        {
            // Arrange
            var client = A.Fake <ISpotifyClient>();

            A.CallTo(() => client.Player.SkipPrevious()).Returns(true);

            var sut = new PreviousCommand(client);

            // Act
            sut.RunCommand();

            // Assert
            A.CallTo(() => client.Player.SkipPrevious()).MustHaveHappenedOnceExactly();
        }
Beispiel #8
0
 private void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(Model.MaximumRows) ||
         e.PropertyName == nameof(Model.StartRowIndex) ||
         e.PropertyName == nameof(Model.Count))
     {
         OnPropertyChanged(nameof(CurrentPage));
         OnPropertyChanged(nameof(CountOfPages));
         OnPropertyChanged(nameof(StringCountOfPages));
         FirstCommand.RiseCanExecute();
         PreviousCommand.RiseCanExecute();
         NextCommand.RiseCanExecute();
         LastCommand.RiseCanExecute();
     }
 }
Beispiel #9
0
        public TestViewModel()
        {
            Collection = new CollectionViewSource();
            LoadData();

            #region CommandExecution
            NextEvent = new NextCommand(this);

            PreviousEvent = new PreviousCommand(this);

            AddEvent = new AddCommand(this);

            SaveEvent = new SaveCommand(this);

            #endregion
        }
Beispiel #10
0
        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;
            }
        }
Beispiel #11
0
        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();
        }
Beispiel #12
0
        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;
            }
        }
Beispiel #13
0
 public void GoToPreviousFromMediaWebSocket()
 {
     PreviousCommand.Execute();
 }
Beispiel #14
0
 private void This_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     PreviousCommand.RaiseCanExecuteChanged();
     NextCommand.RaiseCanExecuteChanged();
     RegisterCommand.RaiseCanExecuteChanged();
 }