示例#1
0
        void ShowForgotPasswordScreen()
        {
            //Inflate layout
            View        view    = LayoutInflater.Inflate(Resource.Layout.ForgotPasswordAlertDialogScreen, null);
            AlertDialog builder = new AlertDialog.Builder(this).Create();

            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(false);
            EditText textUsername = view.FindViewById <EditText>(Resource.Id.textUsername);
            Button   buttonSubmit = view.FindViewById <Button>(Resource.Id.buttonSubmit);
            Button   buttonCancel = view.FindViewById <Button>(Resource.Id.buttonCancel);

            buttonCancel.Click += delegate {
                builder.Dismiss();
            };
            buttonSubmit.Click += delegate
            {
                if (textUsername.Text.Length > 0)
                {
                    SendAccountRecoveryEmail(textUsername.Text);
                    builder.Dismiss();
                    Toast.MakeText(this, "Email sent!", ToastLength.Long).Show();
                }
                else
                {
                    Toast.MakeText(this, "Please enter your username", ToastLength.Short).Show();
                }
            };
            builder.Show();
        }
示例#2
0
        public static void DisplayAlert(string title = "Exception", string message = "", ViewStates viewStates = ViewStates.Invisible)
        {
            var inflater = LayoutInflater.From(mcontext);
            var dialog   = new AlertDialog.Builder(mcontext).Create();
            var view     = inflater.Inflate(Resource.Layout.AlertInterface, null);

            var _title     = view.FindViewById <TextView>(Resource.Id._alertTitle);
            var _message   = view.FindViewById <TextView>(Resource.Id._alertMessage);
            var _okBtn     = view.FindViewById <Button>(Resource.Id._okBtn);
            var _cancleBtn = view.FindViewById <Button>(Resource.Id._cancelBtn);

            _cancleBtn.Visibility = viewStates;

            _okBtn.Click += delegate { dialog.Dismiss(); };

            _cancleBtn.Click += delegate { dialog.Dismiss(); };

            _title.Text   = title;
            _message.Text = message;

            dialog.SetView(view);

            dialog.SetIcon(Resource.Drawable.warning_icon);

            dialog.Show();
        }
示例#3
0
        private void chooseAlertDialog()
        {
            //Inflate layout
            var view       = LayoutInflater.Inflate(Resource.Layout.chooseDialog, null);
            var takeBtn    = view.FindViewById <Button>(Resource.Id.takeBtns);
            var chooseBtns = view.FindViewById <Button>(Resource.Id.chooseBtns);
            var cancelBtn  = view.FindViewById <Button>(Resource.Id.cancel);
            var builder    = new AlertDialog.Builder(this).Create();

            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(false);
            cancelBtn.Click += delegate
            {
                builder.Dismiss();
            };

            takeBtn.Click += delegate
            {
                builder.Dismiss();
                takePhoto();
            };
            chooseBtns.Click += delegate
            {
                builder.Dismiss();
                Intent intent = new Intent(Intent.ActionPick, MediaStore.Images.Media.ExternalContentUri);
                StartActivityForResult(intent, 1);
            };
            builder.Show();
        }
示例#4
0
        private void inputAlertDialog(string filename, byte[] imgbyte)
        {
            //Inflate layout
            var view      = LayoutInflater.Inflate(Resource.Layout.inputDialog, null);
            var okBtn     = view.FindViewById <Button>(Resource.Id.okBtns);
            var cancelBtn = view.FindViewById <Button>(Resource.Id.cancelBtns);
            var fileName  = view.FindViewById <EditText>(Resource.Id.fileName);

            fileName.SetText(filename, TextView.BufferType.Editable);
            var builder = new AlertDialog.Builder(this).Create();

            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(false);
            cancelBtn.Click += delegate
            {
                builder.Dismiss();
                builder.Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);
                //Toast.MakeText(this, "Alert dialog dismissed!", ToastLength.Short).Show();
            };

            okBtn.Click += delegate
            {
                builder.Dismiss();
                builder.Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);
                new Handler().Post(() => uploadFile(fileName.Text, imgbyte));
            };
            builder.Show();
            ShowKeyboard(fileName, builder);
        }
        public void getDialogCreateSujet()
        {
            View        view        = LayoutInflater.Inflate(Resource.Layout.createSujetDialogLayout, null);
            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetView(view);
            alertDialog.SetCanceledOnTouchOutside(false);

            Button   btnValiderCreate = view.FindViewById <Button>(Resource.Id.btnValiderCreatSujet);
            Button   btnExit          = view.FindViewById <Button>(Resource.Id.btnExit);
            EditText txtSujet         = view.FindViewById <EditText>(Resource.Id.txtNomSujet);


            btnExit.Click += delegate
            {
                alertDialog.Dismiss();
            };

            btnValiderCreate.Click += delegate
            {
                var nomSujet  = txtSujet.Text;
                var checkName = db.getAllSujets().Find(x => x.nomSujet == txtSujet.Text);
                if (nomSujet != "")
                {
                    if (checkName == null)
                    {
                        Random aleatoire = new Random();
                        int    idRandom  = aleatoire.Next();

                        Sujet s = new Sujet()
                        {
                            idSujet = idRandom, idUser = idUser, nomSujet = nomSujet
                        };
                        Abonnement a = new Abonnement()
                        {
                            NomSujetAbon = s.nomSujet, idUserAbon = idUser
                        };

                        db.addSujet(s);
                        db.addAbonnement(a);

                        alertDialog.Dismiss();
                        Toast.MakeText(this, "Le sujet \"" + nomSujet + "\" a été créé", ToastLength.Long).Show();
                        this.getListeSujets();
                    }
                    else
                    {
                        Toast.MakeText(this, "Le sujet avec le nom \"" + txtSujet.Text + "\" existe dèja!", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Veuillez saisir le nom du sujet!", ToastLength.Short).Show();
                }
            };

            alertDialog.Show();
        }
示例#6
0
        private static void CreateEditReply(BaseAniDroidActivity context, string oldText, Func <string, Task> saveAction, Func <Task> deleteAction)
        {
            var dialog          = new AlertDialog.Builder(context, context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create();
            var dialogView      = context.LayoutInflater.Inflate(Resource.Layout.Dialog_AniListActivityCreate, null);
            var replyText       = dialogView.FindViewById <EditText>(Resource.Id.AniListActivityCreate_Text);
            var replyTextLayout = dialogView.FindViewById <TextInputLayout>(Resource.Id.AniListActivityCreate_TextLayout);

            replyTextLayout.Hint = "Reply Text";

            replyText.Text = oldText;

            dialog.SetView(dialogView);

            dialog.SetButton((int)DialogButtonType.Negative, "Cancel", (send, args) => dialog.Dismiss());
            dialog.SetButton((int)DialogButtonType.Positive, "Save", (send, args) => { });
            dialog.SetButton((int)DialogButtonType.Neutral, "Delete", (send, args) =>
            {
                var confirmationDialog = new AlertDialog.Builder(context,
                                                                 context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create();
                confirmationDialog.SetTitle("Delete Reply");
                confirmationDialog.SetMessage("Are you sure you wish to delete this reply?");

                confirmationDialog.SetButton((int)DialogButtonType.Negative, "Cancel",
                                             (cSend, cArgs) => confirmationDialog.Dismiss());
                confirmationDialog.SetButton((int)DialogButtonType.Positive, "Delete",
                                             (cSend, cArgs) =>
                {
                    confirmationDialog.Dismiss();
                    dialog.Dismiss();
                    deleteAction?.Invoke();
                });

                confirmationDialog.Show();
            });

            dialog.ShowEvent += (sender2, e2) =>
            {
                var createButton = dialog.GetButton((int)DialogButtonType.Positive);
                createButton.SetOnClickListener(new InterceptClickListener(async() =>
                {
                    if (string.IsNullOrWhiteSpace(replyText.Text))
                    {
                        Toast.MakeText(context, "Text can't be empty!", ToastLength.Short).Show();
                        return;
                    }

                    await saveAction(replyText.Text);
                    dialog.Dismiss();
                }));
            };

            dialog.Show();
        }
示例#7
0
        public void DialogCreateSPE()
        {
            View        view        = LayoutInflater.Inflate(Resource.Layout.newSpecialiteDialogLayout, null);
            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetView(view);
            alertDialog.SetCanceledOnTouchOutside(false);

            Button   btnInsertSPE = view.FindViewById <Button>(Resource.Id.btnInsertSPE);
            Button   btnExit      = view.FindViewById <Button>(Resource.Id.btnExit);
            EditText txtCode      = view.FindViewById <EditText>(Resource.Id.txtCodeDialogINS);
            EditText txtLibelle   = view.FindViewById <EditText>(Resource.Id.txtLibelleDialogINS);

            txtCode.Hint = "Saisissez trois letres";

            btnExit.Click += delegate
            {
                alertDialog.Dismiss();
            };

            btnInsertSPE.Click += delegate
            {
                var codeSPE    = txtCode.Text;
                var libelleSPE = txtLibelle.Text;
                var checkCode  = lesSpecialites.Find(x => x.codeSPE == codeSPE);
                if (codeSPE != "" && libelleSPE != "")
                {
                    if (checkCode == null)
                    {
                        Uri url = new Uri("http://" + GetString(Resource.String.ip) + "insertSpecialite.php?codeSPE=" + codeSPE + "&libelleSPE=" + libelleSPE);
                        ws.DownloadDataAsync(url);
                        Specialite spe = new Specialite()
                        {
                            codeSPE = codeSPE, libelleSPE = libelleSPE
                        };
                        lesSpecialites.Add(spe);
                        alertDialog.Dismiss();
                        this.ListSpecialites();
                        Toast.MakeText(this, "La spécialité a été créée", ToastLength.Long).Show();
                    }
                    else
                    {
                        Toast.MakeText(this, "La spécialité avec le code \"" + codeSPE + "\" existe dèja!", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Veuillez saisir le code ou le nom !", ToastLength.Short).Show();
                }
            };

            alertDialog.Show();
        }
示例#8
0
        public virtual Task <int?> Select(string title, int?selectedIndex, IEnumerable <string> items, CancellationToken cancellation)
        {
            var context = _contextFactory();

            if (context == null)
            {
                return(Task.FromResult <int?>(null));
            }

            var syncContext = SynchronizationContext.Current;
            var tcs         = new TaskCompletionSource <int?>();
            var dialog      = new AlertDialog.Builder(context)
                              .SetTitle(title)
                              .SetSingleChoiceItems(items.ToArray(),
                                                    selectedIndex ?? 0,
                                                    new ClickListener((e, i) =>
            {
                e.Dismiss();
                tcs.TrySetResult(i);
            }))
                              .SetOnCancelListener(new ClickListener((e, i) =>
            {
                e.Dismiss();
                tcs.TrySetResult(null);
            }))
                              .Create();

            dialog.Show();
            cancellation.Register(() =>
            {
                syncContext.Post(_ => dialog.Dismiss(), null);
                tcs.TrySetResult(null);
            });
            return(tcs.Task);
        }
示例#9
0
        public void ShowMessage(Context context, int?titleId, ICharSequence message, int buttonid = Android.Resource.String.Ok)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var alertDialog = new AlertDialog.Builder(context).Create();

            alertDialog.SetCancelable(false);

            if (titleId.HasValue)
            {
                alertDialog.SetTitle(titleId.Value);
            }

            alertDialog.SetMessage(message);
            alertDialog.SetButton(context.GetString(buttonid), (s, e) =>
            {
                if (e.Which == -1)
                {
                    alertDialog.Dismiss();
                    alertDialog = null;
                }
            });

            alertDialog.Show();
        }
        public static void CreateNewActivity(BaseAniDroidActivity context, Func <string, Task> saveAction)
        {
            var dialog     = new AlertDialog.Builder(context, context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create();
            var dialogView = context.LayoutInflater.Inflate(Resource.Layout.Dialog_AniListActivityCreate, null);

            dialog.SetView(dialogView);

            dialog.SetButton((int)DialogButtonType.Negative, "Cancel", (send, args) => dialog.Dismiss());
            dialog.SetButton((int)DialogButtonType.Positive, "Post", (send, args) => { });

            dialog.ShowEvent += (sender2, e2) =>
            {
                var activityText = dialogView.FindViewById <EditText>(Resource.Id.AniListActivityCreate_Text);
                var createButton = dialog.GetButton((int)DialogButtonType.Positive);
                createButton.SetOnClickListener(new InterceptClickListener(async() =>
                {
                    if (string.IsNullOrWhiteSpace(activityText.Text))
                    {
                        Toast.MakeText(context, "Text can't be empty!", ToastLength.Short).Show();
                        return;
                    }

                    await saveAction(activityText.Text);
                    dialog.Dismiss();
                }));
            };

            dialog.Show();
        }
示例#11
0
            public void HandleResult(ZXing.Result rawResult)
            {
                if (codBarrasV2.PopUp == false)
                {
                    codBarrasV2.PopUp = true;

                    //Aciona o beep
                    MediaPlayer mp;
                    mp = MediaPlayer.Create(codBarrasV2.ApplicationContext, Resource.Raw.beep);// the song is a filename which i have pasted inside a folder **raw** created under the **res** folder.//
                    mp.Start();

                    AlertDialog alertDialog = new AlertDialog.Builder(this.codBarrasV2).Create();
                    alertDialog.SetTitle("Código" + rawResult.BarcodeFormat);
                    alertDialog.SetMessage(rawResult.BarcodeFormat + ": " + rawResult.Text);
                    alertDialog.SetButton("Ok", delegate
                    {
                        alertDialog.Dismiss();
                        this.codBarrasV2.StartCamera();
                    });

                    alertDialog.Show();
                    codBarrasV2.textResult.Text = (rawResult.BarcodeFormat + ": " + rawResult.Text);
                    codBarrasV2.PopUp           = false;
                }
            }
示例#12
0
        public async Task <bool> ShowQuestionDialogAsync(string title, string message, string positiveButtonText, string negativeButtonText, CancellationToken token)
        {
            var completionSource = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously);

            AlertDialog dialog = null;

            dialog = new AlertDialog.Builder(_context)
                     .SetTitle(title)
                     .SetMessage(message)
                     .SetPositiveButton(positiveButtonText ?? "Ok", (sender, args) =>
            {
                dialog.Dismiss();
                completionSource.SetResult(true);
            })
                     .SetNegativeButton(negativeButtonText ?? "Cancel", (sender, args) =>
            {
                dialog.Dismiss();
                completionSource.SetResult(false);
            })
                     .Create();

            dialog.SetCancelable(false);
            dialog.SetCanceledOnTouchOutside(false);
            dialog.Show();

            using (token.Register(() =>
            {
                dialog.Dismiss();
                completionSource.SetCanceled();
            }))
            {
                return(await completionSource.Task);
            }
        }
示例#13
0
        public void verification()
        {
            View        view    = LayoutInflater.Inflate(Resource.Layout.verify_layout, null);
            AlertDialog builder = new AlertDialog.Builder(Activity).Create();

            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(false);
            EditText code = view.FindViewById <EditText>(Resource.Id.code_p);

            resend = view.FindViewById <Button>(Resource.Id.resend_p);
            Button submit = view.FindViewById <Button>(Resource.Id.submit_p);

            resend.Click += delegate
            {
                Send_Number();
            };

            submit.Click += delegate
            {
                verify_code = code.Text;
                submit_Code();
                builder.Dismiss();
                //Toast.MakeText(this, "Alert dialog dismissed!", ToastLength.Short).Show();
            };
            builder.Show();
        }
示例#14
0
        public static void Create(BaseAniDroidActivity context, Action <string, string> searchAction, string searchType = "", string searchTerm = null)
        {
            var dialogue       = context.LayoutInflater.Inflate(Resource.Layout.Dialog_Search, null);
            var searchTypeView = dialogue.FindViewById <Spinner>(Resource.Id.Search_Type);
            var searchTermView = dialogue.FindViewById <EditText>(Resource.Id.Search_Text);

            searchTypeView.Adapter = new ArrayAdapter <string>(context, Resource.Layout.View_SpinnerDropDownItem, SearchResultsActivity.AniListSearchTypes.AllTypes);

            searchTermView.Text = searchTerm;

            if (SearchResultsActivity.AniListSearchTypes.AllTypes.Contains(searchType))
            {
                searchTypeView.SetSelection(Array.FindIndex(SearchResultsActivity.AniListSearchTypes.AllTypes, x => x == searchType));
            }

            var a = new AlertDialog.Builder(context, context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create();

            a.SetView(dialogue);
            a.SetTitle("Search AniList");
            a.SetButton((int)DialogButtonType.Neutral, "Cancel", (aS, eV) => a.Dismiss());
            a.SetButton((int)DialogButtonType.Positive, "Search", (aS, ev) => searchAction((string)searchTypeView.Adapter.GetItem(searchTypeView.SelectedItemPosition), searchTermView.Text));

            searchTermView.EditorAction += (tS, tE) =>
            {
                if (tE.ActionId == Android.Views.InputMethods.ImeAction.Search)
                {
                    searchAction((string)searchTypeView.Adapter.GetItem(searchTypeView.SelectedItemPosition),
                                 searchTermView.Text);
                }
            };

            a.Show();
        }
示例#15
0
        public void getDialogNewMessage()
        {
            View        view        = LayoutInflater.Inflate(Resource.Layout.createMessageDialogLayout, null);
            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetView(view);
            alertDialog.SetCanceledOnTouchOutside(false);

            Button   btnEnvoyerMessage = view.FindViewById <Button>(Resource.Id.btnEnvoyerMessageDialog);
            Button   btnExit           = view.FindViewById <Button>(Resource.Id.btnSortirMessageDialog);
            EditText txtMessage        = view.FindViewById <EditText>(Resource.Id.txtMessageDialog);


            btnExit.Click += delegate
            {
                alertDialog.Dismiss();
            };

            btnEnvoyerMessage.Click += delegate
            {
                var message = txtMessage.Text;
                if (message != "")
                {
                    Random          aleatoire = new Random();
                    int             idRandom  = aleatoire.Next();
                    Modeles.Message m         = new Modeles.Message()
                    {
                        idMessage = idRandom, idSujet = idSujet, idCreateur = idUser, textMessage = message
                    };
                    db.addMessage(m);
                    alertDialog.Dismiss();
                    this.getListeMessage();

                    //List<Sujet> lesSujs = new List<Sujet>();
                    //lesSujs = db.getAllAbonementsByUser(idUser);
                    //adapterSujet = new SujetAdapter(this, lesSujs);
                    //ListView lstSujet = FindViewById<ListView>(Resource.Id.lstSujet);
                    //lstSujet.Adapter = adapterSujet;
                }
                else
                {
                    Toast.MakeText(this, "Veuillez saisir le message!", ToastLength.Short).Show();
                }
            };

            alertDialog.Show();
        }
示例#16
0
        private void UpdatePhone_Click(object sender, EventArgs e)
        {
            View        view           = LayoutInflater.From(this).Inflate(Resource.Layout.dialog_phone, null, false);
            AlertDialog dialog         = new AlertDialog.Builder(this).SetView(view).Create();
            EditText    edtCountryCode = view.FindViewById <EditText>(Resource.Id.edtCountryCode);
            EditText    edtAccount     = view.FindViewById <EditText>(Resource.Id.edtAccount);
            EditText    edtVerifyCode  = view.FindViewById <EditText>(Resource.Id.edtVerifyCode);
            Button      btnSend        = view.FindViewById <Button>(Resource.Id.btnSend);
            Button      btnUpdate      = view.FindViewById <Button>(Resource.Id.btnUpdate);

            btnSend.Click += async delegate
            {
                string countryCode = edtCountryCode.Text.ToString().Trim();
                string phoneNumber = edtAccount.Text.ToString().Trim();

                // Build a verify code settings.
                VerifyCodeSettings settings = VerifyCodeSettings.NewBuilder().Action(VerifyCodeSettings.ActionRegisterLogin).Build();
                // Request verify code,and waiting for the verification code to be sent to your mobile phone
                try
                {
                    var requestVerifyCode             = AGConnectAuth.Instance.RequestVerifyCodeAsync(countryCode, phoneNumber, settings);
                    VerifyCodeResult verifyCodeResult = await requestVerifyCode;
                    if (requestVerifyCode.Status.Equals(System.Threading.Tasks.TaskStatus.RanToCompletion))
                    {
                        Toast.MakeText(this, "Send phone verify code success! ", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
                }
            };

            btnUpdate.Click += async delegate
            {
                string countryCode = edtCountryCode.Text.ToString().Trim();
                string phoneNumber = edtAccount.Text.ToString().Trim();
                string verifyCode  = edtVerifyCode.Text.ToString().Trim();
                if (AGConnectAuth.Instance.CurrentUser != null)
                {
                    // Update phone
                    try
                    {
                        var   requestUpdatePhone = AGConnectAuth.Instance.CurrentUser.UpdatePhoneAsync(countryCode, phoneNumber, verifyCode);
                        await requestUpdatePhone;
                        if (requestUpdatePhone.Status.Equals(System.Threading.Tasks.TaskStatus.RanToCompletion))
                        {
                            Toast.MakeText(this, "Update phone success! ", ToastLength.Short).Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(this, "Update phone failed! " + ex.Message, ToastLength.Short).Show();
                    }
                }
                dialog.Dismiss();
            };
            dialog.Show();
        }
示例#17
0
        void HandleScanResult(ZXing.Result result)
        {
            string msg = "";

            if (result != null && !string.IsNullOrEmpty(result.Text))
            {
                msg = "Found Barcode: " + result.Text;
                var product = ProductDB.FindByBarcode(result.Text);


                if (product != null)
                {
                    var view = LayoutInflater.Inflate(Resource.Layout.productCard, null);

                    var name  = view.FindViewById <EditText>(Resource.Id.nameInputCard);
                    var desc  = view.FindViewById <EditText>(Resource.Id.descriptionInputCard);
                    var price = view.FindViewById <EditText>(Resource.Id.priceInputCard);
                    var code  = view.FindViewById <EditText>(Resource.Id.codeInputCard);

                    name.Text    = product.ProductName;
                    desc.Text    = product.Description;
                    price.Text   = product.Price.ToString();
                    code.Text    = product.BarCodeInfo;
                    code.Enabled = price.Enabled = desc.Enabled = name.Enabled = false;

                    var dialog = new AlertDialog.Builder(this)
                                 .SetView(view)
                                 .SetTitle("Search result:")
                                 .Create();
                    dialog.SetButton("OK", (s, e) => { dialog.Dismiss(); });
                    dialog.Show();
                }
                else
                {
                    new AlertDialog.Builder(this)
                    .SetView(new TextView(this)
                    {
                        Text = "Sorry, nothing to show! Run web search?"
                    })
                    .SetTitle("SearchResult")
                    .SetPositiveButton("OK", (s, e) =>
                    {
                        var intent = new Intent(Intent.ActionWebSearch);
                        intent.PutExtra(SearchManager.Query, result.Text);
                        StartActivity(intent);
                    })
                    .SetNegativeButton("Cancel", (s, e) => { })
                    .Show();
                }
            }

            else
            {
                msg = "Scanning Canceled!";
            }

            this.RunOnUiThread(() => Toast.MakeText(this, msg, ToastLength.Short).Show());
        }
示例#18
0
        public void DialogModifierSPE(Specialite spaIntent)
        {
            View        view        = LayoutInflater.Inflate(Resource.Layout.newSpecialiteDialogLayout, null);
            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetView(view);
            alertDialog.SetCanceledOnTouchOutside(false);

            Button   btnInsertSPE = view.FindViewById <Button>(Resource.Id.btnInsertSPE);
            Button   btnExit      = view.FindViewById <Button>(Resource.Id.btnExit);
            EditText txtCode      = view.FindViewById <EditText>(Resource.Id.txtCodeDialogINS);
            EditText txtLibelle   = view.FindViewById <EditText>(Resource.Id.txtLibelleDialogINS);

            txtCode.Text    = spaIntent.codeSPE;
            txtLibelle.Text = spaIntent.libelleSPE;

            btnExit.Click += delegate
            {
                alertDialog.Dismiss();
            };

            btnInsertSPE.Click += delegate
            {
                var codeSPE    = txtCode.Text;
                var libelleSPE = txtLibelle.Text;
                if (codeSPE != "" && libelleSPE != "")
                {
                    Uri url = new Uri("http://" + GetString(Resource.String.ip) + "modifierSpecialite.php?codeSPE=" + codeSPE + "&libelleSPE=" + libelleSPE);
                    ws.DownloadDataAsync(url);
                    lesSpecialites.Where(s => s.codeSPE == codeSPE).First().libelleSPE = libelleSPE;
                    alertDialog.Dismiss();
                    this.ListSpecialites();
                    Toast.MakeText(this, "La spécialité a été modifée", ToastLength.Long).Show();
                }
                else
                {
                    Toast.MakeText(this, "Veuillez saisir le code ou le nom !", ToastLength.Short).Show();
                }
            };

            alertDialog.Show();
        }
示例#19
0
        private void ResetPassword_Click(object sender, EventArgs e)
        {
            View        view           = LayoutInflater.From(this).Inflate(Resource.Layout.dialog_reset_password, null, false);
            AlertDialog dialog         = new AlertDialog.Builder(this).SetView(view).Create();
            EditText    edtEmail       = view.FindViewById <EditText>(Resource.Id.edtEmail);
            EditText    edtNewPassword = view.FindViewById <EditText>(Resource.Id.edtNewPassword);
            EditText    edtVerifyCode  = view.FindViewById <EditText>(Resource.Id.edtVerifyCode);
            Button      btnSend        = view.FindViewById <Button>(Resource.Id.btnSend);
            Button      btnUpdate      = view.FindViewById <Button>(Resource.Id.btnUpdate);

            btnSend.Click += async delegate
            {
                string email = edtEmail.Text.ToString().Trim();
                // Build a verify code settings.
                VerifyCodeSettings settings = VerifyCodeSettings.NewBuilder().Action(VerifyCodeSettings.ActionResetPassword).Build();
                // Request verify code,and waiting for the verification code to be sent to your mobile phone
                try
                {
                    var requestVerifyCode             = AGConnectAuth.Instance.RequestVerifyCodeAsync(email, settings);
                    VerifyCodeResult verifyCodeResult = await requestVerifyCode;
                    if (requestVerifyCode.Status.Equals(System.Threading.Tasks.TaskStatus.RanToCompletion))
                    {
                        Toast.MakeText(this, "Send email verify code success! ", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
                }
            };

            btnUpdate.Click += async delegate
            {
                string email       = edtEmail.Text.ToString().Trim();
                string newPassword = edtNewPassword.Text.ToString().Trim();
                string verifyCode  = edtVerifyCode.Text.ToString().Trim();
                // Reset password
                try
                {
                    var   resetPasswordResult = AGConnectAuth.Instance.ResetPasswordAsync(email, newPassword, verifyCode);
                    await resetPasswordResult;
                    if (resetPasswordResult.Status.Equals(System.Threading.Tasks.TaskStatus.RanToCompletion))
                    {
                        Toast.MakeText(this, "Password has been reset.", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "Reset password failed: " + ex.Message, ToastLength.Long).Show();
                }
                dialog.Dismiss();
            };
            dialog.Show();
        }
示例#20
0
        public static void ShowDialog(Context context, string message)
        {
            AlertDialog alertDialog = new AlertDialog.Builder(context).Create();

            alertDialog.SetMessage(message);
            alertDialog.SetButton("OK", (s, e) =>
            {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
        private void ListView_Click(object sender, AdapterView.ItemClickEventArgs e)
        {
            Message item = adapter[e.Position];

            AlertDialog alert = new AlertDialog.Builder(this).Create();

            alert.SetTitle(item.Sender);
            alert.SetMessage(item.Text + "\n\n" + item.Date + "\n" + item.RequestStatusCode);

            alert.SetButton("OK", (senderAlert, args) => {
                alert.Dismiss();
            });

            alert.SetButton2("RETRY", (senderAlert, args) => {
                alert.Dismiss();
                Forward(item);
            });

            alert.Show();
        }
示例#22
0
        public static void ShowMsgBox_OK(Activity currentActivity, string title, string msg)
        {
            AlertDialog alertDialog = new AlertDialog.Builder(currentActivity).Create();

            alertDialog.SetTitle(title);
            alertDialog.SetMessage(msg);

            alertDialog.SetButton((int)DialogButtonType.Neutral, "OK",
                                  (object sender, DialogClickEventArgs e) => {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
示例#23
0
        public async Task <InputDialogResult> ShowInputDialogAsync(string title, string message, string initialValue, string placeHolder, string positiveButtonText, string negativeButtonText, KeyboardType keyboardType, CancellationToken token)
        {
            var completionSource = new TaskCompletionSource <InputDialogResult>(TaskCreationOptions.RunContinuationsAsynchronously);

            var inputMethodManager = (InputMethodManager)_context.GetSystemService(Context.InputMethodService);

            var view          = _context.LayoutInflater.Inflate(Resource.Layout.InputDialog, null);
            var valueEditText = view.FindViewById <EditText>(Resource.Id.value_edittext);

            valueEditText.Text = initialValue ?? string.Empty;
            valueEditText.Hint = placeHolder ?? string.Empty;
            valueEditText.SetSelection(valueEditText.Text.Length);
            valueEditText.SetRawInputType(KeyboardTypeToRawInputType(keyboardType));

            AlertDialog dialog = null;

            dialog = new AlertDialog.Builder(_context)
                     .SetTitle(title)
                     .SetMessage(message)
                     .SetView(view)
                     .SetPositiveButton(positiveButtonText ?? "Ok", (sender, args) =>
            {
                inputMethodManager.HideSoftInputFromWindow(valueEditText.ApplicationWindowToken, 0);
                dialog.Dismiss();
                completionSource.TrySetResult(new InputDialogResult(true, valueEditText.Text));
            })
                     .SetNegativeButton(negativeButtonText ?? "Cancel", (sender, args) =>
            {
                inputMethodManager.HideSoftInputFromWindow(valueEditText.ApplicationWindowToken, 0);
                dialog.Dismiss();
                completionSource.TrySetResult(new InputDialogResult(false, valueEditText.Text));
            })
                     .Create();

            dialog.SetCancelable(false);
            dialog.SetCanceledOnTouchOutside(false);
            dialog.Show();

            valueEditText.RequestFocus();
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);

            using (token.Register(() =>
            {
                dialog.Dismiss();
                completionSource.TrySetCanceled();
            }))
            {
                return(await completionSource.Task);
            }
        }
        void OptionsClicked(FeedItem item)
        {
            if (item.CreatedById == CrossSettings.Current.GetValueOrDefaultJson <User>("User").Id)
            {
                var view   = activity.LayoutInflater.Inflate(Resource.Layout.PostOptionsLayout, null);
                var dialog = new AlertDialog.Builder(activity).SetView(view).Create();
                view.FindViewById <Button>(Resource.Id.btnEditPost).Click += (sender, args) =>
                {
                    dialog.Dismiss();
                    Intent intent = new Intent(activity, typeof(EditPostActivity));
                    intent.PutExtra("PostId", item.Id);
                    activity.StartActivity(intent);
                };

                view.FindViewById <Button>(Resource.Id.btnDeletePost).Click += (sender, args) =>
                {
                    dialog.Dismiss();
                    new AlertDialog.Builder(activity).SetTitle("Confirm")
                    .SetMessage("Are you sure you want to delete this post")
                    .SetPositiveButton("Delete", (sender2, e2) =>
                    {
                        activity.ShowProgressDialog();
                        var apiTask = new ServiceApi().DeletePost(item.Id);
                        apiTask.HandleError(activity);
                        apiTask.OnSucess(activity, response =>
                        {
                            GetNewsFeedItems(true);
                        });
                    })
                    .SetNegativeButton("Cancel", (sender3, e3) => { })
                    .Show();
                };

                dialog.Show();
            }
        }
示例#25
0
        public void ShowDialog(Context context, int?titleId, ICharSequence message,
                               int okId        = Android.Resource.String.Ok, int cancelId = Android.Resource.String.Cancel,
                               Action okAction = null, Action cancelAction                = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var alertDialog = new AlertDialog.Builder(context).Create();

            alertDialog.SetCancelable(false);

            if (titleId.HasValue)
            {
                alertDialog.SetTitle(titleId.Value);
            }

            alertDialog.SetMessage(message);

            alertDialog.SetButton(context.GetString(okId), (s, e) =>
            {
                okAction?.Invoke();
                alertDialog.Dismiss();
                alertDialog = null;
            });

            alertDialog.SetButton2(context.GetString(cancelId), (s, e) =>
            {
                cancelAction?.Invoke();
                alertDialog.Dismiss();
                alertDialog = null;
            });

            alertDialog.Show();
        }
        protected virtual void OnDateTimeViewClick()
        {
            var dialogView = this.BindingInflate(Resource.Layout.app_basket_full_order_item_deliveryTime_dialog, null);

            var headerSubtitle = dialogView.FindViewById <TextView>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_headerLayout_subtitle);
            var headerTitle    = dialogView.FindViewById <TextView>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_headerLayout_title);

            var dateListView = dialogView.FindViewById <ARNumberPicker>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_bodyLayout_listViewLeft);

            dateListView.WrapSelectorWheel      = false;
            dateListView.DescendantFocusability = Android.Views.DescendantFocusability.BlockDescendants;

            var timeListView = dialogView.FindViewById <ARNumberPicker>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_bodyLayout_listViewRight);

            timeListView.WrapSelectorWheel      = false;
            timeListView.DescendantFocusability = Android.Views.DescendantFocusability.BlockDescendants;

            var positiveButton = dialogView.FindViewById <Button>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_positiveButton);
            var negativeButton = dialogView.FindViewById <Button>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_negativeButton);

            var set = this.CreateBindingSet <FullOrderFragment, IFullOrderViewModel>();

            set.Bind(headerSubtitle).To(vm => vm.DeliveryViewModel.SelectedDeliveryTime.Name);
            set.Bind(headerTitle).To(vm => vm.DeliveryViewModel.SelectedDeliveryDay.Name);

            set.Bind(dateListView).For("SelectedItem").To(vm => vm.DeliveryViewModel.SelectedDeliveryDay);
            set.Bind(dateListView).For(v => v.ItemsSource).To(vm => vm.DeliveryViewModel.DaysItems);

            set.Bind(timeListView).For("SelectedItem").To(vm => vm.DeliveryViewModel.SelectedDeliveryTime);
            set.Bind(timeListView).For(v => v.ItemsSource).To(vm => vm.DeliveryViewModel.TimeItems);

            set.Apply();

            var dialog = new AlertDialog.Builder(Context)
                         .SetCancelable(true)
                         .SetView(dialogView)
                         .Show();

            positiveButton.Text   = LocalizationService.GetLocalizableString(BasketConstants.RESX_NAME, "Order_TimeDone");
            positiveButton.Click += (s, args) =>
            {
                ViewModel.DeliveryViewModel.ApplyDeliveryTimeCommand.Execute(timeListView.SelectedItem);
                dialog.Dismiss();
            };

            negativeButton.Text   = LocalizationService.GetLocalizableString(BasketConstants.RESX_NAME, "Order_TimeCancel");
            negativeButton.Click += (s, args) => dialog.Cancel();
        }
示例#27
0
        void showPackageCountDialog(int count)
        {
            //Inflate layout
            View        view    = LayoutInflater.Inflate(Resource.Layout.DialogLayout, null);
            AlertDialog builder = new AlertDialog.Builder(this).Create();

            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(false);

            Button button = view.FindViewById <Button>(Resource.Id.btnOK);

            // Assign Package Count
            EditText txtPackageCount = view.FindViewById <EditText>(Resource.Id.txtPackageCount);

            txtPackageCount.Text = Convert.ToString(count);

            button.Click += delegate
            {
                txtPackageCount = view.FindViewById <EditText>(Resource.Id.txtPackageCount);

                var tempTxtPackageCount = txtPackageCount.Text;

                tempTxtPackageCount = tempTxtPackageCount.Trim();

                if (String.IsNullOrEmpty(tempTxtPackageCount))
                {
                    return;
                }

                selectedPackageCount = Convert.ToInt16(txtPackageCount.Text);

                if (selectedPackageCount <= 0)
                {
                    RemoveItemFromList();
                }
                else
                {
                    UpdateItemFromList(selectedPackageCount);
                }

                executeOnce = false;
                builder.Dismiss();

                //Toast.MakeText(this, "Alert dialog dismissed!", ToastLength.Short).Show();
            };
            builder.Show();
        }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            mySchools = true;
            mySports  = true;
            myTeams   = true;

            GetData();

            btnFilter.Click += (sender, args) =>
            {
                View v      = Activity.LayoutInflater.Inflate(Resource.Layout.FollowFilterLayout, null);
                var  dialog = new AlertDialog.Builder(Activity).SetView(v).Create();

                v.FindViewById <ImageView>(Resource.Id.imgTeams).SetImageResource(myTeams ? Resource.Drawable.CheckYES : Resource.Drawable.CheckNO);
                v.FindViewById <ImageView>(Resource.Id.imgSchools).SetImageResource(mySchools ? Resource.Drawable.CheckYES : Resource.Drawable.CheckNO);
                v.FindViewById <ImageView>(Resource.Id.imgSports).SetImageResource(mySports ? Resource.Drawable.CheckYES : Resource.Drawable.CheckNO);

                v.FindViewById <ImageView>(Resource.Id.imgTeams).Click += (o, eventArgs) =>
                {
                    myTeams = !myTeams;
                    v.FindViewById <ImageView>(Resource.Id.imgTeams).SetImageResource(myTeams ? Resource.Drawable.CheckYES : Resource.Drawable.CheckNO);
                };

                v.FindViewById <ImageView>(Resource.Id.imgSchools).Click += (o, eventArgs) =>
                {
                    mySchools = !mySchools;
                    v.FindViewById <ImageView>(Resource.Id.imgSchools).SetImageResource(mySchools ? Resource.Drawable.CheckYES : Resource.Drawable.CheckNO);
                };

                v.FindViewById <ImageView>(Resource.Id.imgSports).Click += (o, eventArgs) =>
                {
                    mySports = !mySports;
                    v.FindViewById <ImageView>(Resource.Id.imgSports).SetImageResource(mySports ? Resource.Drawable.CheckYES : Resource.Drawable.CheckNO);
                };
                v.FindViewById <Button>(Resource.Id.btnFilter).Click += (o, eventArgs) =>
                {
                    dialog.Dismiss();
                };
                dialog.DismissEvent += (o, eventArgs) =>
                {
                    GetData();
                };
                dialog.Show();
            };

            slRefresh.Refresh += (sender, e) => GetData();
        }
示例#29
0
        public static void ShowSuccessWithStatus(Context context, string message, int timeoutMs)
        {
            CoreUtility.ExecuteMethod("ShowSuccessWithStatus", delegate()
            {
                AlertDialog dialog = new AlertDialog.Builder(context)
                                     .SetCancelable(false)
                                     .SetIcon(Resource.Drawable.abc_ic_commit_search_api_mtrl_alpha)
                                     .SetMessage(message)
                                     .Create();

                HUD.Dismiss();

                dialog.Show();
                Task.Delay(timeoutMs).ContinueWith(delegate(Task arg)
                {
                    dialog.Dismiss();
                });
            });
        }
示例#30
0
        public static void Create(BaseAniDroidActivity context, Action <NyaaSiSearchRequest> searchAction, NyaaSiSearchRequest previousSearchRequest = null)
        {
            var dialogue = context.LayoutInflater.Inflate(Resource.Layout.Dialog_TorrentSearch, null);
            var searchCategorySpinner = dialogue.FindViewById <Spinner>(Resource.Id.TorrentSearch_CategorySpinner);
            var searchFilterSpinner   = dialogue.FindViewById <Spinner>(Resource.Id.TorrentSearch_FilterSpinner);
            var searchTerm            = dialogue.FindViewById <EditText>(Resource.Id.TorrentSearch_SearchText);

            searchCategorySpinner.Adapter = new ArrayAdapter <string>(context, Resource.Layout.View_SpinnerDropDownItem, NyaaSiConstants.TorrentCategoryTuples.Select(x => x.Value).ToList());
            searchFilterSpinner.Adapter   = new ArrayAdapter <string>(context, Resource.Layout.View_SpinnerDropDownItem, NyaaSiConstants.TorrentFilterTuples.Select(x => x.Value).ToList());

            if (previousSearchRequest != null)
            {
                searchTerm.Text = previousSearchRequest.SearchTerm;
                searchCategorySpinner.SetSelection(
                    NyaaSiConstants.TorrentCategoryTuples.FindIndex(x => x.Key == previousSearchRequest.Category));
                searchFilterSpinner.SetSelection(
                    NyaaSiConstants.TorrentFilterTuples.FindIndex(x => x.Key == previousSearchRequest.Filter));
            }

            var a = new AlertDialog.Builder(context, context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create();

            a.SetView(dialogue);
            a.SetTitle("Search Torrents");
            a.SetButton((int)DialogButtonType.Positive, "Search", async(aS, ev) =>
            {
                var category = NyaaSiConstants.TorrentCategoryTuples[searchCategorySpinner.SelectedItemPosition].Key;
                var filter   = NyaaSiConstants.TorrentFilterTuples[searchFilterSpinner.SelectedItemPosition].Key;
                var term     = searchTerm.Text;

                var request = new NyaaSiSearchRequest {
                    Category = category, Filter = filter, SearchTerm = term
                };
                searchAction?.Invoke(request);
            });
            a.SetButton((int)DialogButtonType.Neutral, "Cancel", (aS, eV) =>
            {
                a.Dismiss();
            });
            a.Show();
        }