public override void ActionSheet(ActionSheetConfig config) { var sheet = new CustomMessageBox { Caption = config.Title, IsLeftButtonEnabled = false, IsRightButtonEnabled = false }; var list = new ListBox { FontSize = 36, Margin = new Thickness(12.0), SelectionMode = SelectionMode.Single, ItemsSource = config.Options .Select(x => new TextBlock { Text = x.Text, Margin = new Thickness(0.0, 12.0, 0.0, 12.0), DataContext = x }) }; list.SelectionChanged += (sender, args) => sheet.Dismiss(); sheet.Content = list; sheet.Dismissed += (sender, args) => { var txt = (TextBlock)list.SelectedValue; var action = (ActionSheetOption)txt.DataContext; if (action.Action != null) action.Action(); }; this.Dispatch(sheet.Show); }
private void ActionSheet_Clicked(object sender, EventArgs e) { var config = new ActionSheetConfig { Title = "Title", Message = "Message", BottomSheet = false, }; // c.ItemTextAlgin = ActionSheetItemTextAlgin.Center; //config.AddItem("item1_icon", icon: "ic_3d_rotation_black_24dp"); //config.AddItem("item2_icon", icon: "ic_android_black_24dp"); //config.AddItem("item3_icon", icon: "ic_credit_card_black_24dp"); config.AddItem("item1"); config.AddItem("item2"); config.AddItem("item3", action: () => ToastShow("item3")); config.AddCancel(action: () => ToastShow("cancel")); config.AddDestructive(action: () => ToastShow("destructive")); UserDialogs.Instance.ActionSheet(config); }
void MenuItem_Clicked(System.Object sender, System.EventArgs e) { var menuitem = sender as MenuItem; if (menuitem != null) { } ShowListsSpecs showobj = (ShowListsSpecs)menuitem.CommandParameter; var config = new ActionSheetConfig { Cancel = new ActionSheetOption(Translator.getText("Cancel")), Title = "Lista de:" + showobj.travelerSpecs.Email }; config.Add(Translator.getText("ListInReview2"), new Action(async() => { await updatePage(1, showobj.travelerSpecs); })); config.Add(Translator.getText("WaitForPayment2"), new Action(async() => { await updatePage(2, showobj.travelerSpecs); })); config.Add(Translator.getText("ListInProcess2"), new Action(async() => { bool result = await DisplayAlert(Translator.getText("Notice"), "¿Que desea hacer con esta lista?", "Cobrar Productos", "Solo estado"); if (result) { await updatePage(9, showobj.travelerSpecs); } else { await updatePage(3, showobj.travelerSpecs); } })); config.Add(Translator.getText("ListInBought2"), new Action(async() => { await updatePage(4, showobj.travelerSpecs); })); config.Add(Translator.getText("ListCompleted2"), new Action(async() => { await updatePage(5, showobj.travelerSpecs); })); config.Add(Translator.getText("ListCancelled2"), new Action(async() => { await updatePage(6, showobj.travelerSpecs); })); var speechDialog = UserDialogs.Instance.ActionSheet(config); }
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); }
public override void ActionSheet(ActionSheetConfig config) { var sheet = UIAlertController.Create(config.Title ?? String.Empty, String.Empty, UIAlertControllerStyle.ActionSheet); config.Options.ToList().ForEach(x => sheet.AddAction(UIAlertAction.Create(x.Text, UIAlertActionStyle.Default, y => { if (x.Action != null) x.Action(); })) ); this.Present(sheet); }
public override void ActionSheet(ActionSheetConfig config) { Device.BeginInvokeOnMainThread(() => { var action = new UIActionSheet(config.Title); config.Options.ToList().ForEach(x => action.AddButton(x.Text)); action.Clicked += (sender, btn) => config.Options[btn.ButtonIndex].Action(); var view = Utils.GetTopView(); action.ShowInView(view); }); }
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 ExecuteOptions() { var actionConfig = new ActionSheetConfig(); actionConfig.Add("Contact Donor", ExecuteOpenDialer); actionConfig.Add("View in Maps", async() => await ExecuteOpenMaps()); actionConfig.SetCancel(); UserDialogs.Instance.ActionSheet(actionConfig); }
/// <summary> /// Display an action sheet dialog asynchronously. /// </summary> /// <param name="config">The action sheet configuration.</param> public IDisposable ActionSheet(ActionSheetConfig config) { // If available, call the delegate to see if presenting this dialog is allowed. if (MessagingServiceCore.Delegate == null || MessagingServiceCore.Delegate.OnActionSheetRequested(config)) { return(PresentActionSheet(config)); } return(null); }
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 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); }
private void DisplayEmployeeSkillActionSheet(Skill skill) { var cfg = new ActionSheetConfig() .SetTitle("Select Action"); cfg.Add("Remove Skill", async() => await RemoveSkillFromEmployee(skill)); cfg.SetCancel("Cancel"); _userDialogs.ActionSheet(cfg); }
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); }
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); }
// 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(); }
public void ShowActionSheetAsync(string title, string CancelbuttonLabel, string[] items) { ActionSheetConfig cfg = new ActionSheetConfig(); foreach (string item in items) { cfg.Add(item); } cfg.SetTitle(title); UserDialogs.Instance.ActionSheet(cfg); }
public void ShowSuccess(string message, int timeoutMillis = 2000) { var config = new ActionSheetConfig(); config.Cancel = new ActionSheetOption("Cancel"); //config.Destructive = new ActionSheetOption("Desc"); config.ItemIcon = "ic_alert_circle_grey600_24dp"; config.Message = message; //config.Title = "S"; UserDialogs.Instance.ActionSheet(config); }
public void ContextMenu(Song song) { this.songToUseInAction = song; ActionSheetConfig asc = new ActionSheetConfig(); asc.Options.Add(new ActionSheetOption(Texts.CleanAndPlay, this.CleanAndPlay)); asc.Options.Add(new ActionSheetOption(Texts.Download, this.DownloadSong)); asc.Options.Add(new ActionSheetOption(Texts.EnqueueLast, this.EnqueueSong)); asc.Cancel = new ActionSheetOption(Texts.ButtonCancel); asc.Title = Texts.SelectAction; this.userDialog.ActionSheet(asc); }
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); }
/// <summary> /// Show alert sheet. /// </summary> /// <param name="title">Dialog title.</param> /// <param name="buttons">Dialog buttons (id and name).</param> /// <param name="command">Command to execute on button click.</param> /// <returns>Chosen button name.</returns> public void ShowSheet(string title, Dictionary <int, string> buttonList, ICommand command) { var config = new ActionSheetConfig().SetTitle(title); foreach (var button in buttonList) { config.Add(button.Value, () => command.Execute(button.Key)); } config.SetCancel(_baseCancel, () => command.Execute(-1)); UserDialogs.Instance.ActionSheet(config); }
public override void ActionSheet(ActionSheetConfig config) { this.Dispatch(() => { var action = new UIActionSheet(config.Title); config.Options.ToList().ForEach(x => action.AddButton(x.Text)); action.Dismissed += (sender, btn) => { if (btn.ButtonIndex > -1 && btn.ButtonIndex < config.Options.Count - 1) config.Options[(int)btn.ButtonIndex].Action(); }; var view = Utils.GetTopView(); action.ShowInView(view); }); }
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); }
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 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); }
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); }
public HealthResultsSave(Action onNewPlant, Action onExistingPlant, Action onCancel) { Config = new ActionSheetConfig(); List <ActionSheetOption> options = new List <ActionSheetOption> { new ActionSheetOption("New Plant", new Action(onNewPlant), "add1.png"), new ActionSheetOption("Existing Plant", new Action(onExistingPlant), "tab_plants.png"), new ActionSheetOption("Cancel", new Action(onCancel), "cancel.png") }; Config.Options = options; Config.Title = "Save To"; }
public override void ActionSheet(ActionSheetConfig config) { var array = config .Options .Select(x => x.Text) .ToArray(); Utils.RequestMainThread(() => new AlertDialog .Builder(Utils.GetActivityContext()) .SetTitle(config.Title) .SetItems(array, (sender, args) => config.Options[args.Which].Action()) .Show() ); }
private void TouchedPicture() { IUserDialogs userDialogs = UserDialogs.Instance; ActionSheetConfig config = new ActionSheetConfig(); List <ActionSheetOption> Options = new List <ActionSheetOption>(); Options.Add(new ActionSheetOption(AppResource.pick_at_gallery, OpenGallery, ListOfNames.pictureForFolder)); Options.Add(new ActionSheetOption(AppResource.take_photo_with_camera, TakePhoto, ListOfNames.pictureForCamera)); ActionSheetOption cancel = new ActionSheetOption(AppResource.cancel.ToUpper(), null, null); config.Options = Options; config.Cancel = cancel; 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); }
public override void ActionSheet(ActionSheetConfig config) { var sheet = UIAlertController.Create(config.Title ?? String.Empty, String.Empty, UIAlertControllerStyle.ActionSheet); config.Options.ToList().ForEach(x => sheet.AddAction(UIAlertAction.Create(x.Text, UIAlertActionStyle.Default, y => { if (x.Action != null) { x.Action(); } })) ); this.Present(sheet); }