/** * Dialog menu displaying the virtual objects we can place in the real world. */ public void showPopup() { var builder = new AlertDialog.Builder(this); var itemsList = new[] { "Coffee mug", "Flowers", "Smile Emoji" }; builder.SetTitle("Choose an object") .SetItems(itemsList, (s, e) => { switch (e.Which) { case 0: placeObject("file:///android_asset/object_coffee_mug.vrx"); break; case 1: placeObject("file:///android_asset/object_flowers.vrx"); break; case 2: placeObject("file:///android_asset/emoji_smile.vrx"); break; } }); Dialog d = builder.Create(); d.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); InicializarComponentesInterfaz(); dialog = new AlertDialog.Builder(this); adaptador = new AdaptadorPersonalizado(ArchivosData.Archivos); listaArchivosSeleccionados.Adapter = adaptador; try { if (Intent.Action == Intent.ActionSend) { adaptador.LimpiarLista(); var rutaArchivo = ObtenerRutaArchivo((Android.Net.Uri)Intent.Extras.GetParcelable(Intent.ExtraStream)); AgregarArchivoALista(rutaArchivo); } else if (Intent.Action == Intent.ActionSendMultiple) { adaptador.LimpiarLista(); for (int i = 0; i < Intent.ClipData.ItemCount; i++) { var rutaArchivo = ObtenerRutaArchivo(Intent.ClipData.GetItemAt(i).Uri); AgregarArchivoALista(rutaArchivo); } } } catch (Exception e) { Log.Debug(tag, e.GetType() + "|||" + e.Message + "|||" + e.Source); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.search_layout); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayShowTitleEnabled(false); try { var ingridients = Intent.GetStringArrayListExtra("Ingridients"); StartSearch(GetSearchUrl(ingridients)); } catch (Exception) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Connetction Error"); alert.SetMessage("Check your conection"); alert.SetPositiveButton("OK", HandlePositiveButtonClick); alert.SetCancelable(false); alert.Show(); } }
private void NewListAlertMethod(object sender, System.EventArgs e) { AlertDialog.Builder newListAlert = new AlertDialog.Builder(this); newListAlert.SetTitle("New List"); newListAlert.SetMessage("Please enter the name of your new list"); EditText input = new EditText(this) { TextSize = 22, Gravity = GravityFlags.Center, Hint = "List Name", }; input.SetSingleLine(true); newListAlert.SetView(input); newListAlert.SetPositiveButton("OK", (senderAlert, arg) => { NewListSave(input.Text); }); newListAlert.SetNegativeButton("Cancel", (senderAlert, arg) => { }); Dialog dialog = newListAlert.Create(); dialog.Show(); }
public override bool OnOptionsItemSelected(IMenuItem item) { // Si selecciona icon exit if (item.ItemId == Resource.Id.exit) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Salir"); alert.SetMessage("¿Estás seguro?"); alert.SetIcon(Resource.Drawable.logo); alert.SetButton("Si", (c, ev) => { this.FinishAffinity(); Finish(); Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); GC.Collect(); }); alert.SetButton2("no", (c, ev) => { }); alert.Show(); } return(base.OnOptionsItemSelected(item)); }
private void MMultipleDelete_Click(object sender, EventArgs e) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle("Are you sure?"); alertDialog.SetMessage("Do you want to delete this item?"); alertDialog.SetPositiveButton("yes", delegate { // throw new NotImplementedException(); List <Product> listaNouaProduse = new List <Product>(); //construim o noua lista de produse listaNouaProduse.AddRange(mProducts); //populez lista noua foreach (Product product in mProductsCD) //luam fiecare produs din lista copiata-> daca produsul respectiv are Id-ul magazinului egal cu ceea ce am selectat in spinner-> in lista noua de produse se adauga produsul { if (product.Checked) //am inclus Checked ca si coloana[Ignore] in clasa Produse { listaNouaProduse.Remove(product); db.deleteProduct(product); mProductsCopy.Remove(product); //ca sa sterg produsele din lista copie de la filtrare Toast.MakeText(this, "The selected products were deleted!", ToastLength.Long).Show(); } } mProducts = listaNouaProduse; //la lista noastra initiala de produse se adauga listaNouaProduse(am sters din ea elemente) mAdapter.mProducts = mProducts; //se actualizeaza adapterul cu lista noua mAdapter.NotifyDataSetChanged(); }); alertDialog.SetNegativeButton("NO", (IDialogInterfaceOnClickListener)null); alertDialog.Create(); alertDialog.Show(); }
private void OnSelectButtonClick(string playlistId) { if (_state.Value != State.Waiting && _state.Value != State.Failed) { return; } AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme); LayoutInflater inflater = (LayoutInflater)GetSystemService(LayoutInflaterService); View popupView = inflater.Inflate(Resource.Layout.popup, null); dialogBuilder.SetView(popupView); AlertDialog dialog = dialogBuilder.Create(); dialog.Show(); popupView.FindViewById <Button>(Resource.Id.shuffle_button).Click += (sender, e) => { dialog.Dismiss(); OnShuffleButtonClick(playlistId, ShuffleMode.Shuffle, popupView); }; popupView.FindViewById <Button>(Resource.Id.restrict_button).Click += (sender, e) => { dialog.Dismiss(); OnShuffleButtonClick(playlistId, ShuffleMode.Restrict, popupView); }; popupView.FindViewById <EditText>(Resource.Id.restrict_value).Text = GetSharedPreferences("SPOTIFY", 0).GetString("RESTRICT_VALUE", "10"); }
private void pruebecita(object sender, EventArgs e) { AlertDialog.Builder ventanaEmergente = new AlertDialog.Builder(this); ventanaEmergente.SetTitle("Ejercicio 1"); ventanaEmergente.SetMessage(_editText1.Text.ToString()); ventanaEmergente.Show(); }
public void ReceiveDetections(Detections detections) { SparseArray qrcodes = detections.DetectedItems; if (qrcodes.Size() != 0) { _txtResult.Post(() => { _txtResult.Text = ((Barcode)qrcodes.ValueAt(0)).RawValue; AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Código de Barras"); alert.SetMessage(((Barcode)qrcodes.ValueAt(0)).RawValue); alert.SetIcon(Resource.Drawable.logo); alert.SetButton("Volver", (c, ev) => { // Para actualizar una actividad desde dentro de sí mismo Finish(); StartActivity(Intent); GC.Collect(); }); alert.Show(); }); } }
// Alert Dialog box-if you want to delete something press Yes - then the product is deleted private void MAdapter_CellClick_ButtonDelete(object sender, Product e) { // throw new NotImplementedException(); this.RunOnUiThread(() => { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle("Are you sure?"); alertDialog.SetMessage("Do you want to delete this item?"); alertDialog.SetPositiveButton("yes", delegate { alertDialog.Dispose(); //e.Position = mAdapter.mProducts.IndexOf(e); db.deleteProduct(e); mAdapter.mProducts.Remove(e); mProductsCopy.Remove(e); mAdapter.NotifyItemRemoved(e.Position); Toast.MakeText(this, " The product " + e.ToString() + " was deleted! ", ToastLength.Long).Show(); }); alertDialog.SetNegativeButton("NO", (IDialogInterfaceOnClickListener)null); alertDialog.Create(); alertDialog.Show(); }); }
void OnGPSTimerElapsed(object sender, ElapsedEventArgs e) { locationManager.RemoveUpdates(this); this.RunOnUiThread(() => progressDialog.Dismiss()); if (gpsTimer != null && gpsTimer.Enabled) { gpsTimer.Stop(); gpsTimer.Close(); } this.RunOnUiThread(() => { AlertDialog alert = new AlertDialog.Builder(this) .SetPositiveButton("OK", (sender1, EventArgs) => { }) .SetMessage("Unable to get GPS location.") .SetTitle("GPS Location") .Show(); int titleDividerId = Resources.GetIdentifier("titleDivider", "id", "android"); View titleDivider = alert.FindViewById(titleDividerId); if (titleDivider != null) { titleDivider.SetBackgroundColor(Resources.GetColor(Resource.Color.material_blue_grey_800)); } }); }
private void LoginBtn_Click(object sender, EventArgs e) { string sTitulo = string.Empty; string sCuerpo = string.Empty; var bValidado = ValidarLogin(); if (bValidado) { sTitulo = "Ingreso exitoso"; sCuerpo = "Bienvenido nuevamente"; } else { sTitulo = "Error en el ingreso"; sCuerpo = "Verifique su contraseña"; } AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle(sTitulo); alert.SetMessage(sCuerpo); Dialog dialog = alert.Create(); dialog.Show(); if (bValidado) { Intent i = new Intent(this, typeof(MainActivity)); i.PutExtra("Usuario", usuariosSpn.SelectedItem.ToString()); StartActivity(i); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.category_dialog, null); Dialog.SetTitle("Выберите категории"); var mainLayout = view.FindViewById <LinearLayout>(Resource.Id.category_dialog_main); _checkBoxList = new List <CheckBox>(); for (var index = 0; index < ServicesCategory.ServicesCategoryList.Count; index++) { var check = ServicesCategory.ServicesCategoryList[index]; var checkbox = new CheckBox(Context) { Text = check, Checked = _firstMasterViewModel.SelectedCategories.Exists(s => s.ToLower().Equals(check.ToLower())), LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) }; _checkBoxList.Add(checkbox); mainLayout.AddView(checkbox); } _closeButton = view.FindViewById <Button>(Resource.Id.category_dialog_closeButton); _closeButton.Click += CloseButtonOnClick; var builder = new AlertDialog.Builder(Activity); builder.SetView(view); _createdDialog = builder.Create(); return(view); // base.OnCreateView(inflater, container, savedInstanceState); }
private void Btnavis(object sender, EventArgs e) { string aviso = "Con fundamento en la Ley Federal de Protección de Datos Personales en Posesión de Particulares hacemos de su conocimiento" + " que GO FOR LIFE MÉXICO / JULIO CESAR MAGALLANES DEL ANGEL con domicilio Calle 3 Manzana 4 Lote 5, Col. Jorge Jiménez Cantú, Estado" + " de México, C.P. 56589, es responsable de recabar sus datos personales, del uso que se le dé a los mismos y de su protección. " + "Sus datos personales incluso los sensibles, patrimoniales o financieros que usted proporcione en el Contrato del Servicio o en " + "cualquier otro documento o medio físico o electrónico, serán utilizados únicamente con motivo de la operación que nos relaciona y " + "se tratarán para todos los fines vinculados con dicha relación, tales como: proveer los servicios que ha solicitado; notificarle" + " sobre nuevos servicios o productos que tengan relación con los ya contratados o adquiridos; comunicarle sobre cambios en los mismos;" + " realizar evaluaciones periódicas de nuestros servicios a efecto de mejorar la calidad de los mismos; evaluar la calidad del servicio" + " que brindamos, y en general, para dar cumplimiento a las obligaciones que hemos contraído con usted. Es importante informarle que " + "usted tiene derecho al Acceso, Rectificación y Cancelación de sus datos personales, a Oponerse al tratamiento de los mismos o a " + "revocar el consentimiento que para dicho fin nos haya otorgado.Para ello, es necesario que envíe la solicitud, en los términos que " + "marca la Ley en su Art. 29, a nuestra Área Administrativa, ubicada en las instalaciones de la Empresa: Paseo de los Volcanes Manzana" + " 66 Lote 474, Col.San Buenaventura, Ixtapaluca, Estado de México, C.P. 56536, o bien, vía correo electrónico a [email protected], el " + "cual solicitamos confirme vía telefónica para garantizar su correcta recepción; El responsable dará respuesta de acuerdo a lo " + "establecido en el Art. 32 aplicándose las restricciones establecidas en el Art. 34. Por otra parte, hacemos de su conocimiento que " + "sus datos seguirán siendo utilizados mientras usted decida seguir con el servicio contratado; con el objetivo general de cumplir con" + " las finalidades para las cuales ha proporcionado sus datos, y de acuerdo a lo establecido en el Art.37.En caso de que no obtengamos" + " su oposición expresa para que sus datos personales sean transferidos en la forma y términos antes descrita, entenderemos que ha " + "otorgado su consentimiento en forma tácita para ello. En caso de que no esté en de acuerdo con el presente aviso de privacidad y de" + " que no desee recibir mensajes de nuestra parte, puede enviarnos su solicitud por medio de la dirección electrónica: info @gflmex.com. " + "El presente aviso así como sus modificaciones estarán a su disposición en la página de internet http://www.goforlifemexico.com"; AlertDialog.Builder av = new AlertDialog.Builder(this); av.SetMessage(aviso); av.SetTitle("AVISO DE PRIVACIDAD "); av.SetPositiveButton("Aceptar", PositiveButton); AlertDialog dialog = av.Create(); dialog.Show(); }
public static AlertDialog.Builder Build(Activity activity, PromptConfig config) { var txt = new EditText(activity) { Hint = config.Placeholder }; if (config.Text != null) { txt.Text = config.Text; } SetInputType(txt, config.InputType); var builder = new AlertDialog .Builder(activity) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title) .SetView(txt) .SetPositiveButton(config.OkText, (s, a) => config.OnResult(new PromptResult(true, txt.Text.Trim())) ); if (config.IsCancellable) { builder.SetNegativeButton(config.CancelText, (s, a) => config.OnResult(new PromptResult(false, txt.Text.Trim())) ); } return(builder); }
protected override void OnListItemClick(ListView l, View v, int position, long id) // checked item click { base.OnListItemClick(l, v, position, id); RunOnUiThread(() => { AlertDialog.Builder builder; builder = new AlertDialog.Builder(this); builder.SetTitle(" Confirm "); builder.SetMessage(" Are you done with this item ?"); builder.SetCancelable(true); builder.SetPositiveButton(" OK ", delegate { //remove item from listview var item = Items[position]; Items.Remove(item); adapter.Remove(item); //reset listview l l.ClearChoices(); l.RequestLayout(); UpdatedStoredData(); }); builder.SetNegativeButton(" Cancel ", delegate { return; }); builder.Show(); //Launches the popup! } ); }
private void ShowLoginDialog() { var alert = new AlertDialog.Builder(this); alert.SetTitle("请登录"); var view = View.Inflate(this, Resource.Layout.login_dialog, null); alert.SetView(view); alert.SetPositiveButton("登录", (EventHandler <DialogClickEventArgs>)null); var dialog = alert.Show(); dialog.GetButton((int)DialogButtonType.Positive).Click += async(sender, args) => { var username = view.FindViewById <EditText>(Resource.Id.et_name).Text; var password = view.FindViewById <EditText>(Resource.Id.et_pwd).Text; var token = await API.Login(username, password); if (token != null) { Toast.MakeText(this, "登录成功!", ToastLength.Short).Show(); refresh(); this.token = token; GetSharedPreferences("config", FileCreationMode.Private) .Edit().PutString("token", token).Apply(); dialog.Dismiss(); } Toast.MakeText(this, "登录失败!", ToastLength.Short).Show(); }; }
public override bool OnOptionsItemSelected(IMenuItem item) { var id = item.ItemId; if (id == Resource.Id.action_about) { var alert = new AlertDialog.Builder(this); alert.SetTitle("关于"); alert.SetMessage("七天网络第三方查分 App."); alert.SetPositiveButton("确定", (senderAlert, args) => { }); alert.SetNeutralButton("Github", (senderAlert, args) => { Toast.MakeText(this, "已开源在 Github!", ToastLength.Short).Show(); }); Dialog dialog = alert.Create(); dialog.Show(); return(true); } if (id == Resource.Id.action_logout) { GetSharedPreferences("config", FileCreationMode.Private) .Edit().PutString("token", "").Apply(); ShowLoginDialog(); } return(base.OnOptionsItemSelected(item)); }
public void OnComplete(Task task) { if (task.IsSuccessful == false) { Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Failed"); alert.SetMessage("Request failed, something went wrong"); alert.SetButton("OK", (c, ev) => { // Ok button click task }); alert.SetButton2("CANCEL", (c, ev) => { }); alert.Show(); } else { Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Success"); alert.SetMessage("Request success, please check your email"); alert.SetButton("OK", (c, ev) => { // Ok button click task }); alert.Show(); } }
private void BtnLogin_Click(object sender, EventArgs e)//login normal { try { string correo = correoLogin.Text; string pass = passLogin.Text; int aux = 0; aux = bd.LoginNormal(correo, pass).Idusuario; if (aux != 0) { Intent i = new Intent(this, typeof(MainActivity)); i.PutExtra("idUs", Convert.ToString(aux)); StartActivity(i); } else { AlertDialog alerta = new AlertDialog.Builder(this).Create(); alerta.SetTitle("Error "); alerta.SetMessage("El usuario o la contraseña son incorrectos. Compruebe su conexion a internet"); alerta.SetButton("Aceptar", (a, b) => { }); alerta.Show(); } } catch (Exception ex) { AlertDialog alerta = new AlertDialog.Builder(this).Create(); alerta.SetTitle("Error "); alerta.SetMessage(ex.Message); alerta.SetButton("Aceptar", (a, b) => { }); alerta.Show(); } }
private void Propinabtn_Click(object sender, EventArgs e) { LayoutInflater layoutInflater = LayoutInflater.From(this); View view = layoutInflater.Inflate(Resource.Layout.propinapopup, null); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetView(view); builder.SetTitle("¿Caunto deseas agregar de propina?"); var propinaa = view.FindViewById <EditText>(Resource.Id.lineapropina); builder.SetCancelable(false) .SetPositiveButton("Donar", (c, ev) => { string lo = propinaa.Text; propina.Text = "$" + lo + ".00"; propinaagregada.Text = "$" + lo + ".00"; float gamesa = float.Parse(lo); AddData(gamesa); }) .SetNegativeButton("Cancelar", (c, ev) => { propina.Text = "$0.00"; propinaagregada.Text = "$0.00"; }); AlertDialog lala = builder.Create(); lala.Show(); }
private void LoadPrintWebVIew() { // PrescriptionView is the design view var printView = LayoutInflater.Inflate(Resource.Layout.print_view, null); CreatePrintWebView(printView); Android.App.AlertDialog dialog = null; AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetView(printView); alert.SetPositiveButton("Print", (senderAlert, args) => { var webView = printView.FindViewById <WebView>(Resource.Id.printWebView); string fileName = "MyPrintFile_" + Guid.NewGuid().ToString() + ".pdf"; var printMgr = (PrintManager)GetSystemService(MainActivity.PrintService); printMgr.Print("MyPrintJob", webView.CreatePrintDocumentAdapter(fileName), new PrintAttributes.Builder().Build()); }); alert.SetNegativeButton("Close", (senderAlert, args) => { dialog.Dismiss(); }); dialog = alert.Create(); dialog.Show(); // dialogPrescription.Window.SetLayout(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); }
private void MprofileTracker_mOnProfileChanged(object sender, OnProfileChangedEventArgs e) { if (e.mProfile != null) { try { Profile p = e.mProfile; int idUS = bd.loginfacebook(p.Id); if (idUS != 0)//consulta para iniciar sesion { Intent i = new Intent(this, typeof(Inicio)); string aux = Convert.ToString(idUS); i.PutExtra("idUs", aux); StartActivity(i); } else { AlertDialog alerta = new AlertDialog.Builder(this).Create(); alerta.SetTitle("Error "); alerta.SetMessage("FB no esta enlazado a ninguna cuenta de usuario"); alerta.SetButton("Aceptar", (a, b) => { }); alerta.Show(); } // tengo que crear el layout del config y pasar los datos a una sesion para almacenarlos entre pestañas } catch (Java.Lang.Exception ex) { } } else { } }
private void FabOnClick(object sender, EventArgs eventArgs) { View view = (View)sender; string rec = Android.Content.PM.PackageManager.FeatureMicrophone; if (rec != "android.hardware.microphone") { var alert = new AlertDialog.Builder(recButton.Context); alert.SetTitle("You don't seem to have a microphone to record with"); alert.SetPositiveButton("OK", (sender, e) => { textBox.Text = "No microphone present"; return; }); alert.Show(); } else { isRecording = !isRecording; } if (isRecording) { var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000); voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1); voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default); StartActivityForResult(voiceIntent, VOICE); } }
private void ShowError(Exception e) { if (e is null) { SentrySdk.CaptureMessage("ShowError called but no Exception instance provided.", SentryLevel.Error); } if (e is AggregateException ae && ae.InnerExceptions.Count == 1) { e = ae.InnerExceptions[0]; } var uploadButton = (Button)base.FindViewById(Resource.Id.btnUpload); var cancelButton = (Button)base.FindViewById(Resource.Id.btnCancel); var lastEvent = SentrySdk.LastEventId; // TODO: SentryId.Empty should operator overload == var message = SentryId.Empty.ToString() == lastEvent.ToString() ? e?.ToString() ?? "Something didn't quite work." : $"Sentry id {lastEvent}:\n{e}"; var builder = new AlertDialog.Builder(this); builder .SetTitle("Error") .SetMessage(message) .SetNeutralButton("Ironic eh?", (o, eventArgs) => { uploadButton.Enabled = true; cancelButton.Enabled = false; }) .Show(); }
private void ConfirmSelectedCollaborators(object sender, EventArgs e) { if (assignUserList.Count > 0) { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetCancelable(false); alertBuilder.SetMessage("Do you want to share this report with this selected users?"); alertBuilder.SetTitle("Share Report"); alertBuilder.SetPositiveButton("Yes", (sender1, args) => { Intent formActivity = new Intent(this, typeof(FormActivity)); formActivity.PutExtra(Resources.GetString(Resource.String.assign_user_list_type), Resources.GetString(Resource.String.add_collaborators)); formActivity.PutIntegerArrayListExtra(Resources.GetString(Resource.String.assign_user_id_list), assignUserList); SetResult(Result.Ok, formActivity); Finish(); }); alertBuilder.SetNegativeButton("No", (sender1, args) => { assignUserList.Clear(); alertBuilder.Dispose(); userListAdapter = new UserListAdapter(this, userCompanies, selectedUserList, userListType); userListAdapter.ButtonClickedOnAssignInvite += ButtonClickDelegate; expandableListView.SetAdapter(userListAdapter); }); alertBuilder.Show(); } else { Utility.DisplayToast(this, "Please select a user to share report"); } }
void wonAlert(string winner) { string title = "Oops!"; if (winner == "O") { title = "Congratulations!"; winner = "Circle"; } else if (winner == "X") { title = "Congratulations!"; winner = "Cross"; } foreach (var button in buttons) { button.Clickable = false; } string message = winner + " is winner"; //Toast.MakeText(this, winner + " won!", ToastLength.Long).Show(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle(title); alert.SetMessage(message); alert.SetPositiveButton("Ok", (senderAlert, args) => { Toast.MakeText(this, "Start new game", ToastLength.Short).Show(); }); Dialog dialog = alert.Create(); dialog.Show(); }
private void CreateLayout() { // Create the layout. LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Add the generate button. _takeMapOfflineButton = new Button(this) { Text = "Take map offline" }; _takeMapOfflineButton.Click += TakeMapOfflineButton_Click; layout.AddView(_takeMapOfflineButton); // Add the mapview. _mapView = new MapView(this); layout.AddView(_mapView); // Add the layout to the view. SetContentView(layout); // Create the progress dialog display. _progressIndicator = new ProgressBar(this); _progressIndicator.SetProgress(40, true); AlertDialog.Builder builder = new AlertDialog.Builder(this).SetView(_progressIndicator); builder.SetCancelable(true); builder.SetMessage("Generating offline map ..."); _alertDialog = builder.Create(); _alertDialog.SetButton("Cancel", (s, e) => { _generateOfflineMapJob.Cancel(); }); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.EditProfile: Intent newActivity = new Intent(this, typeof(ProfileActivity)); newActivity.PutExtra("data", bundle); StartActivity(newActivity); return(true); case Resource.Id.Logout: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Logout?"); builder.SetMessage("Are you sure you want to log out of the app?\n(Go to the Login page after the logout.)"); builder.SetPositiveButton("OK", (c, ev) => { Intent LoginActivity = new Intent(this, typeof(LoginActivity)); StartActivity(LoginActivity); FinishAffinity(); }); builder.SetNegativeButton("Cancel", (c, ev) => { builder.Dispose(); }); builder.Create().Show(); return(true); } return(base.OnOptionsItemSelected(item)); }
private async void CheckAndGetLocation() { try { if (!LocationManager.IsProviderEnabled(LocationManager.GpsProvider)) { if (ShowAlertDialogGps) { ShowAlertDialogGps = false; RunOnUiThread(() => { try { // Call your Alert message AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle(GetString(Resource.String.Lbl3_Use_Location) + "?"); alert.SetMessage(GetString(Resource.String.Lbl3_GPS_is_disabled) + "?"); alert.SetPositiveButton(GetString(Resource.String.Lbl_Ok), (senderAlert, args) => { //Open intent Gps new IntentController(this).OpenIntentGps(LocationManager); }); alert.SetNegativeButton(GetString(Resource.String.Lbl_Cancel), (senderAlert, args) => { }); Dialog gpsDialog = alert.Create(); gpsDialog.Show(); } catch (Exception e) { Console.WriteLine(e); } }); } } else { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; var position = await locator.GetPositionAsync(TimeSpan.FromMilliseconds(10000)); Console.WriteLine("Position Status: {0}", position.Timestamp); Console.WriteLine("Position Latitude: {0}", position.Latitude); Console.WriteLine("Position Longitude: {0}", position.Longitude); UserDetails.Lat = position.Latitude.ToString(CultureInfo.InvariantCulture); UserDetails.Lng = position.Longitude.ToString(CultureInfo.InvariantCulture); var dd = locator.StopListeningAsync(); Console.WriteLine(dd); } } catch (Exception e) { Console.WriteLine(e); } }
public override void ActionSheet(ActionSheetConfig config) { var array = config .Options .Select(x => x.Text) .ToArray(); var dlg = new AlertDialog .Builder(this.GetTopActivity()) .SetCancelable(false) .SetTitle(config.Title); dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke()); if (config.Destructive != null) dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke()); if (config.Cancel != null) dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke()); Utils.RequestMainThread(() => dlg.ShowExt()); }
public void ShowFontSize(Context cntext) { AlertDialog.Builder builder = new AlertDialog.Builder(cntext); builder.SetTitle("Change Font Size"); builder.Create().Show(); }
public void ShowDialog(Context contxt, int id, DateTime sessionDate, bool isWorkshop) { AlertDialog.Builder builder = new AlertDialog.Builder(contxt); builder.SetTitle("Set Notifications"); builder.SetMultiChoiceItems(items.Select(x => x.title).ToArray(), items.Select(x => x.selected).ToArray(), new MultiClickListener()); var clickListener = new ActionClickListener(contxt, id, sessionDate, isWorkshop); builder.SetPositiveButton("OK", clickListener); builder.SetNegativeButton("Cancel", clickListener); builder.Create().Show(); }
private Dialog createDialog(int titleId, int messageId) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle(titleId) .SetIcon(Resource.Drawable.Icon) .SetMessage(messageId); //.SetPositiveButton(Resource.String.ok, null); return builder.Create(); }
public override void Prompt(PromptConfig config) { Utils.RequestMainThread(() => { var activity = this.GetTopActivity(); var txt = new EditText(activity) { Hint = config.Placeholder }; if (config.Text != null) txt.Text = config.Text; this.SetInputType(txt, config.InputType); var builder = new AlertDialog .Builder(activity) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title) .SetView(txt) .SetPositiveButton(config.OkText, (s, a) => config.OnResult(new PromptResult { Ok = true, Text = txt.Text }) ); if (config.IsCancellable) { builder.SetNegativeButton(config.CancelText, (s, a) => config.OnResult(new PromptResult { Ok = false, Text = txt.Text }) ); } builder.Show(); }); }