private async void ShowActions(AppointmentDTO appointmentDTO) { IActionSheetButton editAppointmentBtn = ActionSheetButton.CreateButton("Edit appointment", new DelegateCommand(() => { EditAppointment(appointmentDTO); })); IActionSheetButton deleteAppointmentBtn = ActionSheetButton.CreateButton("Delete appointment", new DelegateCommand(() => { DeleteAppointment(appointmentDTO.Id); })); IActionSheetButton callPatientBtn = ActionSheetButton.CreateButton("Call patient", new DelegateCommand(() => { CallPatient(appointmentDTO.Phone); })); await _dialogService.DisplayActionSheetAsync("Appointment actions", editAppointmentBtn, callPatientBtn, deleteAppointmentBtn); }
private async void ShowPatientActionsAsync() { IActionSheetButton editPatientBtn = ActionSheetButton.CreateButton("Edit patient", new DelegateCommand(() => { NavigateToPage("EditPatientPage"); })); IActionSheetButton callPatientBtn = ActionSheetButton.CreateButton("Call patient", new DelegateCommand(() => { CallPatient(); })); IActionSheetButton scheduleAppointmentBtn = ActionSheetButton.CreateButton("Schedule appointment", new DelegateCommand(() => { ScheduleAppointmentAsync(); })); await _dialogService.DisplayActionSheetAsync("Patient actions", editPatientBtn, callPatientBtn, scheduleAppointmentBtn); }
private void AddImage() { IActionSheetButton TakePicture = ActionSheetButton.CreateButton("Take Picture Form Camera", new DelegateCommand(ButtonTakePicter)); IActionSheetButton GetPicture = ActionSheetButton.CreateButton("Get Picture From Gallery", new DelegateCommand(ButtonGetPicture)); IActionSheetButton Cancel = ActionSheetButton.CreateCancelButton("Cancel", new DelegateCommand(() => { return; })); dialog.DisplayActionSheetAsync("What do you want to do with : ", Cancel, TakePicture, GetPicture); }
private async void DisplayActionSheetUsingActionSheetButtons() { IActionSheetButton option1Action = ActionSheetButton.CreateButton("Option 1", new DelegateCommand(() => { Debug.WriteLine("Option 1"); })); IActionSheetButton option2Action = ActionSheetButton.CreateButton("Option 2", new DelegateCommand(() => { Debug.WriteLine("Option 2"); })); IActionSheetButton cancelAction = ActionSheetButton.CreateCancelButton("Cancel", new DelegateCommand(() => { Debug.WriteLine("Cancel"); })); IActionSheetButton destroyAction = ActionSheetButton.CreateDestroyButton("Destroy", new DelegateCommand(() => { Debug.WriteLine("Destroy"); })); await _pageDialogService.DisplayActionSheetAsync("ActionSheet with ActionSheetButtons", option1Action, option2Action, cancelAction, destroyAction); }
public void Raise(string title = null, IActionSheetButton cancel = null, IActionSheetButton destruction = null, params IActionSheetButton[] buttons) { Requested?.Invoke(this, new DisplayActionSheetRequestEventArgs { Title = title, Cancel = cancel, Destruction = destruction, ActionSheetButtons = buttons }); }
private void DisplayActionSheetUsingActionSheetButtons() { IActionSheetButton option1Action = ActionSheetButton.CreateButton("Option 1", new DelegateCommand(() => Debug.WriteLine("Option 1"))); IActionSheetButton option2Action = ActionSheetButton.CreateButton("Option 2", new DelegateCommand(() => Debug.WriteLine("Option 2"))); IActionSheetButton option3Action = ActionSheetButton.CreateButton("Option 3", new DelegateCommand(() => Debug.WriteLine("Option 3"))); IActionSheetButton option4Action = ActionSheetButton.CreateButton("Option 4", new DelegateCommand(() => Debug.WriteLine("Option 4"))); IActionSheetButton option5Action = ActionSheetButton.CreateButton("Option 5", new DelegateCommand(() => Debug.WriteLine("Option 5"))); IActionSheetButton option6Action = ActionSheetButton.CreateButton("Option 6", new DelegateCommand(() => Debug.WriteLine("Option 6"))); _pageDialogService.DisplayActionSheetAsync("ActionSheet with ActionSheetButtons", option1Action, option2Action, option3Action, option4Action, option5Action, option6Action); }
private void PickStaffCommand(Offer obj) { IActionSheetButton Used = ActionSheetButton.CreateButton("Use Offer", new DelegateCommand(() => { })); IActionSheetButton Share = ActionSheetButton.CreateButton("Share Offer For Friend", new DelegateCommand <Offer>(ShareOffer)); IActionSheetButton Cancel = ActionSheetButton.CreateCancelButton("Cancel", new DelegateCommand(() => { })); IActionSheetButton Delete = ActionSheetButton.CreateDestroyButton("Delete", new DelegateCommand(() => { })); var title = obj.NameOffer; dialog.DisplayActionSheetAsync("What do you want to do with : " + title, Cancel, Used, Share, Delete); }
private async void DisplayActionSheetUsingActionSheetButtons() { var buttons = new IActionSheetButton[] { ActionSheetButton.CreateButton("Option 1", WriteLine, "Option 1"), ActionSheetButton.CreateButton("Option 2", WriteLine, "Option 2"), ActionSheetButton.CreateCancelButton("Cancel", WriteLine, "Cancel"), ActionSheetButton.CreateDestroyButton("Destroy", WriteLine, "Destroy") }; await _pageDialogService.DisplayActionSheetAsync("ActionSheet with ActionSheetButtons", buttons); }
private void OnVideoTapped(YoutubeItem item) { // var navParams = new NavigationParameters(); //navParams.Add("videoKey", item); //_navigationService.NavigateAsync(nameof(VideoDetails), navParams); IActionSheetButton Yes = ActionSheetButton.CreateButton("Yes", new DelegateCommand(() => { Task.Run(() => { Device.OpenUri(new Uri(item.Url)); }); })); IActionSheetButton No = ActionSheetButton.CreateButton("No", new DelegateCommand(() => { Debug.WriteLine("No"); })); _page.DisplayActionSheetAsync("Using third party app for watching video!", Yes, No); Debug.WriteLine($"**** {this.GetType().Name}.{nameof(OnVideoTapped)}; {_videos}"); }
private void ListItemTapped(ReminderItemDB param) { ReminderItemDB list = param as ReminderItemDB; IActionSheetButton cancelAction = ActionSheetButton.CreateCancelButton("Cancel", new DelegateCommand(() => { CancelListhighlight(); })); IActionSheetButton destroyAction = ActionSheetButton.CreateDestroyButton("Destroy", new DelegateCommand(() => { DeleteListItem(list); })); _pageDialogService.DisplayActionSheetAsync("My Action Sheet", cancelAction, destroyAction); }
public async override void DeleteSettings() { var buttons = new IActionSheetButton[] { ActionSheetButton.CreateCancelButton( ResourceService.GetString("ActionSheetButton_Cancel")), ActionSheetButton.CreateDestroyButton( ResourceService.GetString("ActionSheetButton_Delete"), DeleteAction) }; await _pageDialogService.DisplayActionSheetAsync( ResourceService.GetString("LoginSettingsPage_ActionSheet_Title"), buttons); }
public async Task ShowDialogs() { await _dialogService?.DisplayAlertAsync("Display Alert", "This is a Display Alert made with Prism", "OK"); await _dialogService.DisplayActionSheetAsync("ActionSheet", "Cancel", "Destroy", "Button01", "Button02", "Button03"); IActionSheetButton b1 = ActionSheetButton.CreateButton("Button1", async delegate { await _dialogService?.DisplayAlertAsync("Display Alert", "Button 1 Pressed", "OK"); }); IActionSheetButton b2 = ActionSheetButton.CreateCancelButton("Cancel", async delegate { await _dialogService?.DisplayAlertAsync("Display Alert", "Cancel Pressed", "OK"); }); IActionSheetButton b3 = ActionSheetButton.CreateDestroyButton("Destroy", async delegate { await _dialogService?.DisplayAlertAsync("Display Alert", "Destroy Pressed", "OK"); }); await _dialogService.DisplayActionSheetAsync("ActionSheet with IActionSheetButton", b1, b2, b3); }
private async void DisplayActionSheetUsingActionSheetButtons() { IActionSheetButton option1Action = ActionSheetButton.CreateButton("Option 1", () => { //Adding button with multi-line lambda Action int optionValue = 1; Debug.WriteLine($"Option {optionValue}"); }); IActionSheetButton option2Action = ActionSheetButton.CreateButton("Option 2", () => Debug.WriteLine("Option 2")); //Button with simple one-line lambda Action IActionSheetButton cancelAction = ActionSheetButton.CreateCancelButton("Cancel", WriteResponse, "Cancel"); //Using Action<string> to call a method await _pageDialogService.DisplayActionSheetAsync("ActionSheet with ActionSheetButtons", option1Action, option2Action, cancelAction, ActionSheetButton.CreateDestroyButton("Destroy", WriteResponse, "Destroy")); //Inline button creation }
private async Task DisplayActionSheet_PressButton_UsingGenericAction(string text) { var service = new PageDialogServiceMock(text, _applicationProvider); var cancelButtonModel = new ButtonModel(); var destroyButtonModel = new ButtonModel(); var otherButtonModel = new ButtonModel(); var btns = new IActionSheetButton[] { ActionSheetButton.CreateButton("other", OnButtonPressed, otherButtonModel), ActionSheetButton.CreateCancelButton("cancel", OnButtonPressed, cancelButtonModel), ActionSheetButton.CreateDestroyButton("destroy", OnButtonPressed, destroyButtonModel) }; await service.DisplayActionSheetAsync(null, btns); switch (text) { case "other": Assert.True(otherButtonModel.ButtonPressed); Assert.False(cancelButtonModel.ButtonPressed); Assert.False(destroyButtonModel.ButtonPressed); break; case "cancel": Assert.False(otherButtonModel.ButtonPressed); Assert.True(cancelButtonModel.ButtonPressed); Assert.False(destroyButtonModel.ButtonPressed); break; case "destroy": Assert.False(otherButtonModel.ButtonPressed); Assert.False(cancelButtonModel.ButtonPressed); Assert.True(destroyButtonModel.ButtonPressed); break; default: Assert.False(otherButtonModel.ButtonPressed); Assert.False(cancelButtonModel.ButtonPressed); Assert.False(destroyButtonModel.ButtonPressed); break; } }
#pragma warning restore CS0618 // Type or member is obsolete #endregion Obsolete ActionSheetButton using Commands private async Task DisplayActionSheet_PressButton_UsingAction(string text) { var service = new PageDialogServiceMock(text, _applicationProvider); bool cancelButtonPressed = false; bool destroyButtonPressed = false; bool otherButtonPressed = false; var btns = new IActionSheetButton[] { ActionSheetButton.CreateButton("other", () => otherButtonPressed = true), ActionSheetButton.CreateCancelButton("cancel", () => cancelButtonPressed = true), ActionSheetButton.CreateDestroyButton("destroy", () => destroyButtonPressed = true) }; await service.DisplayActionSheetAsync(null, btns); switch (text) { case "other": Assert.True(otherButtonPressed); Assert.False(cancelButtonPressed); Assert.False(destroyButtonPressed); break; case "cancel": Assert.False(otherButtonPressed); Assert.True(cancelButtonPressed); Assert.False(destroyButtonPressed); break; case "destroy": Assert.False(otherButtonPressed); Assert.False(cancelButtonPressed); Assert.True(destroyButtonPressed); break; default: Assert.False(otherButtonPressed); Assert.False(cancelButtonPressed); Assert.False(destroyButtonPressed); break; } }