private async void SheetActionAsync()
        {
            //var action = await PageDialogService.DisplayActionSheetAsync("Send to", "Cancel", null, "Facebook", "Twitter", "Email");
            var action = await PageDialogService.DisplayActionSheetAsync("Send to:", "Cancel", "Destroy", "Facebook", "Twitter", "Email");

            await PageDialogService.DisplayAlertAsync("Alert", $"You choose '{action}'", "OK");
        }
        private async Task <bool> ExecuteValidateUserCityCommand()
        {
            var buttons = new List <IActionSheetButton>
            {
                ActionSheetButton.CreateButton("---Select city---", () => {
                    UserCity.Value = "---Select city---";
                }),
                ActionSheetButton.CreateCancelButton("Cancel", () =>
                {
                    UserCity.Value = "---Select city---";
                })
            };

            foreach (var item in CityList)
            {
                buttons.Add(ActionSheetButton.CreateButton(item.CityName, () =>
                {
                    UserCity.Value = item.CityName;
                    CurrentCity    = item;
                }));
            }
            await PageDialogService.DisplayActionSheetAsync(null, buttons.ToArray());

            if (!(UserCity.Value == "---Select city---"))
            {
                return(_userCity.Validate());
            }
            else
            {
                return(_userCity.Validate());
            }
        }
        private async Task SelectRoleCommandExecuteAsync()
        {
            List <IActionSheetButton> buttons = new List <IActionSheetButton>();

            foreach (var item in AppRolesResult)
            {
                buttons.Add(ActionSheetButton.CreateButton(item.Name, new Action(() =>
                {
                    SelectedAppRole = item;
                })));
            }
            await PageDialogService.DisplayActionSheetAsync("Select Option", buttons.ToArray());
        }
Example #4
0
 private async Task ExecuteImageTappedClickCommandAsync(ComplaintImagesDTO complaintImagesDTO)
 {
     List <IActionSheetButton> buttons = new List <IActionSheetButton>()
     {
         ActionSheetButton.CreateButton("View file", new Action(async() =>
         {
             await ViewFile(complaintImagesDTO);
         })),
         ActionSheetButton.CreateButton("Delete file", new Action(async() =>
         {
             await DeleteFile(complaintImagesDTO);
         })),
         ActionSheetButton.CreateCancelButton("Cancel", new Action(() => { }))
     };
     await PageDialogService.DisplayActionSheetAsync("Select Option", buttons.ToArray());
 }
        private async void selecionartipodeImagem()
        {
            var action = await PageDialogService.DisplayActionSheetAsync("Selecione Imagem:", "Cancel", null, "Camera", "Galeria");

            if (action == "Camera")
            {
                abrircamera();
            }
            else if (action == "Galeria")
            {
                selecionargaleria();
            }
            else
            {
                Photo = null;
                return;
            }
        }
Example #6
0
        private async Task <bool> ExecuteSpeciesCommandAsync()
        {
            var buttons = new List <IActionSheetButton>()
            {
                ActionSheetButton.CreateButton("---Select species---", WriteLine, "Select option"),

                ActionSheetButton.CreateCancelButton("Cancel", WriteLine, "Cancel")
            };
            var Species = await _complaintService.GetAllSpecies(_settings.UserId);

            foreach (var item in Species)
            {
                buttons.Add(ActionSheetButton.CreateButton(item.SpeciesName, WriteLine, item.SpeciesName));
            }
            await PageDialogService.DisplayActionSheetAsync("Select species", buttons.ToArray());

            return(_species.Validate());
        }
Example #7
0
        private async void selecionartipodeImagem()
        {
            var action = await PageDialogService.DisplayActionSheetAsync("Selecione Imagem:", "Cancel", null, "Camera", "Galeria");

            if (action == "Camera")
            {
                var status = await Permissions.CheckStatusAsync <Permissions.Camera>();

                if (status != PermissionStatus.Granted)
                {
                    status = await Permissions.RequestAsync <Permissions.Camera>();
                }
                abrircamera();
            }
            else if (action == "Galeria")
            {
                selecionargaleria();
            }
            else
            {
                Photo = null;
                return;
            }
        }
Example #8
0
        private async Task ExecuteUploadimagecommandAsync()
        {
            try
            {
                var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync <CameraPermission>();

                var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync <StoragePermission>();

                var status = await CrossPermissions.Current.CheckPermissionStatusAsync <MediaLibraryPermission>();

                if (status != PermissionStatus.Granted)
                {
                    if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.MediaLibrary))
                    {
                        await PageDialogService.DisplayAlertAsync(null, "App needs permission to access the media library.", "OK");
                    }
                    status = await CrossPermissions.Current.RequestPermissionAsync <CameraPermission>();
                }
                if (status == PermissionStatus.Granted)
                {
                }
                if (cameraStatus != PermissionStatus.Granted)
                {
                    if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Camera))
                    {
                        await PageDialogService.DisplayAlertAsync(null, "App needs permission to access the camera.", "OK");
                    }


                    cameraStatus = await CrossPermissions.Current.RequestPermissionAsync <CameraPermission>();
                }

                if (storageStatus != PermissionStatus.Granted)
                {
                    if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Storage))
                    {
                        await PageDialogService.DisplayAlertAsync(null, "App needs permission to access the phone's local storage.", "OK");
                    }

                    storageStatus = await CrossPermissions.Current.RequestPermissionAsync <StoragePermission>();
                }

                if (status == PermissionStatus.Granted && cameraStatus == PermissionStatus.Granted)
                {
                    List <IActionSheetButton> buttons = new List <IActionSheetButton>()
                    {
                        ActionSheetButton.CreateButton("Gallery", new Action(async() =>
                        {
                            await UplaodImageFromGallery();
                        })),
                        ActionSheetButton.CreateButton("Camera", new Action(async() =>
                        {
                            await UplaodImageFromCamera();
                        })),
                        ActionSheetButton.CreateCancelButton("Cancel", new Action(() => { }))
                    };
                    await PageDialogService.DisplayActionSheetAsync("Select Option", buttons.ToArray());
                }
                else
                {
                    await PageDialogService.DisplayAlertAsync(null, "Sorry, permission is not granted to use the media library.", "OK");
                }
            }
            catch (Exception ex)
            {
                string st = ex.ToString();
            }
        }
        public VenueViewModel(INavigationService navigationService, IEventAggregator eventAggregator, IStoreManager storeManager, IToast toast, IFavoriteService favoriteService, ILoggerFacade logger, ILaunchTwitter twitter, ISSOClient ssoClient, IPushNotifications pushNotifications, IReminderService reminderService, IPageDialogService pageDialogService)
            : base(navigationService, eventAggregator, storeManager, toast, favoriteService, logger, twitter, ssoClient, pushNotifications, reminderService, pageDialogService)
        {
            if (Device.OS == TargetPlatform.Android)
            {
                ToolBarItems.Add(new ToolbarItem
                {
                    Order   = ToolbarItemOrder.Secondary,
                    Text    = "Get Directions",
                    Command = NavigateCommand
                });

                if (CanMakePhoneCall)
                {
                    ToolBarItems.Add(new ToolbarItem
                    {
                        Order   = ToolbarItemOrder.Secondary,
                        Text    = "Call Hotel",
                        Command = CallCommand
                    });
                }
            }
            else if (Device.OS == TargetPlatform.iOS)
            {
                ToolBarItems.Add(new ToolbarItem
                {
                    Text    = "More",
                    Icon    = "toolbar_overflow.png",
                    Command = DelegateCommand <object> .FromAsyncHandler(async(o) =>
                    {
                        string[] items = null;
                        if (!CanMakePhoneCall)
                        {
                            items = new[] { "Get Directions" };
                        }
                        else
                        {
                            items = new[] { "Get Directions", "Call +49 (341) 4859270" };
                        }
                        var action = await PageDialogService.DisplayActionSheetAsync("Commundo Tagungshotel", "Cancel", null, items);
                        if (action == items[0])
                        {
                            NavigateCommand.Execute(null);
                        }
                        else if (items.Length > 1 && action == items[1] && CanMakePhoneCall)
                        {
                            CallCommand.Execute(null);
                        }
                    })
                });
            }
            else
            {
                ToolBarItems.Add(new ToolbarItem
                {
                    Text    = "Directions",
                    Command = NavigateCommand,
                    Icon    = "toolbar_navigate.png"
                });

                if (CanMakePhoneCall)
                {
                    ToolBarItems.Add(new ToolbarItem
                    {
                        Text    = "Call",
                        Command = CallCommand,
                        Icon    = "toolbar_call.png"
                    });
                }
            }
            var position = new Position(Latitude, Longitude);

            MapSpan = new MapSpan(position, 0.02, 0.02);
            Pins.Add(new Pin
            {
                Type     = PinType.Place,
                Address  = LocationTitle,
                Label    = EventTitle,
                Position = position
            });
        }