/** * 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); // 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 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 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(); }
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 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"); } }
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 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(); }
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 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); } }
// 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(); }); }
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(); }
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)); }
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(); }
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(); }
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 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 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 bool OnOptionsItemSelected(IMenuItem item) { // Handle presses on the action bar items try { switch (item.ItemId) { case Resource.Id.action_settings: Intent i = new Intent(this, typeof(SettingsActivity)); StartActivityForResult(i, SETTINGS_ACTIVITY_CODE); return(true); case Resource.Id.action_goto: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Go To ... %"); EditText inputGoTo = new EditText(this); inputGoTo.InputType = InputTypes.ClassNumber; IInputFilter[] fa = new IInputFilter[1]; fa[0] = new InputFilterLengthFilter(2); inputGoTo.SetFilters(fa); inputGoTo.Text = Convert.ToString((int)(Math.Min(linesRecyclerView.progress * 100, 99))); inputGoTo.Gravity = GravityFlags.Center; inputGoTo.SetSelection(inputGoTo.Text.Length); builder.SetView(inputGoTo); builder.SetPositiveButton("Go", (sender, e) => { int newPercent = 0; try { newPercent = Math.Max(0, Math.Min(int.Parse(inputGoTo.Text.ToString()), 100)); int newPos = (int)Math.Round((double)textLen * newPercent / 100); Annotate(newPos); ((AlertDialog)sender).Dismiss(); } catch (System.FormatException) { Toast.MakeText(this, "Invalid percent number", ToastLength.Long).Show(); } }); builder.SetNegativeButton("Cancel", (sender, e) => { ((AlertDialog)sender).Cancel(); }); AlertDialog dialog = builder.Create(); dialog.Window.SetSoftInputMode(SoftInput.StateVisible); dialog.Show(); break; } } catch (Exception e) { Toast.MakeText(this, "Error: " + e.Message, ToastLength.Long).Show(); } return(false); }
public void ShowAlert(string str) { var alert = new AlertDialog.Builder(this); alert.SetTitle(str); alert.SetPositiveButton("OK", (senderAlert, args) => { StartActivity(typeof(a_Schools)); }); //run the alert in UI thread to display in the screen RunOnUiThread(() => { alert.Show(); }); }
private void ShowError(Exception error) { var builder = new AlertDialog.Builder(this); builder.SetTitle(GetString(Resource.String.error_title)); builder.SetMessage(error.Message); builder.SetPositiveButton("OK", (sender, args) => (sender as Dialog)?.Dismiss()); var dialog = builder.Create(); dialog.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 void change_user() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Предупреждение"); builder.SetMessage("Вы уверены, что хотите сменить учетную запись?"); builder.SetCancelable(true); builder.SetNegativeButton("Нет", (s, ev) => { }); try { builder.SetPositiveButton("Да", (s, ev) => { AccountsController.mainAccP = null; AccountsController.instance.CreateTable(); //находить по id только текущего пользователя (тоже самое в EditProfile) var acc = AccountsController.instance.deviceAccsP.Find(x => x.isMainP == true); acc.isMainP = false; AccountsController.instance.SaveItem(acc); FirebaseController.instance.initFireBaseAuth(); FirebaseController.instance.LogOut(); ContactsController.instance.CreateTable(); foreach (var item in ContactsController.instance.GetItems()) { ContactsController.instance.DeleteItem(item.Id); } DialogsController.instance.CreateTable(); foreach (var d in DialogsController.instance.GetItems().ToList()) { DialogsController.instance.DeleteItem(d.Id); } MessagesController.instance.CreateTable(); foreach (var m in MessagesController.instance.GetItems().ToList()) { if (m.decodedP == null) { MessagesController.instance.DeleteItem(m.Id); } } Finish(); Intent intent = new Intent(this, typeof(SignUp)); intent.SetFlags(ActivityFlags.ClearTask); StartActivity(intent); }); Dialog dialog = builder.Create(); dialog.Show(); return; } catch (Exception ex) { Utils.MessageBox(ex.Message, this); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("顏色"); View view = LayoutInflater.From(this).Inflate(Resource.Layout.color, null); builder.SetView(view); adColor = builder.Create(); bColor = FindViewById <Button>(Resource.Id.b_color); etText = FindViewById <EditText>(Resource.Id.et_text); fontMetrics = paint.GetFontMetrics(); ivCanvas = FindViewById <ImageView>(Resource.Id.iv_canvas); llPaint = FindViewById <LinearLayout>(Resource.Id.ll_paint); rbEraser = FindViewById <RadioButton>(Resource.Id.rb_eraser); rbFill = FindViewById <RadioButton>(Resource.Id.rb_fill); rbHandwriting = FindViewById <RadioButton>(Resource.Id.rb_handwriting); rbPencil = FindViewById <RadioButton>(Resource.Id.rb_pencil); rbText = FindViewById <RadioButton>(Resource.Id.rb_text); sbAlpha = view.FindViewById <SeekBar>(Resource.Id.sb_alpha); sbBlue = view.FindViewById <SeekBar>(Resource.Id.sb_blue); sbGreen = view.FindViewById <SeekBar>(Resource.Id.sb_green); sbRed = view.FindViewById <SeekBar>(Resource.Id.sb_red); sbSize = FindViewById <SeekBar>(Resource.Id.sb_size); sbWidth = FindViewById <SeekBar>(Resource.Id.sb_width); adColor.DismissEvent += AdColor_DismissEvent; FindViewById <Button>(Resource.Id.b_clear).Click += BClear_Click; bColor.Click += BSolidColor_Click; FindViewById <Button>(Resource.Id.b_red).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_green).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_blue).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_yellow).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_cyan).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_magenta).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_black).Click += BMaterialDesignColor_Click; FindViewById <Button>(Resource.Id.b_white).Click += BMaterialDesignColor_Click; ivCanvas.Touch += IvCanvas_Touch; FindViewById <RadioGroup>(Resource.Id.rg_tool).CheckedChange += RgTool_CheckedChange; sbAlpha.ProgressChanged += SbColor_ProgressChanged; sbBlue.ProgressChanged += SbColor_ProgressChanged; sbGreen.ProgressChanged += SbColor_ProgressChanged; sbRed.ProgressChanged += SbColor_ProgressChanged; sbSize.ProgressChanged += SbSize_ProgressChanged; sbWidth.ProgressChanged += SbWidth_ProgressChanged; Handwriting.blackBrush = BitmapFactory.DecodeResource(Resources, Resource.Mipmap.brush); Handwriting.brush = Handwriting.blackBrush.Copy(Bitmap.Config.Argb8888, true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //if launched from history, don't re-use the task. Proceed to FileSelect instead. if (Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory)) { Kp2aLog.Log("Forwarding to FileSelect. QueryCredentialsActivity started from history."); RestartApp(); return; } string requestedUrl = Intent.GetStringExtra(ExtraQueryString); if (requestedUrl == null) { Toast.MakeText(this, "Cannot execute query for null.", ToastLength.Long).Show(); RestartApp(); return; } if (Intent.HasExtra(ExtraDisplayWarning)) { AutofillServiceBase.DisplayWarning warning = (AutofillServiceBase.DisplayWarning)Intent.GetIntExtra(ExtraDisplayWarning, (int)AutofillServiceBase.DisplayWarning.None); if (warning != AutofillServiceBase.DisplayWarning.None) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle(this.GetString(Resource.String.AutofillWarning_title)); builder.SetMessage( GetString(Resource.String.AutofillWarning_Intro, new Java.Lang.Object[] { Intent.GetStringExtra(ExtraQueryDomainString), Intent.GetStringExtra(ExtraQueryPackageString) }) + " " + this.GetString(Resource.String.AutofillWarning_FillDomainInUntrustedApp, new Java.Lang.Object[] { Intent.GetStringExtra(ExtraQueryDomainString), Intent.GetStringExtra(ExtraQueryPackageString) })); builder.SetPositiveButton(this.GetString(Resource.String.Continue), (dlgSender, dlgEvt) => { Proceed(); }); builder.SetNegativeButton(this.GetString(Resource.String.cancel), (dlgSender, dlgEvt) => { Finish(); }); Dialog dialog = builder.Create(); dialog.Show(); return; } } Proceed(); }
private async void LoginOK_Click(object sender, EventArgs e) { var passwordBytes = Sodium.GenericHash.Hash(userPassword.Text, deviceId, 32); var keyPair = Sodium.PublicKeyBox.GenerateKeyPair(passwordBytes); if (string.IsNullOrWhiteSpace(publicKey)) { // No Public Key Present - Store await encryptionService.SetPublicKey(Convert.ToBase64String(keyPair.PublicKey)); await encryptionService.SetPassword(userPassword.Text); Toast.MakeText(Activity, "Encryption Keys Generated", ToastLength.Long).Show(); NavigateToWelcome(); } else { // Public Key Present - Generate and Check var generatedPublicKeyBase64 = Convert.ToBase64String(keyPair.PublicKey); if (publicKey.Equals(generatedPublicKeyBase64)) { await encryptionService.SetPassword(userPassword.Text); Toast.MakeText(Activity, "Login Successful", ToastLength.Long).Show(); if (string.IsNullOrEmpty(incomingSMSContent)) { NavigateToWelcome(); } else { var readerFragment = new ReaderFragment(incomingSMSContent); NavigateToReader(readerFragment); } } else { // TODO: Display Failure Alert var builder = new AlertDialog.Builder(Activity); builder.SetTitle("Login Failure"); builder.SetMessage("Incorrect password/passphrase - please try again."); builder.SetPositiveButton("OK", (s, e) => { builder.Dispose(); }); var dialog = builder.Create(); dialog.Show(); } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); DroidGameApp.CurrentContext = this; var bootstrapper = new DroidAppBootstrapper(); bootstrapper.SetupApplication(); // Set our view from the "main" layout resource SetContentView(Resource.Layout.LoginActivityLayout); _viewModel = Resolver.Resolve <ILoginViewModel>(); var editText = FindViewById <EditText>(Resource.Id.editTextUsername); editText.Text = _viewModel.Username; editText.TextChanged += (sender, args) => { _viewModel.Username = ((EditText)sender).Text; }; editText = FindViewById <EditText>(Resource.Id.editTextPassword); editText.Text = _viewModel.Password; editText.TextChanged += (sender, args) => { _viewModel.Password = ((EditText)sender).Text; }; var loginButton = FindViewById <Button>(Resource.Id.buttonLogin); loginButton.Click += (sender, args) => { _viewModel.LoginCommand.Execute(null); }; _viewModel.PropertyChanged += (sender, args) => { loginButton.Enabled = _viewModel.CanLogin; if (args.PropertyName.Equals(nameof(_viewModel.ErrorMessage))) { var alert = new AlertDialog.Builder(this); alert.SetTitle("Error"); alert.SetMessage("Could not login."); alert.SetPositiveButton("OK", (senderAlert, arg) => { }); Dialog dialog = alert.Create(); dialog.Show(); } }; }
private void OnAddItemClicked(object sender, EventArgs eventArgs) { var builder = new AlertDialog.Builder(this); var dialogLayout = LayoutInflater.Inflate(Resource.Layout.dialog_new_item, null); var control = dialogLayout.FindViewById <EditText>(Resource.Id.new_item_text); builder.SetTitle(GetString(Resource.String.new_item_title)); builder.SetView(dialogLayout); builder.SetPositiveButton("OK", async(sender, eventArgs) => await CreateItemFromDialogAsync(control)); var dialog = builder.Create(); dialog.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 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(); }
public void ShowFontSize(Context cntext) { AlertDialog.Builder builder = new AlertDialog.Builder(cntext); builder.SetTitle("Change Font Size"); builder.Create().Show(); }