Exemplo n.º 1
0
        private async void Create()
        {
            try
            {
                var setNamePopupPage = new SetNamePopupPage()
                {
                    Header = "List Name",
                    Body   = "Set a list name"
                };

                await _popupNavigation.PushAsync(setNamePopupPage);

                string name = await setNamePopupPage.Task;

                ToDoList newList = new ToDoList
                {
                    Id   = Guid.NewGuid(),
                    Name = name
                };

                await _toDoService.CreateList(newList);

                Lists.Add(newList);

                await Navigation.PushAsync <ItemsPage, ItemsPageModel>(x => x.Init(newList));
            }
            catch (OperationCanceledException)
            {
                Debug.WriteLine("User cancelled setting name");
            }
            catch (Exception ex)
            {
                Debug.Fail("Error creating list", ex.Message);
            }
        }
Exemplo n.º 2
0
        private async void GetPackingListDelivery()
        {
            if (Model.CheckOutDate.HasValue &&
                !string.IsNullOrEmpty(Model.Line) &&
                !string.IsNullOrEmpty(Model.Driver) &&
                !string.IsNullOrEmpty(Model.Vehicle))
            {
                await _popupNavigation.PushAsync(new LoadingPopupPage());

                var packingListViewInfo = await _boardingDeliveryPackService.GetPackingListDelivery(
                    new GetPackingListDeliveryModel(_userService.User.Unit.Id, Model.CheckOutDate.Value.ToString("dd/MM/yyyy HH:mm"),
                                                    Model.LineInfoView.Id, Model.VehicleViewInfo.Id, Model.DriverInfoView.Id,
                                                    _wifiService.MacAddress, true));

                await _popupNavigation.PopAllAsync();

                if (packingListViewInfo.Response != null &&
                    packingListViewInfo.Response.Id > 0 &&
                    packingListViewInfo.Response.Valid &&
                    packingListViewInfo.Response.ExceptionCode == ExceptionCodeEnum.NoError)
                {
                    SetPackingListDelivery(packingListViewInfo.Response);
                }
                else if (packingListViewInfo.Response != null)
                {
                    switch (packingListViewInfo.Response.ExceptionCode)
                    {
                    case ExceptionCodeEnum.ExistsPackinglistDelivery:
                        if (await _notificationService.AskQuestionAsync(
                                "Existe outro romaneio aberto com essas configurações.\nDeseja utilizá-lo?", SoundEnum.Alert))
                        {
                            SetPackingListDelivery(packingListViewInfo.Response);
                        }
                        else
                        {
                            Model.PackingListViewInfo = null;
                            Model.ClearModelAfterDriver();
                            await _notificationService.NotifyAsync("Operação cancelada.", SoundEnum.Alert);
                        }
                        break;

                    default:
                        Model.PackingListViewInfo = null;
                        Model.ClearModelAfterDriver();
                        await _notificationService.NotifyAsync(packingListViewInfo.Response.ExceptionMessage, SoundEnum.Erros);

                        break;
                    }
                }
            }
            else
            {
                Model.PackingListViewInfo = null;
                Model.ClearModelAfterVehicle();
            }
        }
        public async Task <bool> ShowConfirmationDialogAsync(string message, string yesButtonText = "Yes", string noButtonText = "No")
        {
            var confirmationDialog = new ConfirmationDialog(message)
            {
                YesButtonText = yesButtonText,
                NoButtonText  = noButtonText
            };
            await _popupNavigation.PushAsync(confirmationDialog);

            var result = await confirmationDialog.GetResult();

            await _popupNavigation.PopAllAsync();

            return((bool)result);
        }
Exemplo n.º 4
0
        public static async Task PushPopupAsyncSafe(this INavigation sender, PopupPage page, IPopupNavigation popupNavigation, bool animate = true)
        {
            if (Device.RuntimePlatform == "Test")
            {
                return;
            }

            await popupNavigation.PushAsync(page, animate);
        }
Exemplo n.º 5
0
        private async Task SetPackingListLanding()
        {
            await _popupNavigation.PushAsync(new LoadingPopupPage());

            var getLandingByTrafficScheduleId = await _landingService.GetLandingByTrafficScheduleId(
                _userService.User.Unit.Id, _userService.User.Unit.Code, Model.CarNumber, Model.TeamViewInfo.Id);

            await _popupNavigation.PopAllAsync();

            if (getLandingByTrafficScheduleId.Response != null && getLandingByTrafficScheduleId.Response.Valid)
            {
                Model.VehicleViewInfo = getLandingByTrafficScheduleId.Response;
                SetVehicleLanding();
            }
            else
            {
                MenuAdtionalButtons = new Dictionary <string, DelegateCommand>();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="navigator"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static async Task <bool> Show(IPopupNavigation navigator, string username, string password, bool multiple = false)
        {
            var view = new PayNotificationView(username, password, multiple);
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(true);
        }
Exemplo n.º 7
0
        private void EnableWifi()
        {
            Task.Run(async() =>
            {
                if (!_wifiService.IsEnabled)
                {
                    await Task.Delay(TimeSpan.FromSeconds(1));

                    await _popupNavigation.PushAsync(new LoadingPopupPage());

                    _wifiService.Enable();

                    await Task.Delay(TimeSpan.FromSeconds(5));

                    _tmsApiServiceBase.SetApiUrl(_environmentConfigurationService.Configuration.ApiUrls);

                    await Task.Delay(TimeSpan.FromSeconds(2));

                    await _popupNavigation.PopAllAsync();
                }

                SetLabelsDescription();
            });
        }
Exemplo n.º 8
0
        private async void EnlargeImage()
        {
            var page = (PopupPage) new ImagePopupPage();
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                _popupNavigation.PopAsync(true);
            };
            var image = new Image()
            {
                Source = $"{ItemSelected.ImageSource}"
            };

            image.GestureRecognizers.Add(tapGestureRecognizer);
            page.Content = new StackLayout()
            {
                Children          = { image },
                Padding           = 10,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };

            await _popupNavigation.PushAsync(page, true);
        }