Exemplo n.º 1
0
        private void OpenDeleteDialog(int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmAuthenticatorDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetPositiveButton(Resource.String.delete, async delegate
            {
                var auth = _authSource.Get(position);
                await TryCleanupCustomIcon(auth.Icon);

                await _authSource.Delete(position);
                _authListAdapter.NotifyItemRemoved(position);

                await NotifyWearAppOfChange();
                CheckEmptyState();
            });

            builder.SetNegativeButton(Resource.String.cancel, delegate { });
            builder.SetCancelable(true);

            var dialog = builder.Create();

            dialog.Show();
        }
        private void OnDeleteClick(object item, int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmCategoryDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetCancelable(true);

            builder.SetPositiveButton(Resource.String.delete, async delegate
            {
                try
                {
                    await _categorySource.Delete(position);
                }
                catch
                {
                    ShowSnackbar(Resource.String.genericError, Snackbar.LengthShort);
                    return;
                }

                RunOnUiThread(delegate
                {
                    _categoryListAdapter.NotifyItemRemoved(position);
                    CheckEmptyState();
                });
            });

            builder.SetNegativeButton(Resource.String.cancel, delegate { });

            var dialog = builder.Create();

            dialog.Show();
        }
        private void ShowUnencryptedWarning(int warningRes, EventHandler onContinue)
        {
            var builder = new MaterialAlertDialogBuilder(Activity);

            builder.SetTitle(Resource.String.warning);
            builder.SetMessage(warningRes);
            builder.SetCancelable(true);

            builder.SetNegativeButton(Resource.String.cancel, delegate { });
            builder.SetPositiveButton(Resource.String.ok, delegate
            {
                onContinue.Invoke(this, EventArgs.Empty);
            });

            builder.Create().Show();
        }
Exemplo n.º 4
0
        private void OnDeleteClick(object item, int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmCategoryDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetCancelable(true);

            builder.SetPositiveButton(Resource.String.delete, async delegate
            {
                var category = _categorySource.Get(position);

                if (category == null)
                {
                    return;
                }

                if (_preferences.DefaultCategory == category.Id)
                {
                    SetDefaultCategory(null);
                }

                try
                {
                    await _categorySource.Delete(position);
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                    ShowSnackbar(Resource.String.genericError, Snackbar.LengthShort);
                    return;
                }

                RunOnUiThread(delegate
                {
                    _categoryListAdapter.NotifyItemRemoved(position);
                    CheckEmptyState();
                });
            });

            builder.SetNegativeButton(Resource.String.cancel, delegate { });

            var dialog = builder.Create();

            dialog.Show();
        }
Exemplo n.º 5
0
            public ErrorReportDialog(Context context, IUpdateChecker server, Exception exception)
            {
                _exception    = exception;
                _updateServer = server;

                var builder = new MaterialAlertDialogBuilder(context);

                builder.SetTitle(Resource.String.title_error);
#if DEBUG
                builder.SetMessage(exception.ToString());
#else
                builder.SetMessage(exception.Message);
#endif
                builder.SetPositiveButton(Resource.String.button_text_report, OnPositiveButtonClick);
                builder.SetNegativeButton(Android.Resource.String.Cancel, (sender, args) => { });
                _dialog = builder.Create();
            }
        private void OnDeleteClick(object item, int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmCategoryDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetCancelable(true);

            builder.SetPositiveButton(Resource.String.delete, async(sender, args) =>
            {
                await _categorySource.Delete(position);
                _categoryListAdapter.NotifyItemRemoved(position);
                CheckEmptyState();
            });

            builder.SetNegativeButton(Resource.String.cancel, (sender, args) => { });

            var dialog = builder.Create();

            dialog.Show();
        }