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(); }
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 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 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); }
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 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(); }; }
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 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) { 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 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(); }
// 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 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 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 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); }
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 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(); }); }
public void showInternetConnectionError() { AlertDialog.Builder alert = mDialog.CreateErrorDialog("Connection error", "Unable to connect with the server.\nCheck your internet connection.", "TRAY AGAIN"); alert.SetPositiveButton("TRAY AGAIN", (senderAlert, args) => { StartActivityForResult(new Intent(Settings.ActionWifiSettings), 0); }); Dialog dialog = alert.Create(); dialog.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); } }
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 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(); }
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 void ShowPauseDialog() { View dialogView = LayoutInflater.Inflate(Resource.Layout.spinner_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetView(dialogView); builder.SetCancelable(false); builder.SetTitle(INFECTION_STATUS_PAUSE_DIALOG_TITLE); builder.SetMessage(INFECTION_STATUS_PAUSE_DIALOG_MESSAGE); _picker = dialogView.FindViewById(Resource.Id.picker) as NumberPicker; _picker.MinValue = 0; _picker.MaxValue = 4; _picker.DescendantFocusability = DescendantFocusability.BlockDescendants; _picker.SetDisplayedValues( new[] { INFECTION_STATUS_PAUSE_DIALOG_OPTION_NO_REMINDER, INFECTION_STATUS_PAUSE_DIALOG_OPTION_ONE_HOUR, INFECTION_STATUS_PAUSE_DIALOG_OPTION_TWO_HOURS, INFECTION_STATUS_PAUSE_DIALOG_OPTION_FOUR_HOURS, INFECTION_STATUS_PAUSE_DIALOG_OPTION_EIGHT_HOURS, }); builder.SetPositiveButton(INFECTION_STATUS_PAUSE_DIALOG_OK_BUTTON, (sender, args) => { switch (_picker.Value) { case 1: case 2: case 3: case 4: StartReminderService((int)Math.Pow(2, _picker.Value - 1)); break; } StopGoogleAPI(); (sender as AlertDialog)?.Dismiss(); }); if (Android.OS.Build.VERSION.SdkInt > Android.OS.BuildVersionCodes.M) { AlertDialog alertDialog = builder.Create(); alertDialog.Window.DecorView.LayoutDirection = LayoutUtils.GetLayoutDirection(); alertDialog.Show(); } else { builder.Create(); builder.Show(); } }
//Delete All View <Reset> private void ImgDeleteAllOnClick(object sender, EventArgs e) { try { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_delete_all_changed)); builder.SetPositiveButton(GetText(Resource.String.Lbl_Yes), delegate(object o, DialogClickEventArgs args) { MNiceArtEditor.SetFilterEffect(PhotoFilter.None); MNiceArtEditor.ClearAllViews(); MNiceArtEditorView.GetSource().ClearColorFilter(); }); builder.SetNegativeButton(GetText(Resource.String.Lbl_No), delegate(object o, DialogClickEventArgs args) { }); builder.Create().Show(); } catch (Exception exception) { Console.WriteLine(exception); } }
private void ShowSaveDialog() { try { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_exit_without_saving_image)); builder.SetPositiveButton(GetText(Resource.String.Lbl_Save), delegate(object sender, DialogClickEventArgs args) { SaveImage(); }); builder.SetNegativeButton(GetText(Resource.String.Lbl_Cancel), delegate(object sender, DialogClickEventArgs args) { }); builder.SetNeutralButton(GetText(Resource.String.Lbl_Discard), delegate(object sender, DialogClickEventArgs args) { var resultIntent = new Intent(); SetResult(Result.Canceled, resultIntent); Finish(); }); builder.Create().Show(); } catch (Exception e) { Console.WriteLine(e); } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetPositiveButton(Android.Resource.String.Ok, (IDialogInterfaceOnClickListener)null); Bundle args = Arguments; if (args.ContainsKey(ArgMessageInt)) { builder.SetMessage(args.GetInt(ArgMessageInt)); } else if (args.ContainsKey(ArgMessageString)) { builder.SetMessage(args.GetString(ArgMessageString)); } return(builder.Create()); }
void enableGPS() { Boolean enabled = service.IsProviderEnabled(provider); if (!enabled) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Location Services Not Active"); alert.SetMessage("Please enable Location Services and GPS"); alert.SetPositiveButton("Ok", (c, ev) => { StartActivity(new Intent(Settings.ActionLocationSourceSettings)); }); alert.Show(); } }
private void acciones() { //al pulsar el boton de login recoger los datos de los campos que permiten hacer una consulta a la bbdd //para comprobar que estan registrados login.Click += (sender, e) => { /* * if(Comprobar(new Usuario("example","example"))) * { * Toast.MakeText(this, "", ToastLength.Long).Show(); * Intent intent = new Intent(this, typeof(HomeActivity)); * StartActivity(intent) * ; * * } * else * { * * * }*/ if (TryConnection(this, user.Text, pass.Text)) { Toast.MakeText(this, "Eres un dios", ToastLength.Long).Show(); Thread.Sleep(200); Toast.MakeText(this, "", ToastLength.Long).Show(); Intent intent = new Intent(this, typeof(HomeActivity)); StartActivity(intent); } else { Toast.MakeText(this, "Eres un mierdas", ToastLength.Long).Show(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Alerta"); alert.SetMessage("No estas registrado, por favor registrate en la pagina a la que seras redirigido"); alert.SetPositiveButton("ok", OkAction); var dialogo = alert.Create(); dialogo.Show(); } }; registro.Click += (sender, e) => { Intent intent = new Intent(this, typeof(ActivityReg)); StartActivity(intent); }; }
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(); }