private void TxtWidth_FocusChange(object sender, View.FocusChangeEventArgs e) { var txt = (EditText)sender; if (txt.Text != string.Empty) { var resp = Validartxt(txt); if (resp == false) { alert.Builder adb = new alert.Builder(this); adb.SetTitle("Advertencia?"); adb.SetMessage("Verifique el datos ingresado " + txt.Text + " y corregir!!!"); adb.SetNeutralButton("Mantener Dato", (senderAlert, args) => { }); adb.SetPositiveButton("Borrar Dato Ingresado", (senderAlert, args) => { txt.Text = ""; txt.RequestFocus(); }); alert dialog = adb.Create(); dialog.Show(); } else { txt.Focusable = true; } } }
public override void ActionSheet(ActionSheetConfig config) { var dlg = new AlertDialog .Builder(this.GetTopActivity()) .SetCancelable(false) .SetTitle(config.Title); if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null)) { var adapter = new ActionSheetListAdapter(this.GetTopActivity(), Android.Resource.Layout.SelectDialogItem, Android.Resource.Id.Text1, config); dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke()); } else { var array = config .Options .Select(x => x.Text) .ToArray(); 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 override void ActionSheet(ActionSheetConfig config) { var dlg = new AlertDialog .Builder(this.GetTopActivity()) .SetCancelable(false) .SetTitle(config.Title); if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null)) { var adapter = new ActionSheetListAdapter(this.GetTopActivity(), Android.Resource.Layout.SelectDialogItem, Android.Resource.Id.Text1, config); dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke()); } else { var array = config .Options .Select(x => x.Text) .ToArray(); 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 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, (sender, args) => config.Options[args.Which].Action.TryExecute()); if (config.Destructive != null) { dlg.SetNegativeButton(config.Destructive.Text, (sender, e) => config.Destructive.Action.TryExecute()); } if (config.Cancel != null) { dlg.SetNeutralButton(config.Cancel.Text, (sender, e) => config.Cancel.Action.TryExecute()); } Utils.RequestMainThread(() => dlg.Show()); }
/// <summary> /// Display an error dialog saying IA cannot find a playable move. /// </summary> private void ShowErrorDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Error"); alert.SetMessage("Application cannot find a playable move."); alert.SetNeutralButton("Go back", delegate { base.OnBackPressed(); }); alert.Show(); }
private void AlertIncomplete(string message) { var alert = new AlertDialog.Builder(this); alert.SetTitle("Incorrect operation"); alert.SetMessage(message); alert.SetNeutralButton("OK", (senderAlert, args) => { alert.Dispose(); }); Dialog dialog = alert.Create(); dialog.Show(); }
void Alerta(string title, string message) { alert.Builder adb = new alert.Builder(this); adb.SetTitle(title); adb.SetMessage(message); adb.SetNeutralButton("Aceptar", (senderAlert, args) => { }); alert dialog = adb.Create(); dialog.Show(); }
public Dialog Build(AppCompatActivity activity, ActionSheetConfig config) { var dialog = new AppCompatAlertDialog.Builder(activity, config.AndroidStyleId ?? 0) .SetTitle(config.Title); if (config.Cancel != null) { dialog.SetNeutralButton(config.Cancel.Text, (s, a) => { config.Cancel.Action?.Invoke(); }); } if (config.Destructive != null) { dialog.SetNegativeButton(config.Destructive.Text, (s, a) => { config.Destructive.Action?.Invoke(); }); } if (config.Items != null && config.Items.Count > 0) { if (config.Items.Any(t => t.ItemIcon != null)) { var adapter = new ActionSheetListAdapter(activity, global::Android.Resource.Layout.SelectDialogItem, global::Android.Resource.Id.Text1, config); dialog.SetAdapter(adapter, (s, a) => { config.Items[a.Which].Action?.Invoke(); }); } else { var array = config.Items.Select(t => t.Text).ToArray(); dialog.SetItems(array, (s, a) => { config.Items[a.Which].Action?.Invoke(); }); } } return(dialog.Create()); }
private void ListView1_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { try { var obj = listtemp[e.Position]; alert.Builder adb = new alert.Builder(this); adb.SetTitle("Registro de Medidas?"); adb.SetMessage("Esta Seguro de Seleccionar el contenedor "); // adb.SetPositiveButton() adb.SetPositiveButton("Medida Swatch", (senderAlert, args) => { Intent i = new Intent(this, typeof(Swatch)); i.PutExtra(Swatch.idcontenedor, obj.Idcontenedor.ToString()); i.PutExtra(Swatch.contenedor, obj.Contenedor); // startActivity(i); StartActivity(i); }); adb.SetNegativeButton("Medida Ancho", (senderAlert, args) => { Intent i = new Intent(this, typeof(Width)); i.PutExtra(Width.idcontenedor, obj.Idcontenedor.ToString()); i.PutExtra(Width.contenedor, obj.Contenedor); // startActivity(i); StartActivity(i); //Toast.MakeText(this, "Elimacion cancelada", ToastLength.Short).Show(); }); adb.SetNeutralButton("Cancelar", (senderAlert, args) => { Toast.MakeText(this, "Seleccion Cancelada", ToastLength.Short).Show(); }); alert dialog = adb.Create(); dialog.Show(); } catch (System.Exception) { throw; } }
public Dialog Build(AppCompatActivity activity, ActionSheetConfig config) { var dlg = new AppCompatAlertDialog.Builder(activity, config.AndroidStyleId ?? 0) .SetTitle(config.Title); //.SetCustomTitle(new TextView(activity) { // Text = config.Title, // TextSize = 18.0f //}); if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null)) { var adapter = new ActionSheetListAdapter(activity, Android.Resource.Layout.SelectDialogItem, Android.Resource.Id.Text1, config); dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke()); } else { var array = config .Options .Select(x => x.Text) .ToArray(); dlg.SetSingleChoiceItems(array, config.SelectedIndex, (s, args) => { config.Options[args.Which].Action?.Invoke(); (s as AppCompatAlertDialog).Dismiss(); }); } if (config.Destructive != null) { dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke()); } if (!string.IsNullOrEmpty(config.Cancel?.Text)) { dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke()); } return(dlg.Create()); }
public static AppCompatAlertDialog.Builder Build(AppCompatActivity activity, ActionSheetConfig config) { var dlg = new AppCompatAlertDialog .Builder(activity) .SetCancelable(false) .SetTitle(config.Title); //.SetCustomTitle(new TextView(activity) { // Text = config.Title, // TextSize = 18.0f //}); if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null)) { var adapter = new ActionSheetListAdapter(activity, Android.Resource.Layout.SelectDialogItem, Android.Resource.Id.Text1, config); dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke()); } else { var array = config .Options .Select(x => x.Text) .ToArray(); 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()); } return(dlg); }
private static void ShowRateDialog(Context context) { var rateReminderDialogBuilder = new AlertDialog.Builder(context, Resource.Style.AlertDialogStyle); rateReminderDialogBuilder.SetTitle(context.GetString(Resource.String.RateReminderDialog_title)); rateReminderDialogBuilder.SetMessage(context.GetString(Resource.String.RateReminderDialog_message)); rateReminderDialogBuilder.SetCancelable(true); rateReminderDialogBuilder.SetPositiveButton(Resource.String.RateReminderDialog_positive, delegate { // When the positive button has been pressed: open the app store OpenAppStore(context); // Also do not open the dialog again SetDoNotShowAgain(context, true); _rateDialog?.Dismiss(); }); rateReminderDialogBuilder.SetNeutralButton(Resource.String.RateReminderDialog_neutral, delegate { _rateDialog?.Dismiss(); }); rateReminderDialogBuilder.SetNegativeButton(Resource.String.RateReminderDialog_negative, delegate { // Do not open the dialog again SetDoNotShowAgain(context, true); _rateDialog?.Dismiss(); }); rateReminderDialogBuilder.SetCancelable(false); // Create and show the dialog _rateDialog = rateReminderDialogBuilder.Create(); _rateDialog.Show(); }
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, (sender, args) => config.Options[args.Which].Action.TryExecute()); if (config.Destructive != null) dlg.SetNegativeButton(config.Destructive.Text, (sender, e) => config.Destructive.Action.TryExecute()); if (config.Cancel != null) dlg.SetNeutralButton(config.Cancel.Text, (sender, e) => config.Cancel.Action.TryExecute()); Utils.RequestMainThread(() => dlg.Show()); }
private void OnDataLoaded(NotifyDataResult e) { ProgressBar pBar = FindViewById <ProgressBar>(Resource.Id.subject_layout_progressBar); pBar.Visibility = ViewStates.Gone; if (e.Result == Result.Ok) { RecyclerView rView = FindViewById <RecyclerView>(Resource.Id.subject_layout_recyclerView); var layout = new LinearLayoutManager(this); rView.SetLayoutManager(layout); rView.HasFixedSize = true; var mAdapter = new SubjectAdapter(VModel.Subjects); rView.SetAdapter(mAdapter); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("An error ocorred"); builder.SetNeutralButton("OK", (sender, args) => { }); builder.SetMessage(e.ErrorMessage); builder.Show(); } }
public Dialog Build(AppCompatActivity activity, AlertConfig config) { var builder = new AppCompatAlertDialog.Builder(activity, config.AndroidStyleId ?? 0) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title); if (config.OkButton != null) { builder.SetPositiveButton(config.OkButton.Text, (o, e) => config.OkButton.Action?.Invoke()); } if (config.CancelButton != null) { builder.SetNegativeButton(config.CancelButton.Text, (o, e) => config.CancelButton.Action?.Invoke()); } if (config.DestructiveButton != null) { builder.SetNeutralButton(config.DestructiveButton.Text, (o, e) => config.DestructiveButton.Action?.Invoke()); } return(builder.Create()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var signature = FindViewById <SignaturePadView> (Resource.Id.signatureView); if (EnableCustomization) { var root = FindViewById <View> (Resource.Id.rootView); signature.Caption.Text = "Authorization Signature"; signature.Caption.SetTypeface(Typeface.Serif, TypefaceStyle.BoldItalic); signature.Caption.SetTextSize(global::Android.Util.ComplexUnitType.Sp, 16f); signature.SignaturePrompt.Text = ">>"; signature.SignaturePrompt.SetTypeface(Typeface.SansSerif, TypefaceStyle.Normal); signature.SignaturePrompt.SetTextSize(global::Android.Util.ComplexUnitType.Sp, 32f); signature.BackgroundColor = Color.Rgb(255, 255, 200); // a light yellow. signature.StrokeColor = Color.Black; signature.BackgroundImageView.SetImageResource(Resource.Drawable.logo_galaxy_black_64); signature.BackgroundImageView.SetAlpha(16); signature.BackgroundImageView.SetAdjustViewBounds(true); var layout = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layout.AddRule(LayoutRules.CenterInParent); layout.SetMargins(20, 20, 20, 20); signature.BackgroundImageView.LayoutParameters = layout; // You can change paddings for positioning... var caption = signature.Caption; caption.SetPadding(caption.PaddingLeft, 1, caption.PaddingRight, 25); } // get our button from the layout resource, // and attach an event to it var btnSave = FindViewById <Button> (Resource.Id.btnSave); btnSave.Click += delegate { if (signature.IsBlank) { // display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("No signature to save."); alert.SetNeutralButton("Okay", delegate { }); alert.Create().Show(); } points = signature.Points; }; btnSave.Dispose(); var btnLoad = FindViewById <Button> (Resource.Id.btnLoad); btnLoad.Click += delegate { if (points != null) { signature.LoadPoints(points); } }; btnLoad.Dispose(); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.ingresoSwatch); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); String _idconte = Intent.GetStringExtra(idcontenedor); String _contenedor = Intent.GetStringExtra(contenedor); TextView textView1 = FindViewById <TextView>(Resource.Id.textView1); lblnombrerollo = FindViewById <TextView>(Resource.Id.lblnombrerollo); lblcodigotela = FindViewById <TextView>(Resource.Id.lblcodigotela); spinner1 = FindViewById <Spinner>(Resource.Id.spinner1); txtsecuenciaRollo = FindViewById <EditText>(Resource.Id.txtsecuenciaRollo); txtx1 = FindViewById <EditText>(Resource.Id.txtx1); txtx2 = FindViewById <EditText>(Resource.Id.txtx2); txtx3 = FindViewById <EditText>(Resource.Id.txtx3); txty1 = FindViewById <EditText>(Resource.Id.txty1); txty2 = FindViewById <EditText>(Resource.Id.txty2); txty3 = FindViewById <EditText>(Resource.Id.txty3); txtp1 = FindViewById <EditText>(Resource.Id.txtp1); txtp2 = FindViewById <EditText>(Resource.Id.txtp2); btbguardarSwatch = FindViewById <Button>(Resource.Id.btnguardarSwatch); lbltotalrollos = FindViewById <TextView>(Resource.Id.txttotalrollosS); textView1.Text = _contenedor; Enabled(false); Limpiartext(); txtsecuenciaRollo.Enabled = false; listacod = await Task.Run(() => CargaListas(int.Parse(_idconte))); var countItem = Listarollos.Count; if (countItem < 1) { alert.Builder adb = new alert.Builder(this); adb.SetTitle("Advertencia!"); adb.SetMessage("Ya fueron medidos de ancho todos los rollos del contenedor"); adb.SetNeutralButton("Aceptar", (senderAlert, args) => { }); adb.SetPositiveButton("Buscar otro contenedor", (s, args) => { StartActivity(typeof(MainActivity)); // SetContentView(Resource.Layout.listaRollos); }); alert dialog = adb.Create(); dialog.Show(); } else { // var countItem = Listarollos.Count; lbltotalrollos.Text = string.Concat("Total de rollos por medir: ", countItem.ToString()); } txtx1.FocusChange += Txt_FocusChange; txtx2.FocusChange += Txt_FocusChange; txtx3.FocusChange += Txt_FocusChange; txty1.FocusChange += Txt_FocusChange; txty2.FocusChange += Txt_FocusChange; txty3.FocusChange += Txt_FocusChange; txtp1.FocusChange += Txtp1_FocusChange; txtp2.FocusChange += Txtp1_FocusChange; //txtp1.FocusChange+=Tx // var arrayadapter = new ArrayAdapter<List<>>(this, Android.Resource.Layout.SimpleSpinnerItem, datalist); //simple spinner item // arrayadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner1.Adapter = new CodigosTelaAdapter(this, listacod.OrderBy(x => x.Idtpc).ToList()); spinner1.ItemSelected += Spinner1_ItemSelected; txtsecuenciaRollo.AfterTextChanged += TxtsecuenciaRollo_AfterTextChanged; btbguardarSwatch.Click += BtbguardarSwatch_Click; }
private void ShowDialog(ListItemAdapter adapter, int itemPosition, string dialogTitle, bool isPendingDialog, bool isPayment, bool isHistory) { AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity, Resource.Style.AlertDialogStyle); var debtItem = adapter.Items[itemPosition]; builder.SetTitle(dialogTitle); if (isPendingDialog) { builder.SetPositiveButton("Accept", (senderAlert, e) => { if (dialogTitle.ToLower().Contains("debt")) { DatabaseInterface.AcceptDebt(debtItem.Id, _persoon.Id, _persoon.Password); Toast.MakeText(this.Activity, "Debt accepted: " + debtItem.Description, ToastLength.Short).Show(); SwipeRefreshLayout.Refreshing = true; this.Refresh(); } else if (dialogTitle.ToLower().Contains("payment")) { string[] user = debtItem.Name.Split(' '); foreach(int debt in _persoon.KrijgPaymentsVanGebruiker(user[1])) DatabaseInterface.AcceptPayment(debt, _persoon.Id, _persoon.Password); Toast.MakeText(this.Activity, "Payment accepted from: " + debtItem.Name, ToastLength.Short).Show(); SwipeRefreshLayout.Refreshing = true; this.Refresh(); } CreateEnvironments(); }); builder.SetNegativeButton("Decline", (s, e) => { if (dialogTitle.ToLower().Contains("debt")) { DatabaseInterface.DeclineDebt(debtItem.Id, _persoon.Id, _persoon.Password); Toast.MakeText(this.Activity, "Debt declined: " + debtItem.Description, ToastLength.Short).Show(); Gegevens.GetServerData(_persoon.Id, _persoon.Password); ((Payscherm)this.Activity).Restart(); } else if (dialogTitle.ToLower().Contains("payment")) { string[] user = debtItem.Name.Split(' '); foreach(int debt in _persoon.KrijgPaymentsVanGebruiker(user[1])) DatabaseInterface.DeclinePayment(debt, _persoon.Id, _persoon.Password); Toast.MakeText(this.Activity, "Payment declined from: " + debtItem.Name, ToastLength.Short).Show(); Gegevens.GetServerData(_persoon.Id, _persoon.Password); ((Payscherm)this.Activity).Restart(); } CreateEnvironments(); }); builder.SetNeutralButton("Cancel", (s, e) => { // dialog cancelt automatisch }); } View dialogView; if (isPayment) { dialogView = this.Activity.LayoutInflater.Inflate(Resource.Layout.PaymentDialog, null); builder.SetView(dialogView); } else { if (isHistory) { dialogView = this.Activity.LayoutInflater.Inflate(Resource.Layout.HistoryDialog, null); builder.SetView(dialogView); dialogView.FindViewById<TextView>(Resource.Id.dialogItemDate).Text = debtItem.StringValue; } else { dialogView = this.Activity.LayoutInflater.Inflate(Resource.Layout.DebtDialog, null); builder.SetView(dialogView); } List<string> tempList = debtItem.FullDescription.Split('-').ToList(); tempList.RemoveAt(0); if (tempList.Count != 0) // check of er producten zijn toegevoegd { tempList.RemoveAt(tempList.Count - 1); } // maak producten aan op basis van een stringlist List<ListItem> productList = new List<ListItem>(); for(int i = 0; i < tempList.Count; i += 2) { productList.Add(new ListItem(tempList[i], double.Parse(tempList[i+1]) / 100)); } ListItemAdapter dialogAdapter = new ListItemAdapter(ListItem.DialogItem, productList); RecyclerView dialogRecyclerView = dialogView.FindViewById<RecyclerView>(Resource.Id.dialogrecyclerview); dialogRecyclerView.SetLayoutManager(new LinearLayoutManager(this.Activity)); dialogRecyclerView.SetAdapter(dialogAdapter); dialogView.FindViewById<TextView>(Resource.Id.dialogItemDescription).Text = debtItem.Description; } dialogView.FindViewById<TextView>(Resource.Id.dialogItemName).Text = debtItem.Name; dialogView.FindViewById<TextView>(Resource.Id.dialogItemValue).Text = debtItem.Value.ToString("N"); dialogView.FindViewById<ImageView>(Resource.Id.dialogItemImage).SetImageResource(debtItem.ImageId); builder.SetCancelable(true); builder.Show(); }
private void ShowFailedAlert(string msg) { var registerFailAlert = new SupportAlert.Builder(this); registerFailAlert.SetMessage(msg); registerFailAlert.SetNeutralButton("OK", delegate { }); registerFailAlert.Show(); }
void OnItemClick(object sender, ListItemEventArgs args) { AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.AlertDialogStyle); View dialogView = LayoutInflater.Inflate(Resource.Layout.NumberAlertItem, null); EditText Amount = dialogView.FindViewById<EditText> (Resource.Id.EditAmount); Amount.FocusChange += delegate { if(Amount.HasFocus) Amount.Text = ""; }; var tempItem = _adapter.Items[args.Position]; builder.SetTitle("Enter the amount of your payment"); builder.SetPositiveButton("Send", (senderAlert, e) => { Aflossen(tempItem.Name, System.Convert.ToDouble(Amount.Text)); }); builder.SetNeutralButton("Cancel", (senderAlert, e) => { // yay cancel }); builder.SetView(dialogView); builder.SetCancelable(true); builder.Show(); }
private void ReasonAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.AlertDialogStyle); View dialogView = LayoutInflater.Inflate(Resource.Layout.AlertItem, null); EditText redenedit = dialogView.FindViewById<EditText> (Resource.Id.EditAmount); redenedit.FocusChange += delegate { if(redenedit.HasFocus) redenedit.Text = ""; }; builder.SetTitle("Enter the occasion of your debt"); builder.SetPositiveButton("Confirm", (senderAlert, e) => { CreateDebts(redenedit.Text); }); builder.SetNeutralButton("Cancel", (senderAlert, e) => { //cancelt de dialog }); builder.SetView(dialogView); builder.SetCancelable(true); builder.Show (); }
private async Task Book() { // Code to book the workshop WorkshopController workshopController = new WorkshopController(); if (! await workshopController.Book(_Workshop.WorkshopId)) { //show error , stay on page; } else { //show dialog saying booked var SuccesDialog = new AlertDialog.Builder(this); SuccesDialog.SetMessage("You have successfully been booked!"); SuccesDialog.SetNeutralButton("OK", delegate { Finish(); }); SuccesDialog.Show(); } }
// Warns user that they will delete this booking and removes the booking if user presses okay private void CancelBooking() { AlertDialog.Builder cancelAlert = new AlertDialog.Builder(this); cancelAlert.SetTitle(GetString(Resource.String.cancelBooking)); cancelAlert.SetMessage(GetString(Resource.String.areYouSureCancel)); cancelAlert.SetPositiveButton("YES", delegate { if(_Booking.GetType() == typeof(SessionBooking)) { SessionController sessionController = new SessionController(); if (!sessionController.CancelSession(_Booking.ID())) { //show error, stay on page } else { //show dialog saying canceled var SuccesDialog = new AlertDialog.Builder(this); SuccesDialog.SetMessage("Booking has been Canceled!"); SuccesDialog.SetNeutralButton("OK", delegate { Finish(); }); SuccesDialog.Show(); if (bookingType.Equals("Session")) Server.sessionBookingsAltered = true; else Server.workshopBookingsAltered = true; } } else if (_Booking.GetType() == typeof(WorkshopBooking)) { // Code to cancel booking. WorkshopController workshopController = new WorkshopController(); if (!workshopController.CancelBooking(_Booking.ID())) { //show error, stay on page; } else { //show dialog saying cancled var SuccesDialog = new AlertDialog.Builder(this); SuccesDialog.SetMessage("Booking has been Canceled!"); SuccesDialog.SetNeutralButton("OK", delegate { Finish(); }); SuccesDialog.Show(); if (bookingType.Equals("Session")) Server.sessionBookingsAltered = true; else Server.workshopBookingsAltered = true; } } }); cancelAlert.SetNegativeButton("NO", delegate { }); cancelAlert.Show(); }
private async Task Waitlist() { WorkshopController workshopController = new WorkshopController(); await workshopController.Waitlist(_Workshop.WorkshopId); //show dialog saying canceled var SuccesDialog = new AlertDialog.Builder(this); SuccesDialog.SetMessage("You have successfully been waitlisted!"); SuccesDialog.SetNeutralButton("OK", delegate { Finish(); }); SuccesDialog.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); //RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape; // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView); if (true) { // Customization activated View root = FindViewById<View> (Resource.Id.rootView); // Activate this to internally use a bitmap to store the strokes // (good for frequent-redraw situations, bad for memory footprint) // signature.UseBitmapBuffer = true; signature.Caption.Text = "Authorization Signature"; signature.Caption.SetTypeface (Typeface.Serif, TypefaceStyle.BoldItalic); signature.Caption.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 16f); signature.SignaturePrompt.Text = ">>"; signature.SignaturePrompt.SetTypeface (Typeface.SansSerif, TypefaceStyle.Normal); signature.SignaturePrompt.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 32f); signature.BackgroundColor = Color.Rgb (255, 255, 200); // a light yellow. signature.StrokeColor = Color.Black; signature.BackgroundImageView.SetImageResource (Resource.Drawable.logo_galaxy_black_64); signature.BackgroundImageView.SetAlpha (16); signature.BackgroundImageView.SetAdjustViewBounds (true); var layout = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layout.AddRule (LayoutRules.CenterInParent); layout.SetMargins (20, 20, 20, 20); signature.BackgroundImageView.LayoutParameters = layout; // You can change paddings for positioning... var caption = signature.Caption; caption.SetPadding (caption.PaddingLeft, 1, caption.PaddingRight, 25); } // Get our button from the layout resource, // and attach an event to it Button btnSave = FindViewById<Button> (Resource.Id.btnSave); btnSave.Click += delegate { if (signature.IsBlank) {//Display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder (this); alert.SetMessage ("No signature to save."); alert.SetNeutralButton ("Okay", delegate { }); alert.Create ().Show (); } points = signature.Points; }; btnSave.Dispose (); Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad); btnLoad.Click += delegate { if (points != null) signature.LoadPoints (points); }; btnLoad.Dispose (); }
//function when keyboard is clicked private void ButtonClick(object sender, EventArgs e) { //the current button being pressed Button currentButton = (Button)sender; //play the game tvWord.Text = operation.GamePlay(currentButton.Text); if (tvWord.Text == "win") { alertDialog = new AlertDialog.Builder(this); alertDialog.SetCancelable(false); alertDialog.SetTitle("HangMan:"); alertDialog.SetMessage(operation.winMessage()); alertDialog.SetNeutralButton("Next Word", delegate { //when game wins //next round alertDialog.Dispose(); operation.RestartGame(); initGameScreen(); }); alertDialog.Show(); } //disable button currentButton.Enabled = false; //get how many tries the user has left to play switch (operation.getTries()) { case 0: imgHangMan.SetImageResource(Resource.Drawable.first); break; case 1: imgHangMan.SetImageResource(Resource.Drawable.second); break; case 2: imgHangMan.SetImageResource(Resource.Drawable.third); break; case 3: imgHangMan.SetImageResource(Resource.Drawable.fourth); break; case 4: imgHangMan.SetImageResource(Resource.Drawable.fifth); break; case 5: imgHangMan.SetImageResource(Resource.Drawable.sixth); break; case 6: imgHangMan.SetImageResource(Resource.Drawable.seventh); break; case 7: imgHangMan.SetImageResource(Resource.Drawable.eigth); break; case 8: imgHangMan.SetImageResource(Resource.Drawable.ninth); break; case 9: imgHangMan.SetImageResource(Resource.Drawable.lose); alertDialog = new AlertDialog.Builder(this); alertDialog.SetCancelable(false); alertDialog.SetTitle("HangMan:"); alertDialog.SetMessage("You have lost the game"); alertDialog.SetNeutralButton("Restart", delegate { //what to do when lost alertDialog.Dispose(); Database.AddPlayerScore(operation.getName(), operation.getScore()); operation.RestartGame(); operation.restartScore(); RestartGame(); }); alertDialog.Show(); break; } }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ingresoWidth); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); String _idconte = Intent.GetStringExtra(idcontenedor); String _contenedor = Intent.GetStringExtra(contenedor); TextView textViewWidth = FindViewById <TextView>(Resource.Id.textViewWidth); lblnombrerolloWidth = FindViewById <TextView>(Resource.Id.lblnombrerolloWidth); lblcodigotelaWidth = FindViewById <TextView>(Resource.Id.lblcodigotelaWidth); spinner1Width = FindViewById <Spinner>(Resource.Id.spinner1Width); txtsecuenciaRolloWidth = FindViewById <EditText>(Resource.Id.txtsecuenciaRolloWidth); txtWidth = FindViewById <EditText>(Resource.Id.txtWidth); lbltotalrollos = FindViewById <TextView>(Resource.Id.txttotalrollosW); btbguardarWidth = FindViewById <Button>(Resource.Id.btnguardarWidth); textViewWidth.Text = _contenedor; Enabled(false); Limpiartext(); txtsecuenciaRolloWidth.Enabled = false; listacodWidth = await Task.Run(() => CargaListas(int.Parse(_idconte))); var countItem = ListarollosWidth.Count; if (countItem < 1) { alert.Builder adb = new alert.Builder(this); adb.SetTitle("Advertencia!"); adb.SetMessage("Ya fueron medidos de ancho todos los rollos del contenedor"); adb.SetNeutralButton("Aceptar", (senderAlert, args) => { }); adb.SetPositiveButton("Buscar otro contenedor", (s, args) => { StartActivity(typeof(MainActivity)); // SetContentView(Resource.Layout.listaRollos); }); alert dialog = adb.Create(); dialog.Show(); } else { lbltotalrollos.Text = string.Concat("Total de rollos por medir: ", countItem.ToString()); } txtWidth.FocusChange += TxtWidth_FocusChange; spinner1Width.Adapter = new CodigosTelaAdapter(this, listacodWidth.OrderBy(x => x.Idtpc).ToList()); spinner1Width.ItemSelected += Spinner1Width_ItemSelected;; txtsecuenciaRolloWidth.AfterTextChanged += TxtsecuenciaRolloWidth_AfterTextChanged; btbguardarWidth.Click += BtbguardarWidth_Click; }