Ejemplo n.º 1
0
        public static ActionSheetOptions <bool> TrueFalse()
        {
            var succesOptions = new Dictionary <string, bool>
            {
                { "Yes", true },
                { "No", false }
            };

            var options = new ActionSheetOptions <bool>(Translations.Global_Cancel, succesOptions);

            return(options);
        }
Ejemplo n.º 2
0
    public async Task<ActionSheetResult<T>> ShowActionSheet<T>(string titleText, ActionSheetOptions<T> actionsheetOptions)
    {
      var selectoptions = actionsheetOptions.SelectOptions.Keys.ToArray();
      var cancelOption = actionsheetOptions.CancelOption;

      var selectedOption = await UserDialogs.Instance.ActionSheetAsync(titleText, cancelOption, null, null, selectoptions);

      if (selectedOption == cancelOption)
        return new ActionSheetResult<T> { isCancelled = true, SelectedOption = default };

      var options = actionsheetOptions.SelectOptions.First(e => e.Key == selectedOption);

      return new ActionSheetResult<T> { isCancelled = false, SelectedOption = options.Value };
    }