Ejemplo n.º 1
0
 private void NextAction(object o)
 {
     TransitionerIndex++;
     PreviousCommand.RaiseCanExecuteChanged();
     NextCommand.RaiseCanExecuteChanged();
     CreateCommand.RaiseCanExecuteChanged();
 }
 public void Done()
 {
     _connectedUasManager.Active.Transport.SendMessage(UasCommands.PreflightCalibration(_connectedUasManager.Active.Uas.SystemId, _connectedUasManager.Active.Uas.ComponentId, 0, 0, 0, 0, 2, 0, 0));
     BeginCommand.RaiseCanExecuteChanged();
     CancelCommand.RaiseCanExecuteChanged();
     DoneCommand.RaiseCanExecuteChanged();
     NextCommand.RaiseCanExecuteChanged();
 }
Ejemplo n.º 3
0
        protected override void OnModelChanged()
        {
            NextCommand.RaiseCanExecuteChanged();
            PreviousCommand.RaiseCanExecuteChanged();
            FirstCommand.RaiseCanExecuteChanged();
            LastCommand.RaiseCanExecuteChanged();

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

            this.FrameContent = item;
            this.NextViewStack.Push(item);
            CompleteCommand.RaiseCanExecuteChanged();
            PreviousCommand.RaiseCanExecuteChanged();
            NextCommand.RaiseCanExecuteChanged();
        }
        protected async void OnNextExecute()
        {
            if (!CanGoNext)
            {
                return;
            }

            CanGoNext = false;

            if (!await UserViewModel.ValidateAndSaveInput(Items.Where(x => x is IOrderFieldsGroupVM).Select(x => x as IOrderFieldsGroupVM)) ||
                !await DeliveryViewModel.ValidateDelivery(Items.Where(x => x is IDeliveryTypeItemVM).Select(x => x as IDeliveryTypeItemVM)))
            {
                CanGoNext = true;
                return;
            }

            Loading = true;

            NextCommand.RaiseCanExecuteChanged();

            if (_orderProcessingToken == null)
            {
                _orderProcessingToken = Messenger.Subscribe <OrderProcessingMessage>(DeliveryViewModel.OrderProcessingChanged);
            }

            if (_orderPaidToken == null)
            {
                _orderPaidToken = Messenger.Subscribe <OrderPaidMessage>(DeliveryViewModel.OnOrderPaidMessageRecieved);
            }

            if (_paymentSelectedToken == null)
            {
                _paymentSelectedToken = Messenger.Subscribe <PaymentSelectedMessage>(DeliveryViewModel.OnPaymentSelectedMessage);
            }

            var selectedDelivery = Items?.FirstOrDefault(x => x is IDeliveryTypeItemVM deliveryItem && deliveryItem.IsSelected) as IDeliveryTypeItemVM;

            var isNeedToSelectPayment = await OrderVmService.IsPaymentNecessary(selectedDelivery?.Id);

            if (isNeedToSelectPayment)
            {
                NavigationVmService.NavigateToPayment(new PaymentBundle(selectedDelivery?.Id, NavigationType.PresentModal));
            }
            else
            {
                await DeliveryViewModel.CreateOrder();
            }

            CanGoNext = true;

            Loading = false;
        }
        private void SetNextState()
        {
            this.state = this.state != ResultsState.TwelvePoints ? this.state + 1 : ResultsState.RevealCountry;

            if (this.state == ResultsState.SplashScreen)
            {
                Messenger.Default.Send(new ReadyForLateVotesMessage());
            }

            if (this.state == ResultsState.RevealCountry)
            {
                if (Countries.Count(c => c.IsInQueue) > 0)
                {
                    this.currentlyRevealedCountry = GetSelectedCountry();
                }
                else
                {
                    this.state = ResultsState.RevealWinner;
                }
            }

            if (this.state == ResultsState.TwelvePoints)
            {
                if (this.currentlyRevealedCountry != null)
                {
                    this.currentlyRevealedCountry.IsSelected = false;
                    this.currentlyRevealedCountry.IsInQueue  = false;

                    if (Countries.Count(c => c.IsInQueue) > 0)
                    {
                        if (Countries.Count(c => c.IsInQueue && c.IsSelected) == 0)
                        {
                            Countries.First(c => c.IsInQueue).IsSelected = true;
                        }
                    }
                }
            }

            var selectedCountryId = Countries.FirstOrDefault(c => c.IsSelected)?.Id;

            Model.Country nextCountry = null;
            if (selectedCountryId.HasValue)
            {
                nextCountry = dataService.GetCountry(selectedCountryId.Value);
            }

            Messenger.Default.Send(new ChangeStateMessage(this.state, nextCountry));
            NextCommand.RaiseCanExecuteChanged();
        }
Ejemplo n.º 8
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;
            }
        }
        public void Next()
        {
            if (IsActive)
            {
                var ack = new UasCommandAck()
                {
                    TargetComponent = _connectedUasManager.Active.Uas.ComponentId,
                    TargetSystem    = _connectedUasManager.Active.Uas.SystemId,
                    Command         = 1,
                    Result          = 1,
                };

                _connectedUasManager.Active.Transport.SendMessage(ack);
            }

            _connectedUasManager.Active.Transport.SendMessage(UasCommands.PreflightCalibration(_connectedUasManager.Active.Uas.SystemId, _connectedUasManager.Active.Uas.ComponentId, 0, 0, 0, 0, 1, 0, 0));
            BeginCommand.RaiseCanExecuteChanged();
            CancelCommand.RaiseCanExecuteChanged();
            DoneCommand.RaiseCanExecuteChanged();
            NextCommand.RaiseCanExecuteChanged();
        }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
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;
            }
        }
Ejemplo n.º 12
0
 private void OnEmailChanged()
 {
     //Needed for Android
     NextCommand.RaiseCanExecuteChanged();
 }
Ejemplo n.º 13
0
 private void This_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     PreviousCommand.RaiseCanExecuteChanged();
     NextCommand.RaiseCanExecuteChanged();
     RegisterCommand.RaiseCanExecuteChanged();
 }