Exemplo n.º 1
0
        /// <summary> Gets action sheet configuration. </summary>
        /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
        /// <param name="config"> The configuration. </param>
        /// <returns> The action sheet configuration. </returns>
        private AcrDialogs.ActionSheetConfig GetActionSheetConfig(UserDialogActionSheetConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var result = new AcrDialogs.ActionSheetConfig();

            if (config.Title != null)
            {
                result.Title = config.Title;
            }
            if (config.Message != null)
            {
                result.Message = config.Message;
            }
            if (config.Cancel != null)
            {
                result.Cancel = GetActionSheetOption(config.Cancel);
            }
            if (config.Destructive != null)
            {
                result.Destructive = GetActionSheetOption(config.Destructive);
            }
            if (config.Options != null)
            {
                result.Options = config.Options.Select(GetActionSheetOption).ToList();
            }
            if (config.AndroidStyleId != null)
            {
                result.AndroidStyleId = config.AndroidStyleId;
            }
            if (config.UseBottomSheet != null)
            {
                result.UseBottomSheet = config.UseBottomSheet.Value;
            }
            if (config.ItemIcon != null)
            {
                result.ItemIcon = config.ItemIcon;
            }

            return(result);
        }
Exemplo n.º 2
0
 /// <summary> Action sheet. </summary>
 /// <param name="config"> The configuration. </param>
 /// <returns> An IDisposable. </returns>
 public IDisposable ActionSheet(UserDialogActionSheetConfig config)
 {
     return(AcrDialogs.UserDialogs.Instance.ActionSheet(GetActionSheetConfig(config)));
 }