protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Toevoegen); // capture our View elements dateDisplay = FindViewById<TextView> (Resource.Id.DatumTekst); pickDate = FindViewById<Button> (Resource.Id.pickDate); btnSave = FindViewById<Button> (Resource.Id.btnSave); art = FindViewById<EditText> (Resource.Id.ArtiestTekst); lnd = FindViewById<EditText> (Resource.Id.LandTekst); plts = FindViewById<EditText> (Resource.Id.PlaatsTekst); zl = FindViewById<EditText> (Resource.Id.ZaalTekst); sp = FindViewById<Spinner> (Resource.Id.SpinnerMuzieksoort); dtm = FindViewById<EditText> (Resource.Id.DatumTekst); opm = FindViewById<EditText> (Resource.Id.OpmerkingTekst); // add a click event handler to the button pickDate.Click += delegate { ShowDialog (DATE_DIALOG_ID); }; // get the current date date = DateTime.Today; // display the current date (this method is below) UpdateDisplay (); sp.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (sp_ItemSelected); var adapter = ArrayAdapter.CreateFromResource ( this, Resource.Array.genre_array, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); sp.Adapter = adapter; // Click event voor het opslaan van de data btnSave.Click += (object IntentSender, EventArgs e) => { ConcertenDB cdb = new ConcertenDB(); Concerten dataInput = new Concerten(); dataInput.Artiest = art.Text.ToString(); dataInput.Land = lnd.Text.ToString(); dataInput.Plaats = plts.Text.ToString(); dataInput.Zaal = zl.Text.ToString(); dataInput.Muzieksoort = sp.SelectedItem.ToString(); dataInput.Datum = DateTime.Parse(dtm.Text); dataInput.Opmerking = opm.Text.ToString(); // Refreshen van de input velden en melding tonen na succesvol invoeren van data if(cdb.insertUpdateData(dataInput)) { Toast.MakeText(this, "Je gegevens zijn succesvol toegevoegd!", ToastLength.Long).Show(); art.Text = ""; lnd.Text = ""; plts.Text = ""; zl.Text = ""; sp.SelectedItem.Dispose(); dtm.Text = DateTime.Now.ToString(); opm.Text = ""; } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Overzicht); lv = FindViewById<ListView> (Resource.Id.lvConcerten); sv = FindViewById<EditText> (Resource.Id.txtZoeken); del = FindViewById<EditText> (Resource.Id.txtVerwijderen); ConcertenDB csdb = new ConcertenDB (); adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1, ConcertenDB.alleRijen (csdb.db)); lv.Adapter = adapter; // Verwijderen van row nadat er een ID is ingevuld lv.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { Toast.MakeText(this, e.Position.ToString(), ToastLength.Short).Show(); Concerten cs = new Concerten(); if (del.Text != "") { int positie = Convert.ToInt16(del.Text); csdb.DeleteRecord(positie); } }; sv.TextChanged += InputSearchTextChanged; }