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(); }
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(); }
protected void DeleteItem(object sender, EventArgs eventArgs) { AlertDialog dlg = new AlertDialog.Builder(Activity).Create(); dlg.SetTitle("Delete?"); dlg.SetMessage("Are you sure you wish to delete?"); dlg.SetButton(-1, "Yes", this); dlg.SetButton(-2, "No", this); dlg.Show(); }
private void ShowMessage(string title, string message, string[] buttonTitles, Action<int> callBack) { try { //var d1 = new AlertDialog.Builder(Forms.Context); //d1.SetPositiveButton("One", (sender, e) => { }); //d1.SetNeutralButton("Two", (sender, e) => { }); //d1.SetNegativeButton("Three", (sender, e) => { }); //d1.Create().Show(); var d = new AlertDialog.Builder(Forms.Context).Create(); d.SetTitle(title); d.SetMessage(message); if (buttonTitles.Length > 2) { d.SetButton(buttonTitles[0], (e, a) => { callBack?.Invoke(0); }); d.SetButton2(buttonTitles[1], (e, a) => { callBack?.Invoke(1); }); d.SetButton3(buttonTitles[2], (e, a) => { callBack?.Invoke(2); }); } else { d.SetButton(buttonTitles[0], (e, a) => { callBack?.Invoke(0); }); d.SetButton2(buttonTitles[1], (e, a) => { callBack?.Invoke(1); }); } d.Show(); } catch (System.Exception ex) { #if DEBUG Console.WriteLine(ex.Message); #endif } }
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(); }
public override async ValueTask <bool> Confirm(string title, string message, string ok, string cancel) { var result = new TaskCompletionSource <bool>(); var alert = new AlertDialog.Builder(activity).Create(); alert.SetTitle(title); alert.SetMessage(message); alert.SetButton((int)DialogButtonType.Positive, ok, (_, _) => result.TrySetResult(true)); alert.SetButton((int)DialogButtonType.Negative, cancel, (_, _) => result.TrySetResult(false)); alert.SetCancelable(false); alert.Show(); return(await result.Task); }
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; } }
private async void StartNewActivity(Type activity, DeviceType deviceType) { string text = await ScanQrCode(); if (string.IsNullOrEmpty(text)) { return; } var bleDevicesRecords = await SqlHelper <BluetoothDeviceRecords> .CreateAsync(); var list = await bleDevicesRecords.QueryValuations("SELECT * FROM BluetoothDeviceRecords"); if (list.Where(d => d.DeviceType == deviceType).Count() > 0) { var intent = new Intent(Activity, activity); intent.PutExtra("Data", text); Activity.StartActivity(intent); } else { using AlertDialog alertDialog = new AlertDialog.Builder(Activity, Resource.Style.AppTheme_Dialog).Create(); alertDialog.SetTitle("Avertisment"); alertDialog.SetMessage("Nu aveti niciun dispozitiv inregistrat!"); alertDialog.SetButton("OK", delegate { Activity.StartActivity(typeof(DevicesManagementActivity)); }); alertDialog.Show(); } }
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(); }
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 void ShowFirstMessageAsync() { EditText cap = new EditText(this); AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetTitle("Configurando"); alert.SetMessage("Ingrese la capacidad en mah de su bateria, si ingresa un numero inferior a 100 se cerrara la aplicacion"); alert.SetView(cap); alert.SetButton("Continuar", (a, b) => { bool verify; try { verify = Convert.ToInt32(cap.Text) > 100 ? true : false; } catch { verify = false; } if (!verify) { System.Environment.Exit(0); } else { FindViewById <TextView>(Resource.Id.capacity).Text = cap.Text; ShowInstructions(); } }); alert.Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreateDialog(savedInstanceState); Log.Debug(TAG, "OnCreateDialog()"); Bundle bundle = Arguments; if (bundle == null) { return(null); } String message = bundle.GetString(ARG_MESSAGE); String title = bundle.GetString(ARG_TITLE); int icon = bundle.GetInt(ARG_ICON); AlertDialog dlg = new AlertDialog.Builder(Activity).SetMessage(message).SetTitle(title).SetCancelable(false).Create(); if (icon != 0) { dlg.SetIcon(icon); } dlg.SetButton("OK", (sender1, e1) => { Log.Debug(TAG, "ClickButtonEvent()"); Dismiss(); if (_callback != null) { _callback.OnDialogClosed(); } }); return(dlg); }
//string pathFoto =""; private void BtnSiguiente_Click(object sender, EventArgs e) { try { //ValidarCamposObligatorios(); string stIdUsuario = Intent.GetStringExtra("idUsuario"); string stNomCompleto = Intent.GetStringExtra("NombreCompleto"); string stEmail = Intent.GetStringExtra("email"); string stNomusuario = Intent.GetStringExtra("usuarioNombre"); string stidRol = Intent.GetStringExtra("idRol"); string valorObser = txtObser.Text; Intent secondActivityConfNuevoRecl = new Intent(this, typeof(ActivityConfNuevoReclamo)); secondActivityConfNuevoRecl.PutExtra("AreaServicioID", stIDAreaServicio); secondActivityConfNuevoRecl.PutExtra("TipoReclamoID", stIDTipoReclamo); secondActivityConfNuevoRecl.PutExtra("TipoReclamoNombre", stNombreTipoReclamo); secondActivityConfNuevoRecl.PutExtra("AreaServicioNombre", stNombreAreaServicio); secondActivityConfNuevoRecl.PutExtra("idCalle", idCalle); secondActivityConfNuevoRecl.PutExtra("idBarrio", stIdBarrio); secondActivityConfNuevoRecl.PutExtra("nombreBarrio", stBarrioNombre); secondActivityConfNuevoRecl.PutExtra("nombreCalle", stCalleNombre); //secondActivityConfNuevoRecl.PutExtra("obser", txtObser.Text); secondActivityConfNuevoRecl.PutExtra("altura", edtNro.Text); secondActivityConfNuevoRecl.PutExtra("foto", bitmap); secondActivityConfNuevoRecl.PutExtra("observaciones", valorObser); secondActivityConfNuevoRecl.PutExtra("idUsuario", stIdUsuario); secondActivityConfNuevoRecl.PutExtra("idLatitud", stLatitud); secondActivityConfNuevoRecl.PutExtra("idLongitud", stLongitud); secondActivityConfNuevoRecl.PutExtra("NombreCompleto", stNomCompleto); secondActivityConfNuevoRecl.PutExtra("email", stEmail); secondActivityConfNuevoRecl.PutExtra("usuarioNombre", stNomusuario); secondActivityConfNuevoRecl.PutExtra("idRol", stidRol); if (stIDAreaServicio != "-1" && stIdBarrio != "-1" && edtNro.Text != "" && stIDTipoReclamo != "-2" && idCalle != "-2") { StartActivity(secondActivityConfNuevoRecl); //Finish(); } else { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetTitle("Error al ingreso"); ad.SetIcon(Resource.Drawable.cancel); ad.SetMessage("Por favor verifique si se ingresaron los datos minimos y requeridos."); ad.SetButton("Ok", (g, h) => { }); ad.Show(); //ValidarCamposObligatorios(); } } catch { Toast.MakeText(ApplicationContext, "Error en datos de ingreso", ToastLength.Long).Show(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View view = inflater.Inflate(Resource.Layout.Config, container, false);// asi se define que layout ocupa try { SidUs = Arguments.GetString("idUs"); idUS = Convert.ToInt32(SidUs); } catch (Exception ex) { AlertDialog alerta = new AlertDialog.Builder(Context).Create(); alerta.SetTitle("Error "); alerta.SetMessage(ex.Message + "'asdasd'"); alerta.SetButton("Aceptar", (a, b) => { }); alerta.Show(); } var btnConfig = view.FindViewById <Button>(Resource.Id.btnConfigUsuario); var btncerrar = view.FindViewById <Button>(Resource.Id.btnCerrarSesion); btncerrar.Click += Btncerrar_Click; btnConfig.Click += BtnConfig_Click; return(view); }
public static void SetupHint(Activity context, string message) { context.RunOnUiThread(() => { AlertDialog hintDialog = new AlertDialog.Builder(context).Create(); hintDialog.SetTitle("Hint"); TextView tv = new TextView(context); SpannableString s; EventHandler ev; var lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); lp.SetMargins(20, 20, 20, 20); tv.SetTextAppearance(Android.Resource.Style.TextAppearanceMaterialMedium); tv.MovementMethod = LinkMovementMethod.Instance; tv.SetPadding(50, 10, 50, 10); //Linkify.AddLinks(message, MatchOptions.WebUrls); tv.SetText(Html.FromHtml((string)message, FromHtmlOptions.ModeLegacy), TextView.BufferType.Spannable); tv.LayoutParameters = lp; hintDialog.SetView(tv); hintDialog.SetButton("OK", delegate { return; }); hintDialog.Show(); }); }
private void ButtonClickEvent(int numerek) { if (isMyTurn) { if (canvas[numerek] != '-') { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetCancelable(false); // This blocks the 'BACK' button ad.SetMessage("Te pole jest ju¿ zajête!"); ad.SetButton("OK", delegate { }); ad.Show(); return; } canvas[numerek] = mySign; byte[] buffbuff = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Turn), new string(canvas))); pole[numerek].Text = Char.ToString(mySign); Sockets.client.GetStream().Write(buffbuff, 0, buffbuff.Length); isMyTurn = false; } else { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetCancelable(false); // This blocks the 'BACK' button ad.SetMessage("Poczekaj na swoj¹ kolej!"); ad.SetButton("OK", delegate {}); ad.Show(); } }
public override void OnBackPressed() { AlertDialog CancelDialog = new AlertDialog.Builder(this).Create(); CancelDialog.SetTitle("Are you sure you want to quit"); CancelDialog.SetButton("return", (s, ev) => { CancelDialog.Cancel(); } ); CancelDialog.SetButton2("main menu", (s, ev) => { Finish(); } ); if (CancelDialog != null) { if (CancelDialog.IsShowing) { CancelDialog.Cancel(); } else { CancelDialog.Show(); } } else { CancelDialog.Show(); } }
public static void ShowDialog(string title, string msg) { #if UNITY_ANDROID var activity = Internal.GetCurrentActivity(); AlertDialog alertDialog = new AlertDialog.Builder(activity).Create(); alertDialog.SetTitle(title); alertDialog.SetMessage(msg); alertDialog.SetButton(Dialog.BUTTON_NEGATIVE, "No", new DialogOnClickListener(which => { Debug.LogWarning("btn clicked: " + which); })); alertDialog.SetButton(Dialog.BUTTON_POSITIVE, "Yes", new DialogOnClickListener(which => { Debug.LogWarning("btn clicked: " + which); })); alertDialog.Show(); #endif }
/// <summary> /// 消息框 /// </summary> public static void ShowMessage(String message, Activity activity, bool create) { try { if (dlg != null) { dlg.Dismiss(); //新消息接收到后,消除上一次消息 } if (!create) { return; } AlertDialog dialog = new AlertDialog.Builder(activity).Create(); dlg = dialog; dialog.SetCancelable(false); // This blocks the ‘BACK‘ button dialog.SetMessage(message); dialog.SetButton("OK", new EventHandler <DialogClickEventArgs>((obj, args) => { dialog.Dismiss(); })); dialog.Show(); } catch (Exception ex) { throw; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); //h Init(); // Checking if bluetooth is supported if (m_BtAdapter == null) { Toast.MakeText(ApplicationContext, "Bluetooth is not supported", 0).Show(); m_BtSearchDevices.Enabled = false; m_BtSearchDevices.SetTextColor(Android.Graphics.Color.LightGray); m_BtPairedDevices.Enabled = false; m_BtPairedDevices.SetTextColor(Android.Graphics.Color.LightGray); // Displaying an alert to inform the user that bluetooth is not supported AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetTitle("Bluetooth not supported"); alert.SetMessage("Bluetooth is not supported!"); alert.SetButton("Ok", (s, ev) => { Finish(); }); alert.Show(); } else { // Checking if bluetooth is enabled if (!m_BtAdapter.IsEnabled) { TurnBTOn(); } } }
/// <summary> /// Identify to Android that this activity wants to be notified when /// an NFC tag is discovered. /// </summary> private void EnableReadMode() { _inReadMode = true; // Create an intent filter for when an NFC tag is discovered. When // the NFC tag is discovered, Android will u var tagDetected = new IntentFilter(NfcAdapter.ActionTagDiscovered); var filters = new[] { tagDetected }; // When an NFC tag is detected, Android will use the PendingIntent to come back to this activity. // The OnNewIntent method will invoked by Android. var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop); var pendingIntent = PendingIntent.GetActivity(this, 0, intent, 0); if (_nfcAdapter == null) { var alert = new AlertDialog.Builder(this).Create(); alert.SetMessage("NFC is not supported on this device."); alert.SetTitle("NFC Unavailable"); alert.SetButton("OK", delegate { _writeTagButton.Enabled = false; _textView.Text = "NFC is not supported on this device."; }); alert.Show(); } else { _nfcAdapter.EnableForegroundDispatch(this, pendingIntent, filters, null); } }
private Task <bool> IsPlayServicesAvailable() { TaskCompletionSource <bool> taskCompletitionSource = new TaskCompletionSource <bool>(); var resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this); if (resultCode == ConnectionResult.Success) { taskCompletitionSource.TrySetResult(true); return(taskCompletitionSource.Task); } var alertDialog = new AlertDialog.Builder(this).Create(); alertDialog.SetTitle("Google Play Services"); alertDialog.SetButton("Ok", (e, o) => { Finish(); taskCompletitionSource.TrySetResult(false); }); alertDialog.SetMessage(GoogleApiAvailability.Instance.IsUserResolvableError(resultCode) ? GoogleApiAvailability.Instance.GetErrorString(resultCode) : "This device is not supported"); alertDialog.Show(); return(taskCompletitionSource.Task); }
/// <summary> /// Entry point for application. /// </summary> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Init(); // Check if bluetooth is supported if (mBtAdapter == null) { Toast.MakeText(ApplicationContext, "Bluetooth is not supported", 0).Show(); // Display an alert to inform the user that bluetooth is not supported AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetTitle("Bluetooth not supported"); alert.SetMessage("Bluetooth is not supported!"); alert.SetButton("Ok", (s, ev) => { Finish(); }); alert.Show(); } else { // Check if bluetooth is enabled if (!mBtAdapter.IsEnabled) { TurnBTOn(); } } //CreateApplicationFolder(); }
void OnPromptRequested(Page sender, PromptArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } AlertDialog alertDialog = new AlertDialog.Builder(Activity).Create(); alertDialog.SetTitle(arguments.Title); alertDialog.SetMessage(arguments.Message); var frameLayout = new FrameLayout(Activity); var editText = new EditText(Activity) { Hint = arguments.Placeholder }; var layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { LeftMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density), RightMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density) }; editText.LayoutParameters = layoutParams; editText.InputType = arguments.Keyboard.ToInputType(); if (arguments.Keyboard == Keyboard.Numeric) { editText.KeyListener = LocalizedDigitsKeyListener.Create(editText.InputType); } if (arguments.MaxLength > -1) { editText.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(arguments.MaxLength) }); } frameLayout.AddView(editText); alertDialog.SetView(frameLayout); alertDialog.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(editText.Text)); alertDialog.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(null)); alertDialog.CancelEvent += (o, args) => { arguments.SetResult(null); }; alertDialog.Window.SetSoftInputMode(SoftInput.StateVisible); alertDialog.Show(); editText.RequestFocus(); }
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()); }
private void DisplayLogoutDialog() { var alert = new AlertDialog.Builder(this, GetThemedResourceId(Resource.Attribute.Dialog_Theme)) .SetMessage(Resource.String.LoginLogout_LogoutDialogMessage) .SetCancelable(true).Create(); alert.SetButton((int)DialogButtonType.Neutral, "Cancel", (sender, eventArgs) => alert.Dismiss()); alert.SetButton((int)DialogButtonType.Positive, "Logout", (sender, eventArgs) => { Settings.ClearUserAuthentication(); var resultIntent = new Intent(); resultIntent.PutExtra(MainActivity.RecreateActivityIntentKey, true); SetResult(Result.Canceled, resultIntent); Finish(); }); alert.Show(); }
public static void DialogoRetorno(Context context, string msg) { AlertDialog alertDialog = new AlertDialog.Builder(context).Create(); alertDialog.SetTitle("Retorno"); alertDialog.SetMessage(msg); alertDialog.SetButton("OK", (sender, e) => { }); alertDialog.Show(); }
public static void ShowMessageDialog(Activity context, string title, string text) { var alert = new AlertDialog.Builder(context).Create(); alert.SetTitle(title); alert.SetMessage(text); alert.SetButton("Ok", (sender, ev) => { }); alert.Show(); }
private void ShowValidationError(string message) { var alert = new AlertDialog.Builder(this).Create(); alert.SetButton(GetString(Resource.String.Close), (sender, e) => alert.Cancel()); alert.SetMessage(message); alert.Show(); }
public void Show(string message) { AlertDialog alert = new AlertDialog.Builder(_appContext).Create(); alert.SetTitle("Resultado de la verificación"); alert.SetIcon(Resource.Drawable.Icon); alert.SetMessage(message); alert.SetButton("OK", (sender, e) => { }); alert.Show(); }