public Task <string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons) { var args = new ActionSheetArguments(title, cancel, destruction, buttons); MessagingCenter.Send(this, ActionSheetSignalName, args); return(args.Result.Task); }
void ActionSheetSignalNameHandler(Page sender, ActionSheetArguments arguments) { //Managing buttons logic behavior with Xamarin.Forms List <string> buttons = new List <string>(); if (string.IsNullOrEmpty(arguments.Destruction)) { //In mobile plateform, the Destruction button, if set, must be the top one //We cannot colorize it buttons.Add(arguments.Destruction); } //Adding selection buttons.AddRange(arguments.Buttons); //In ActionSheet, Cancel is always the last one buttons.Add(arguments.Cancel); string[] buttonsArray = buttons.ToArray(); Device.BeginInvokeOnMainThread(async() => { var messageBoxResult = await Electron.Dialog.ShowMessageBoxAsync(new ElectronNET.API.Entities.MessageBoxOptions(arguments.Title) { Buttons = buttonsArray, Type = ElectronNET.API.Entities.MessageBoxType.question, NoLink = false }); arguments.SetResult(buttonsArray[messageBoxResult.Response]); }); }
public Task <string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons) { var args = new ActionSheetArguments(title, cancel, destruction, buttons); if (IsPlatformEnabled) { MessagingCenter.Send(this, ActionSheetSignalName, args); } else { _pendingActions.Add(() => MessagingCenter.Send(this, ActionSheetSignalName, args)); } return(args.Result.Task); }
public Task<string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons) { var args = new ActionSheetArguments(title, cancel, destruction, buttons); MessagingCenter.Send(this, ActionSheetSignalName, args); return args.Result.Task; }
void ActionSheetSignalNameHandler(Page sender, ActionSheetArguments arguments) { //Some inspiration can be taken from here: https://github.com/xamarin/Xamarin.Forms/blob/fda800ca4c9d9a24b531721d7a18114169e2d8ec/Xamarin.Forms.Platform.Tizen/Platform.cs }