コード例 #1
0
 public abstract Task <string> ShowTextInputBoxAsync(
     string title,
     string content,
     string hint,
     string positiveText,
     string neutralText,
     INativeDialogStyle nativeDialogStyle = null);
コード例 #2
0
        public async Task <int?> ShowItemsPicker(
            IEnumerable <string> items,
            int selectedIndex,
            string title,
            string cancelText,
            string okText,
            INativeDialogStyle dialogStyle = null)
        {
            var semaphore   = new SemaphoreSlim(0);
            int?returnValue = null;

            var alert = UIAlertController.Create(title, string.Empty, UIAlertControllerStyle.ActionSheet);

            foreach (var item in items)
            {
                alert.AddAction(UIAlertAction.Create(item, UIAlertActionStyle.Default, (x) =>
                {
                    returnValue = Array.IndexOf(alert.Actions, x);
                    semaphore.Release();
                }));
            }

            alert.AddAction(UIAlertAction.Create(cancelText, UIAlertActionStyle.Cancel, x =>
            {
                semaphore.Release();
            }));

            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alert, true, null);

            await semaphore.WaitAsync();

            return(returnValue);
        }
コード例 #3
0
        public async Task <int?> ShowItemsPicker(
            IEnumerable <string> items,
            int selectedIndex,
            string title,
            string cancelText,
            string okText,
            INativeDialogStyle dialogStyle = null)
        {
            var style = (INativeAndroidDialogStyle)dialogStyle;

            var semaphore = new SemaphoreSlim(0);
            var builder   = style is null || style.ThemeResourceId == default
                ? new AlertDialog.Builder(_contextProvider.CurrentContext)
                : new AlertDialog.Builder(_contextProvider.CurrentContext, style.ThemeResourceId);

            int?selectedItem = selectedIndex;

            builder.SetTitle(title);
            builder.SetSingleChoiceItems(items.ToArray(), selectedIndex, (sender, args) =>
            {
                selectedItem = args.Which;
            });
            builder.SetNegativeButton(cancelText, (sender, args) =>
            {
                selectedItem = null;
                semaphore.Release();
            });
            builder.SetPositiveButton(okText, (sender, args) => semaphore.Release());

            style?.SetStyle(builder);
            var dialog = builder.Create();

            dialog.SetCanceledOnTouchOutside(false);
            dialog.SetCancelable(false);
            style?.SetStyle(dialog);

            await semaphore.WaitAsync();

            dialog.Dismiss();

            return(selectedItem);
        }
コード例 #4
0
 public Task <int?> ShowItemsPicker(IEnumerable <string> items, int selectedIndex, string title, string cancelText, string okText,
                                    INativeDialogStyle dialogStyle = null)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public IDisposable ObtainLoaderLifetime(string title, string content, INativeDialogStyle nativeDialogStyle) =>
 new LoaderLifetimeManager(this, title, content);
コード例 #6
0
 public abstract void ShowLoadingPopup(
     string title   = null,
     string content = null,
     INativeDialogStyle nativeDialogStyle = null);
コード例 #7
0
 public abstract Task ShowMessageBoxOkAsync(
     string title,
     string content,
     string neutralText,
     INativeDialogStyle nativeDialogStyle = null);
コード例 #8
0
 public abstract Task <bool> ShowMessageBoxWithInputAsync(
     string title,
     string content,
     string positiveText,
     string negativeText,
     INativeDialogStyle nativeDialogStyle = null);