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(); }
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(); }
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(); }
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); }
private void ItemDetail(int position) { View view = contex.LayoutInflater.Inflate(Resource.Layout.layout_dialog, null); AlertDialog builder = new AlertDialog.Builder(contex).Create(); builder.SetTitle("Book Detail"); builder.SetView(view); builder.SetCanceledOnTouchOutside(false); builder.SetButton("Buy", handllerNotingButton); builder.SetButton2("Cancel", handllerNotingButtonCancel); ImageView imageView = view.FindViewById <ImageView>(Resource.Id.imgDetailBook); TextView titleBookDetail = view.FindViewById <TextView>(Resource.Id.titleBookDetail); TextView subtitleDetailBook = view.FindViewById <TextView>(Resource.Id.subtitleDetailBook); TextView isbn13DetailBook = view.FindViewById <TextView>(Resource.Id.isbn13DetailBook); TextView priceDetailBook = view.FindViewById <TextView>(Resource.Id.priceDetailBook); Glide.With(contex).Load(listBook[position].image).Apply(RequestOptions.CenterCropTransform()).Into(imageView); titleBookDetail.Text = listBook[position].title; subtitleDetailBook.Text = listBook[position].subtitle; isbn13DetailBook.Text = listBook[position].isbn13; priceDetailBook.Text = listBook[position].price; positionGlobal = position; builder.Show(); }
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); } }
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(); }
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(); }
private AlertDialog CreateView(int resourceId) { var cardView = LayoutInflater.Inflate(resourceId, null); var builder = new AlertDialog.Builder(this).Create(); builder.SetView(cardView); builder.SetCanceledOnTouchOutside(false); builder.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent)); builder.Window.RequestFeature(WindowFeatures.NoTitle); builder.Show(); return(builder); }
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); } }
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(); }
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(); }
private void CheckUpdate() { var ad = new AlertDialog.Builder(this).Create(); try { var webClient = new WebClient(); var url = new System.Uri(string.Format(@"{0}{1}", GlobalSetting.Instance.MOBILEEndpoint.ToString(), @"/com.gwise.voidbarcode.apk")); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback); webClient.DownloadFileAsync(url, Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads) + "/com.gwise.voidbarcode.apk"); webClient.DownloadFileCompleted += (s, e) => { if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.N) { Intent intent = new Intent(Intent.ActionInstallPackage); intent.SetDataAndType(FileProvider.GetUriForFile(this.ApplicationContext, "com.gwise.voidbarcode.fileprovider", new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads) + "/com.gwise.voidbarcode.apk")), "application/vnd.android.package-archive"); //intent.SetData(FileProvider.GetUriForFile(this.ApplicationContext, "com.gwise.voidbarcode.fileprovider", new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads) + "/com.gwise.voidbarcode.apk"))); intent.AddFlags(ActivityFlags.GrantReadUriPermission | ActivityFlags.NewTask); StartActivity(intent); } else { Intent intent = new Intent(Intent.ActionView); intent.SetDataAndType(Android.Net.Uri.FromFile(new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads) + "/com.gwise.voidbarcode.apk")), "application/vnd.android.package-archive"); intent.AddFlags(ActivityFlags.NewTask); // ActivityFlags.NewTask 이 옵션을 지정해 주어야 업데이트 완료 후에 [열기]라는 화면이 나온다. StartActivity(intent); } OnUpdateCompleted?.Invoke(); this.Finish(); }; } catch (System.Exception ex) { ad = new AlertDialog.Builder(this).Create(); ad.SetTitle("INFO"); ad.SetMessage(ex.Message); ad.SetCanceledOnTouchOutside(true); ad.Show(); } finally { } }
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(); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Android.Content.Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfc, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfc>() as NfcForms; if (NFCdevice == null) { var alert = new AlertDialog.Builder(this).Create(); alert.SetMessage("NFC is not supported on this device."); alert.SetTitle("NFC Unavailable"); alert.SetButton("exit", CancelButtonOnClick); alert.SetCanceledOnTouchOutside(false); alert.Show(); } else { if (!NFCdevice.IsEnabled) { var alert = new AlertDialog.Builder(this).Create(); alert.SetMessage("NFC is currently off."); alert.SetTitle("Please enable NFC to use this app."); alert.Show(); } } telephonyManager = (TelephonyManager)GetSystemService(TelephonyService); IMEINumber = telephonyManager.Imei; Settings.IMEI = IMEINumber; LoadApplication(new App()); }
public void OpenLocationSettings() { LocationManager LM = (LocationManager)Forms.Context.GetSystemService(Android.Content.Context.LocationService); if (LM.IsProviderEnabled(LocationManager.GpsProvider) == false) { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetMessage("Please open location"); ad.SetCancelable(false); ad.SetCanceledOnTouchOutside(false); ad.SetButton("ok", delegate { Android.Content.Context ctx = Forms.Context; ctx.StartActivity(new Intent(Android.Provider.Settings.ActionLocationSourceSettings)); }); ad.SetButton2("cancle", delegate { }); ad.Show(); } }
/// <summary> /// This will Shows the modal popup. /// Make sure that passed View and it's all child control must be set either width or height, /// Otherwise that control not display in popup. /// </summary> /// <param name="view">View, this will be shown in popup. make sure view and it's all child control has either width or height property set.</param> public void ShowModalPopup(Xamarin.Forms.View view) { HideModalPopup(); lock (Locker) { var bound = MainActivity.ScreenSize; StackLayout containerLayout = new StackLayout() { Padding = 0, BackgroundColor = Color.Transparent, IsClippedToBounds = true, HeightRequest = bound.Height, InputTransparent = true, WidthRequest = bound.Width, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Children = { view } }; var nativeView = ConvertFormsToNative(containerLayout, new Rectangle(0, 0, bound.Width, bound.Height)); _modalAlertDialog = new AlertDialog.Builder(Xamarin.Forms.Forms.Context).Create(); _modalAlertDialog.SetView(nativeView); _modalAlertDialog.SetCanceledOnTouchOutside(false); Device.BeginInvokeOnMainThread(() => { _modalAlertDialog.Show(); ColorDrawable transparentColor = new ColorDrawable(Android.Graphics.Color.Transparent); _modalAlertDialog.Window.SetBackgroundDrawable(transparentColor); }); } }
void showCompleteDialog() { //Inflate layout View view = LayoutInflater.Inflate(Resource.Layout.ReceiveOKDialog, null); AlertDialog builder = new AlertDialog.Builder(this).Create(); builder.SetView(view); builder.SetCanceledOnTouchOutside(false); Button buttonYesAction = view.FindViewById <Button>(Resource.Id.btnYes); Button buttonNoAction = view.FindViewById <Button>(Resource.Id.btnNo); buttonYesAction.Click += delegate { try { //send packages foreach (var item in tableItems) { ModelOrder modelOrder = new ModelOrder { Agent = SELECTED_AGENT, AgentStr = SELECTED_AGENTSTR, OrderNumber = item.Heading, PackageQty = item.PackageQty, ReceivedTS = DateTime.UtcNow, Status = (int)StatusTypeEnums.RECEIVED }; ReceivePackageModel model = new ReceivePackageModel { ModelOrder = modelOrder, UpdateTS = false }; if (GetConnectionStatus()) { var result = _transactionService.ReceivePackage(model); if (!result) { // TBD: If api fails to process a package AddToLocalReceiveTable(model); continue; } } else { // save to local db AddToLocalReceiveTable(model); } } UserSession.SendingAllPendingTransactions(); // clear all info ClearScreen(); // Reset ListView InitializeListView(); // Display Dialog Android.Widget.Toast.MakeText(this, "Transaction Completed!", Android.Widget.ToastLength.Short).Show(); builder.Dismiss(); Finish(); } catch { Android.Widget.Toast.MakeText(this, "Error : Cannot Process Transaction!", Android.Widget.ToastLength.Short).Show(); } }; buttonNoAction.Click += delegate { builder.Dismiss(); }; builder.Show(); }