private void ClickPhone(Phone phone) { if (phone == null) { return; } ActionSheetConfig config = new ActionSheetConfig(); config.Add(ResourceService.GetString("callAction"), () => { IPhoneCallTask phoneDialer = CrossMessaging.Current.PhoneDialer; if (!phoneDialer.CanMakePhoneCall) { UserDialogs.Instance.Alert(ResourceService.GetString("cannotCall")); return; } phoneDialer.MakePhoneCall(phone.Number); }); config.Add(ResourceService.GetString("messageAction"), () => { ISmsTask smsMessenger = CrossMessaging.Current.SmsMessenger; if (!smsMessenger.CanSendSms) { UserDialogs.Instance.Alert(ResourceService.GetString("cannotSms")); return; } smsMessenger.SendSms(phone.Number); }); config.Add(ResourceService.GetString("cancelAction")); UserDialogs.Instance.ActionSheet(config); }
public MainPage() { InitializeComponent(); btnToast.Clicked += (sender, e) => { UserDialogs.Instance.Toast("Toast!! Eu entendia HELP no Mortal Kombat", TimeSpan.FromSeconds(10)); }; btnLoading.Clicked += async(sender, e) => { using (var Dialog = UserDialogs.Instance.Loading("Uma hora acaba..", null, null, true, MaskType.Black)) { await Task.Delay(3000); } }; btnActionSheet.Clicked += (sender, e) => { var ActionSheetConfig = new ActionSheetConfig() .SetTitle("Este Artigo Foi") .SetUseBottomSheet(true); ActionSheetConfig.Add("Mais ou menos"); ActionSheetConfig.Add("Bom"); ActionSheetConfig.Add("Otimo"); ActionSheetConfig.Add("Darth Vader Vestido de Batman Montado em um Charizard"); UserDialogs.Instance.ActionSheet(ActionSheetConfig); }; }
public void GetMedia(object obj, EventArgs e) { var actionSheetConfig = new ActionSheetConfig().SetTitle("Selecione um método").SetUseBottomSheet(true).SetCancel("Cancelar"); actionSheetConfig.Add("Tirar Foto", new Action(() => { OpenCamera(); }), "camera.png"); actionSheetConfig.Add("Selecionar uma imagem", new Action(() => { Galeria(); }), "camera.png"); UserDialogs.Instance.ActionSheet(actionSheetConfig); }
private void Hmenu_Click(object sender, EventArgs e) { ActionSheetConfig cfg = new ActionSheetConfig(); cfg.Add("a", null, null); cfg.Add("b", null, null); cfg.Add("c", null, null); UserDialogs.Instance.ActionSheet(cfg); }
public void AddImage(string fakeImagePath, Action onExecuted, int cropSize) { var config = new ActionSheetConfig(); // config.Add(AppResources.TakePicture, () => AddImageAction(fakeImagePath, onExecuted, cropSize, true)); config.Add(AppResources.UploadImageFromGallery, () => AddImageAction(fakeImagePath, onExecuted, cropSize, false)); config.Add(AppResources.Cancel); UserDialogs.Instance.ActionSheet(config); }
public void ShareLink(string title, string status, string link, Action onShareDone) { var config = new ActionSheetConfig(); config.Add(AppResources.Facebook, () => ShareFacebook(title, status, link, onShareDone)); config.Add(AppResources.Twitter, () => ShareTwitter(title, status, link, onShareDone)); config.Add(AppResources.Cancel); UserDialogs.Instance.ActionSheet(config); }
private void ExecuteOptions() { var actionConfig = new ActionSheetConfig(); actionConfig.Add("Contact Donor", ExecuteOpenDialer); actionConfig.Add("View in Maps", async() => await ExecuteOpenMaps()); actionConfig.SetCancel(); UserDialogs.Instance.ActionSheet(actionConfig); }
public void OpenActionSheet(string path) { ActionSheetConfig actionSheetConfig = new ActionSheetConfig(); actionSheetConfig.Title = "Choose Action"; actionSheetConfig.Add("Share", () => OpenShareActionSheet(path)); actionSheetConfig.Add("Play", () => OpenPlayActionSheet(path)); actionSheetConfig.Add("Save To Gallery", () => VideoSave.SaveVideoToExternalStorage(path)); UserDialogs.Instance.ActionSheet(actionSheetConfig); }
private void HandleSelectedDevice(DeviceListItemViewModel device) { var config = new ActionSheetConfig(); if (device.IsConnected) { config.Add("Details", () => { ShowViewModel <ServiceListViewModel>(new MvxBundle(new Dictionary <string, string> { { DeviceIdKey, device.Device.Id.ToString() } })); }); config.Add("Update RSSI", async() => { try { _userDialogs.ShowLoading(); await device.Device.UpdateRssiAsync(); device.RaisePropertyChanged(nameof(device.Rssi)); _userDialogs.HideLoading(); _userDialogs.Toast($"RSSI updated {device.Rssi}", TimeSpan.FromSeconds(1000)); } catch (Exception ex) { _userDialogs.HideLoading(); await _userDialogs.AlertAsync($"Failed to update rssi. Exception: {ex.Message}"); } }); config.Destructive = new ActionSheetOption("Disconnect", () => DisconnectCommand.Execute(device)); } else { config.Add("Connect", async() => { if (await ConnectDeviceAsync(device)) { var navigation = Mvx.Resolve <IMvxNavigationService>(); await navigation.Navigate <ServiceListViewModel, MvxBundle>(new MvxBundle(new Dictionary <string, string> { { DeviceIdKey, device.Device.Id.ToString() } })); } }); config.Add("Connect & Dispose", () => ConnectDisposeCommand.Execute(device)); } config.Add("Copy GUID", () => CopyGuidCommand.Execute(device)); config.Cancel = new ActionSheetOption("Cancel"); config.SetTitle("Device Options"); _userDialogs.ActionSheet(config); }
private void ActionSheet() { var asc = new ActionSheetConfig() .SetTitle("ActionSheet") .SetMessage("アクションシート") .SetUseBottomSheet(false); asc.Add("001", () => ShowActionSheetResult("イワン・ウイスキー")); asc.Add("002", () => ShowActionSheetResult("ジェット・リンク")); asc.Add("003", () => ShowActionSheetResult("フランソワーズ・アルヌール")); asc.Add("004", () => ShowActionSheetResult("アルベルト・ハインリヒ")); asc.Add("005", () => ShowActionSheetResult("ジェロニモ・ジュニア")); asc.Add("006", () => ShowActionSheetResult("張々湖")); asc.Add("007", () => ShowActionSheetResult("グレート・ブリテン")); asc.Add("008", () => ShowActionSheetResult("ピュンマ")); asc.Add("009", () => ShowActionSheetResult("島村ジョー")); // removeボタン asc.SetDestructive("削除", () => ShowActionSheetResult("削除")); // cancelボタン asc.SetCancel("キャンセル", () => ShowActionSheetResult("キャンセル")); // PopoverPresentationControllerの指定はできないっぽい // 吹き出しは画面下部中央からでてる _dialogs.ActionSheet(asc); }
private void ClickPhone(Phone phone) { if (phone == null) { return; } ActionSheetConfig config = new ActionSheetConfig(); config.Add(ResourceService.GetString("callAction"), () => { IPhoneCallTask phoneDialer = CrossMessaging.Current.PhoneDialer; if (!phoneDialer.CanMakePhoneCall) { UserDialogs.Instance.Alert(ResourceService.GetString("cannotCall")); return; } phoneDialer.MakePhoneCall(phone.Number); }); config.Add(ResourceService.GetString("messageAction"), () => { ISmsTask smsMessenger = CrossMessaging.Current.SmsMessenger; if (!smsMessenger.CanSendSms) { UserDialogs.Instance.Alert(ResourceService.GetString("cannotSms")); return; } smsMessenger.SendSms(phone.Number); }); config.Add(ResourceService.GetString("editAction"), () => { EditPhone(phone); }); config.Add(ResourceService.GetString("deleteAction"), () => { if (Debtor == null || Debtor.Phones.IsNullOrEmpty()) { return; } UserDialogs.Instance.Confirm(ResourceService.GetString("reallyDelete"), ResourceService.GetString("yes"), ResourceService.GetString("no"), (accepted) => { if (accepted) { Debtor.Phones.Remove(phone); } }); }); config.Add(ResourceService.GetString("cancelAction")); UserDialogs.Instance.ActionSheet(config); }
public FileManagerViewModel(IUserDialogs dialogs, IFileSystem fileSystem) { this.dialogs = dialogs; this.fileSystem = fileSystem; this.Select = ReactiveCommand.Create <FileEntryViewModel>(entry => { var cfg = new ActionSheetConfig().AddCancel(); if (entry.IsDirectory) { cfg.Add("Enter", () => this.CurrentPath = entry.Entry.FullName); } else { cfg.Add("View", async() => { var text = File.ReadAllText(entry.Entry.FullName); await this.dialogs.Alert(text, entry.Entry.Name); }); //cfg.Add("Copy", () => //{ // //var progress = dialogs.Progress(new ProgressDialogConfig // //{ // // Title = "Copying File" // //}); // var fn = Path.GetFileNameWithoutExtension(entry.Entry.Name); // var ext = Path.GetExtension(entry.Entry.Name); // var newFn = ext.IsEmpty() ? $"fn_1" : $"{fn}_1.{ext}"; // var target = new FileInfo(newFn); // var file = new FileInfo(entry.Entry.FullName); // file // .CopyProgress(target, true) // .Subscribe(p => // { // //progress.Title = "Copying File - Seconds Left: " + p.TimeRemaining.TotalSeconds; // //progress.PercentComplete = p.PercentComplete; // }); //}); } //cfg.Add("Delete", () => Confirm("Delete " + entry.Name, entry.Entry.Delete)); dialogs.ActionSheet(cfg); }); this.showBack = this.WhenAnyValue(x => x.CurrentPath) .Select(x => x == this.CurrentPath) .ToProperty(this, x => x.ShowBack); this.WhenAnyValue(x => x.CurrentPath) .Skip(1) .Subscribe(_ => this.LoadEntries()) .DisposeWith(this.DestroyWith); }
// for upload profile image in profile page public void SelectPhoto() { UserDialogs.Instance.ShowLoading(); var config = new ActionSheetConfig(); config.Add("Take Photo", async() => { await TakePhoto(); }); config.Add("Choose from library", async() => { await galleryFunc(); }); config.SetCancel("Cancel"); Acr.UserDialogs.UserDialogs.Instance.ActionSheet(config); UserDialogs.Instance.HideLoading(); }
private void DoDisasterSelectedCommand(DisasterListItemViewModel itemVm) { var actionSheetConfig = new ActionSheetConfig(); actionSheetConfig.Add(Messages.DisasterMenu.Assessment, () => DoShowAssessment(itemVm.Value)); actionSheetConfig.Add(Messages.DisasterMenu.Shelters, () => DoShowShelters(itemVm.Value)); var dialog = Resolve <IUserDialogs> (); dialog.ActionSheet(actionSheetConfig); }
private void AddCommandExecute() { var dialog = Mvx.Resolve <IUserDialogs>(); var config = new ActionSheetConfig { Cancel = new ActionSheetOption("Cancel") }; config.Add("Text", () => { ShowViewModel <EditTodoTextViewModel>(new { id = -1 }); }); config.Add("Switch", () => { ShowViewModel <EditTodoSwitchViewModel>(new { id = -1 }); }); config.Add("Progress", () => { ShowViewModel <EditTodoProgressViewModel>(new { id = -1 }); }); dialog.ActionSheet(config); }
private void DisplayEmployeeActionSheet(Employee employee) { var cfg = new ActionSheetConfig() .SetTitle("Select Action"); cfg.Add("Edit", async() => await NavigateToEditEmployeePage(employee)); cfg.Add("Delete", async() => await DeleteEmployee(employee)); cfg.Add("Manage Skills", async() => await NavigateToEmployeeSkillsPage(employee.ID)); cfg.SetCancel("Cancel"); _userDialogs.ActionSheet(cfg); }
public void btnImageCalled(object sender, EventArgs e) { ActionSheetConfig sa = new ActionSheetConfig(); sa.Title = "Choose Image"; sa.Add("Camera", delegate { ChooseImageCamera(); }); sa.Add("Gallery", delegate { ChooseImageGallery(); }); sa.SetCancel(); UserDialogs.Instance.ActionSheet(sa); }
private async void ImageTap(object obj) { ActionSheetConfig config = new ActionSheetConfig(); config.SetUseBottomSheet(true); var galeryIcon = await BitmapLoader.Current.LoadFromResource("ic_collections.png", 500f, 500f); var photoIcon = await BitmapLoader.Current.LoadFromResource("ic_camera_alt.png", 500f, 500f); config.Add("Take Picture From Galery", SetPictureFromGalery, galeryIcon); config.Add("Take Picture From Camera", SetFromCamera, photoIcon); config.SetCancel(null, null, null); _userDialogs.ActionSheet(config); }
void ExecuteFilterItemsCommand() { var actionConfig = new ActionSheetConfig(); actionConfig.Title = "Distance:"; foreach (int distance in distances) { actionConfig.Add(distance + " Miles", (async() => await ExecuteLoadItemsCommand(distance))); } actionConfig.Add("All", (async() => await ExecuteLoadItemsCommand(null))); UserDialogs.Instance.ActionSheet(actionConfig); }
void ExecuteOptionsCommand() { var actionConfig = new ActionSheetConfig(); actionConfig.Add("Contact Donor", ExecuteOpenDialer); actionConfig.Add("View in Maps", async() => await ExecuteOpenMaps()); if (Item.Status != DonationStatus.Completed) { actionConfig.Add("Cancel Pickup", (async() => await ExecuteCancelCommand())); } actionConfig.SetCancel("Close"); UserDialogs.Instance.ActionSheet(actionConfig); }
private void OnChooseNearbyMarkerCountCommandExecute() { var actionSheetConfig = new ActionSheetConfig(); actionSheetConfig.Title = AppResources.ViewCell_NearbyMarkerCount; actionSheetConfig.Add("0", () => { Settings.NearbyMarkerCount = 0; RaisePropertyChanged(nameof(Settings)); }); foreach (var count in Enumerable.Range(0, 8).Select(i => Convert.ToInt32(Math.Pow(2, i)))) { actionSheetConfig.Add(count.ToString(), () => { Settings.NearbyMarkerCount = count; RaisePropertyChanged(nameof(Settings)); }); } _userDialogs.ActionSheet(actionSheetConfig); }
private void OnItemLongListClickAsync(Debtor debtor) { if (IsRefreshing) { return; } ActionSheetConfig config = new ActionSheetConfig(); config.Add(ResourceService.GetString("debtsAction"), async() => { await NavigationService.Navigate <DebtsViewModel, Debtor, bool>(debtor); await LoadDataAsync(); }); config.Add(ResourceService.GetString("detailsAction"), async() => { await NavigationService.Navigate <DebtorDetailsViewModel, Debtor, bool>(debtor); await LoadDataAsync(); }); config.Add(ResourceService.GetString("editAction"), async() => { await NavigationService.Navigate <DebtorViewModel, Debtor, bool>(debtor); await LoadDataAsync(); }); config.Add(ResourceService.GetString("deleteAction"), () => { UserDialogs.Instance.Confirm(ResourceService.GetString("reallyDelete"), ResourceService.GetString("yes"), ResourceService.GetString("no"), async(accepted) => { if (!accepted || debtor == null) { return; } if (DatabaseService.RemoveDebtor(debtor.Id)) { await LoadDataAsync(); } else { UserDialogs.Instance.ToastFailure(ResourceService.GetString("error")); } }); }); config.Add(ResourceService.GetString("cancelAction")); UserDialogs.Instance.ActionSheet(config); }
protected void OnAddPublisherClicked(object sender) { Catalogue catalogue = Catalogue.GetCatalogue(); var config = new ActionSheetConfig(); config.SetTitle(Localization.AddPublisher); config.SetDestructive(Localization.NewPublisher, async() => { OnRemovePublisherClicked(null); await Navigation.PushModalAsync(new AddPublisherPage(Book, true)); }); config.SetCancel(Localization.Cancel); foreach (var publisher in catalogue.PublishersList) { if (Book.Publisher != publisher) { config.Add(publisher.Name, () => { OnRemovePublisherClicked(null); publisher.AddBook(Book); Book.Publisher = publisher; }); } } UserDialogs.Instance.ActionSheet(config); }
public VwCambiarPais() { InitializeComponent(); cvm = new CatalogosViewModel(); catPais paisdef = cvm.lsPais().Where(x => x.paisdefault).FirstOrDefault(); if (paisdef != null) { btnPais.Text = paisdef.pais; btnPais.Source = paisdef.img; idpais = paisdef.idpais; } btnPais.Clicked += (sender, ea) => { var cfg = new ActionSheetConfig().SetTitle("Seleccione pais"); foreach (catPais p in cvm.lsPais()) { cfg.Add(p.pais, () => Cambia(p.idpais)); } cfg.SetCancel(); UserDialogs.Instance.ActionSheet(cfg); }; }
private void HidenShow(ArticleMaster_Class st) { var cfg = new ActionSheetConfig() .SetTitle("Sub Category") .SetMessage(null) .SetUseBottomSheet(false); foreach (var item in st.FranchiseStokeMaster_Class_List) { cfg.Add( "Item : " + item.SubCategoryMaster_Class_Data.SubCategory_Name + " Qty : " + item.Quantity ); } //cfg.SetDestructive(); //if (true) cfg.SetCancel(); var disp = UserDialogs.Instance.ActionSheet(cfg); if (this.AutoCancel) { Task.Delay(TimeSpan.FromSeconds(3)) .ContinueWith(x => disp.Dispose()); } }
ICommand CreateActionSheetCommand(bool useBottomSheet, bool cancel, int items, string message = null) { return(new Command(() => { var cfg = new ActionSheetConfig() .SetTitle("Test Title") .SetMessage(message) .SetUseBottomSheet(useBottomSheet); for (var i = 0; i < items; i++) { var display = i + 1; cfg.Add( "Option " + display, () => this.Result($"Option {display} Selected"), "icon.png" ); } cfg.SetDestructive(null, () => this.Result("Destructive BOOM Selected"), "icon.png"); if (cancel) { cfg.SetCancel(null, () => this.Result("Cancel Selected"), "icon.png"); } var disp = this.Dialogs.ActionSheet(cfg); if (this.AutoCancel) { Task.Delay(TimeSpan.FromSeconds(3)) .ContinueWith(x => disp.Dispose()); } })); }
public void OptionsImage(object obj, EventArgs e) { var actionSheetConfig = new ActionSheetConfig().SetTitle("Selecione uma opção").SetUseBottomSheet(true).SetCancel("Cancelar"); actionSheetConfig.Add("Remover Foto", new Action(() => { imgFoto.Source = null; })); UserDialogs.Instance.ActionSheet(actionSheetConfig); }
private static Task OpenOptions(IContentItem contentItem) { var config = new ActionSheetConfig(); //TODO: Bug in Acr.Userdialogs where style is not applied config.UseBottomSheet = true; config.Cancel = new ActionSheetOption(GetText("Cancel")); //config.Title = ""; //config.Message = ""; if (contentItem is IMediaItem mediaItem) { if (_topViewModel == typeof(QueueViewModel)) { config.Add(GetText("RemoveFromQueue"), () => { _mediaManager.MediaQueue.Remove(mediaItem); _userDialogs.Toast(GetText("ItemRemovedFromQueue")); }); } else { config.Add(GetText("AddToQueue"), () => { _mediaManager.MediaQueue.Add(mediaItem); _userDialogs.Toast(GetText("ItemAddedToQueue")); }, "add_to_queue"); } config.Add(GetText("AddToPlaylist"), async() => { await _navigationService.Navigate <AddToPlaylistViewModel, IMediaItem>(mediaItem); }, "add_to_playlist"); //config.Add(GetText("ShowArtist"), () => _navigationService.Navigate<ArtistViewModel>()); //config.Add(GetText("ShowAlbum"), () => _navigationService.Navigate<AlbumViewModel>()); //config.Add(GetText("Share"), () => { }); } else if (contentItem is IPlaylist playlist) { config.Add(GetText("RenamePlaylist"), async() => { await RenamePlaylist(playlist); }); config.Add(GetText("DeletePlaylist"), async() => { await DeletePlaylist(playlist); }); } else if (contentItem is IArtist artist) { config.Add(GetText("Share"), () => { }); } else if (contentItem is IAlbum album) { config.Add(GetText("Share"), () => { }); } _userDialogs.ActionSheet(config); return(Task.CompletedTask); }
private void OnItemListClick(Currency currency) { if (IsVisible) { return; } ActionSheetConfig config = new ActionSheetConfig(); config.Add(ResourceService.GetString("editAction"), async() => { await NavigationService.Navigate <CurrencyViewModel, Currency, bool>(currency); await LoadDataAsync(); }); config.Add(ResourceService.GetString("deleteAction"), () => { if (DatabaseService.IsCurrencyInUse(currency.Id)) { UserDialogs.Instance.Alert(ResourceService.GetString("currencyInUse")); return; } UserDialogs.Instance.Confirm(ResourceService.GetString("reallyDelete"), ResourceService.GetString("yes"), ResourceService.GetString("no"), async(accepted) => { if (!accepted || currency == null) { return; } if (DatabaseService.RemoveCurrency(currency.Id)) { await LoadDataAsync(); } else { UserDialogs.Instance.ToastFailure(ResourceService.GetString("error")); } }); }); config.Add(ResourceService.GetString("cancelAction")); UserDialogs.Instance.ActionSheet(config); }
private void MenuOptionListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { IsPresented = false;//slide the menu away var selectedItem = e.SelectedItem as UserMenuItemModel; if (selectedItem != null) { if (selectedItem.PageType == typeof(LoginPage)) { ActionSheetConfig sa = new ActionSheetConfig(); sa.Title = "Are you sure uou want to logout?"; sa.Add("Yes", delegate { App.setting_Model.userModel = null; var sUser = JsonConvert.SerializeObject(App.setting_Model); Settings.GeneralSettings = sUser; App.Current.MainPage = new NavigationPage(new LoginPage()) { BarBackgroundColor = Color.FromHex("2DCA71"), BarTextColor = Color.White }; //App.baseUser = null; }); sa.Add("No", delegate { sa.SetCancel(); }); UserDialogs.Instance.ActionSheet(sa); slideOutMenu.MenuOptionListView.SelectedItem = null; } else { //find which item was selected //Pagetype property of modal helps t o load the appropriate page //Page activator creates an instance from the type at runtime Detail = new NavigationPage((Page)Activator.CreateInstance(selectedItem.PageType)) { BarBackgroundColor = Color.FromHex("2DCA71"), BarTextColor = Color.White }; slideOutMenu.MenuOptionListView.SelectedItem = null; } } }