private void Aardappels_mOnafspraakConplete(object sender, OnAfspraakArgs e) { string Email = e.Email; string Date = e.Date; string Time = e.Tijd; string beschrijving = e.Beschrijving; //DataTable date = DBconnect.GrabData("select * from afspraken"); DBconnect.PushDataAfspraken(Time, Date, beschrijving, Email); }
void SignUpDialog_mOnSignUpComplete(object sender, OnSignUpEventArgs e) { mProgressBar.Visibility = ViewStates.Visible; Thread thread = new Thread(ActLikeARequest); thread.Start(); string FirstName = e.FirstName; string Email = e.Email; string Password = e.Password; string LastName = e.LastName; int leeftijd = e.Leeftijd; string bloedgroep = e.Bloedtype; DataTable data = DBconnect.GrabData("select * from Gebruiker"); var emailList = new List <string>(); foreach (DataRow row in data.Rows) { var EmailObject = row[1]; if (EmailObject != null) { emailList.Add(EmailObject.ToString()); } } bool available = DBconnect.CheckForAvailableEmail(emailList, e.Email); if (available) { DBconnect.PushDataAccount(FirstName, Email, Password, LastName, leeftijd, bloedgroep); } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle("Error"); alertDialog.SetMessage("Email is al in gebruik"); alertDialog.SetNeutralButton("OK", delegate { alertDialog.Dispose(); //Pull up dialog FragmentTransaction transaction = FragmentManager.BeginTransaction(); dialog_SignUp signUpDialog = new dialog_SignUp(); signUpDialog.Show(transaction, "dialog fragment"); signUpDialog.mOnSignUpComplete += SignUpDialog_mOnSignUpComplete; }); alertDialog.Show(); }; }
void signUpDialog_mOnSignUpComplete(object sender, OnSignUpEventArgs e) { mProgressBar.Visibility = ViewStates.Visible; Thread thread = new Thread(ActLikeARequest); thread.Start(); string FirstName = e.FirstName; string Email = e.Email; string Password = e.Password; string LastName = e.LastName; DBconnect.PushDataAccount(FirstName, Email, Password, LastName); }
public override StartCommandResult OnStartCommand(Intent intent, [GeneratedEnum] StartCommandFlags flags, int startId) { Log.Debug("Information", "Notification service Started"); Calendar calendar = Calendar.Instance; AlarmManager alarmManager = (AlarmManager)GetSystemService(AlarmService); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); string email = prefs.GetString("email", ""); string medicine = prefs.GetString("medicineName", ""); string query = "select [tijd],[ringtoneid] from Melding where email = '" + email + "' and medicijn = '" + medicine + "'; "; DataTable Data = DBconnect.GrabData(query); int idIndex = 0; foreach (DataRow row in Data.Rows) { TimeSpan time = (TimeSpan)row[0]; int ringToneId = (int)row[1]; calendar.Set(Calendar.HourOfDay, time.Hours); calendar.Set(Calendar.Minute, time.Minutes); calendar.Set(Calendar.Second, time.Seconds); Intent myIntent = new Intent(this, typeof(NotificationReceiver)); pendingIntent = PendingIntent.GetBroadcast(this, idIndex, myIntent, 0); alarmManager.SetRepeating(AlarmType.RtcWakeup, calendar.TimeInMillis, 24 * 60 * 60 * 1000, pendingIntent); // after a day idIndex++; //24 * 60 * 60 * } //calendar.set(Calendar.MONTH, 8); //calendar.set(Calendar.YEAR, 2016) //calendar.set(Calendar.DAY_OF_MONTH, 18); // calendar.Set(Calendar.HourOfDay, 0); // calendar.Set(Calendar.Minute, 8); // calendar.Set(Calendar.Second, 0); // // // Intent myIntent = new Intent(this, typeof(NotificationReceiver)); //pendingIntent = PendingIntent.GetBroadcast(this, 0, myIntent,0); //AlarmManager alarmManager = (AlarmManager) GetSystemService(AlarmService); //alarmManager.SetRepeating(AlarmType.Rtc, calendar.TimeInMillis,10000, pendingIntent); return(base.OnStartCommand(intent, flags, startId)); }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.profielscherm); Bewerk = FindViewById <Button>(Resource.Id.bewerk); Naam = FindViewById <TextView>(Resource.Id.naam); Email = FindViewById <TextView>(Resource.Id.email); Bloedtype = FindViewById <TextView>(Resource.Id.bloedgroep); profiel = DBconnect.Get_Profile(EmailLogin); Naam.Text = "Naam: " + profiel[0] + " " + profiel[1]; Email.Text = "Email: " + profiel[2]; Bloedtype.Text = "Bloedtype: " + profiel[3]; }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.voorraadScherm); mRegisterMedic = FindViewById <Button>(Resource.Id.Medicijn_Toe); //mbtnMelding = FindViewById<Button>(Resource.Id.button1); listnames = FindViewById <ListView>(Resource.Id.ListviewMED); itemlist = DBconnect.GetList("Select * from Medicijn where email = @email", 0, EmailLogin); mRegisterMedic.Click += MRegisterMedic_Click; ArrayAdapter <string> new_adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, itemlist); listnames.Adapter = new_adapter; listnames.InvalidateViews(); listnames.ItemClick += mbtnMelding_Click; }
protected override void OnCreate(Bundle savedInstanceState) { //RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Home); listnames = FindViewById <ListView>(Resource.Id.Listview); itemlist = DBconnect.GetList("Select medicijn from Melding where email = @email ", 0, EmailLogin); mbtnAfspraken = FindViewById <Button>(Resource.Id.afspraken); Profile = FindViewById <Button>(Resource.Id.user); Voorraad = FindViewById <Button>(Resource.Id.supplies); mbtnAfspraken.Click += MbtnAfspraken_Click; Profile.Click += Profile_Click; Voorraad.Click += Voorraad_Click; ArrayAdapter <string> new_adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, itemlist); listnames.Adapter = new_adapter; listnames.InvalidateViews(); }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.afspraken); listnames = FindViewById <ListView>(Resource.Id.ListviewAfspraken); itemlist = DBconnect.GetList("select * from Afspraken where email = @email", 0, EmailLogin); ArrayAdapter <string> new_adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, itemlist); listnames.Adapter = new_adapter; mbtnAfspraken = FindViewById <Button>(Resource.Id.afspraken); mbtnAfspraken.Click += (object sender, EventArgs e) => { FragmentTransaction transaction = FragmentManager.BeginTransaction(); dialog_afspraken aardappels = new dialog_afspraken(); aardappels.Show(transaction, "dialog afspraken"); aardappels.mOnafspraakConplete += Aardappels_mOnafspraakConplete; }; }
void medicijnenscherm_mOnMedicComplete(object sender, OnMedicEventArgs e) { /// Hier moegt nog aan gewerkt worden string Email = Checked_email.ElementAt(0); DBconnect.PushDataMedicijn(e.Medicijn, 0, e.Bijsluiter, 0, "", Email); }
void LogInDialog_mOnLogInComplete(object sender, OnLogInEventArgs e) { mProgressBar.Visibility = ViewStates.Visible; Thread thread = new Thread(ActLikeARequest); thread.Start(); DataTable data = DBconnect.GrabData("select * from Gebruiker"); var emailList = new List <string>(); foreach (DataRow row in data.Rows) { var EmailObject = row[1]; if (EmailObject != null) { emailList.Add(EmailObject.ToString()); } } // hier word gecheckt of de email bestaat zo niet dan krijg je een error te zien bool available = DBconnect.CheckForAvailableEmail(emailList, e.Email); if (!available) { //check hier of wachtwoord klopt met email if (DBconnect.PullDataLoginAndCompare(e.Email, e.Password)) { EmailLogin = e.Email; Checked_email.Add(e.Email); Intent home = new Intent(this, typeof(Homescreen)); this.StartActivity(home); Toast.MakeText(this, "Inloggen Gelukt!", ToastLength.Long).Show(); } else { AlertDialog.Builder WachtwoordDialog = new AlertDialog.Builder(this); WachtwoordDialog.SetTitle("Error"); WachtwoordDialog.SetMessage("Email of Wachtwoord, bestaat niet"); WachtwoordDialog.SetNeutralButton("OK", delegate { FragmentTransaction transaction2 = FragmentManager.BeginTransaction(); Dialog_Login aardappel = new Dialog_Login(); aardappel.Show(transaction2, "potato fragment"); aardappel.mOnLogInComplete += LogInDialog_mOnLogInComplete; }); WachtwoordDialog.Show(); } } // dit is de error die je ziet als je email niet klopt else { AlertDialog.Builder WachtwoordDialog = new AlertDialog.Builder(this); WachtwoordDialog.SetTitle("Error"); WachtwoordDialog.SetMessage("Email of Wachtwoord, bestaat niet"); WachtwoordDialog.SetNeutralButton("OK", delegate { FragmentTransaction transaction2 = FragmentManager.BeginTransaction(); Dialog_Login aardappel = new Dialog_Login(); aardappel.Show(transaction2, "potato fragment"); aardappel.mOnLogInComplete += LogInDialog_mOnLogInComplete; }); WachtwoordDialog.Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Melding); intent = new Intent(this, typeof(NotificationService)); StartService(intent); mTxtTime = FindViewById <EditText>(Resource.Id.textView2); radioButton1 = FindViewById <RadioButton>(Resource.Id.radioButton1); radioButton2 = FindViewById <RadioButton>(Resource.Id.radioButton2); radioButton3 = FindViewById <RadioButton>(Resource.Id.radioButton3); radioButton1.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; ImageButton imageButton1 = FindViewById <ImageButton>(Resource.Id.imageButton1); ImageButton imageButton2 = FindViewById <ImageButton>(Resource.Id.imageButton2); ImageButton imageButton3 = FindViewById <ImageButton>(Resource.Id.imageButton3); ImageButton imageButton4 = FindViewById <ImageButton>(Resource.Id.imageButton4); ImageButton imageButton5 = FindViewById <ImageButton>(Resource.Id.imageButton5); ImageButton imageButton6 = FindViewById <ImageButton>(Resource.Id.imageButton6); imageButton1.Click += ImageClick1; imageButton2.Click += ImageClick2; imageButton3.Click += ImageClick3; imageButton4.Click += ImageClickStop; imageButton5.Click += ImageClickStop; imageButton6.Click += ImageClickStop; mTxtTime.Click += mTxtTime_Click; DataTable data = DBconnect.GrabData("select * from Melding"); // Set our view from the "main" layout resource Button button2 = FindViewById <Button>(Resource.Id.button2); button2.Click += ButtonOnClick; void ButtonOnClick(object sender, EventArgs eventArgs) { // Database update // We have to update or insert new time and date // full control is in database => if we update databse, we get notification in app for the updated time ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); String email = prefs.GetString("email", "*****@*****.**"); String medicijn = prefs.GetString("medicineName", ""); ISharedPreferencesEditor editor = prefs.Edit(); editor.PutInt("ringtoneidnr", ringtoneid); editor.Apply(); RadioButton rb = null; if (radioButton1.Checked == true) { rb = radioButton1; ringtoneid = 1; } else if (radioButton2.Checked == true) { rb = radioButton2; ringtoneid = 2; } else if (radioButton3.Checked == true) { rb = radioButton3; ringtoneid = 3; } DBconnect.PushDataMelding(mTxtTime.Text, email, ringtoneid, medicijn); StopService(new Intent(this, typeof(NotificationService))); StartService(new Intent(this, typeof(NotificationService))); // DBconnect insert values in Melding table // Pass the current button press count value to the next activity: //Bundle valuesForActivity = new Bundle(); //valuesForActivity.PutInt("count", count); //valuesForActivity.PutString("name", "Rose"); //ISharedPreferencesEditor editor = prefs.Edit(); //editor.PutInt("count", count); //editor.PutString("name", "Rose"); //editor.Apply(); // When the user clicks the notification, SecondActivity will start up. //Intent resultIntent = new Intent(this, typeof(MeldingErna)); //// Pass some values to SecondActivity: //// resultIntent.PutExtras(valuesForActivity); //// Construct a back stack for cross-task navigation: //TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this); //stackBuilder.AddParentStack(Java.Lang.Class.FromType(typeof(MeldingErna))); //stackBuilder.AddNextIntent(resultIntent); //// Create the PendingIntent with the back stack: //PendingIntent resultPendingIntent = // stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent); //long[] vibrate = new long[] { 1000, 1000, 1000, 1000, 1000 }; //// Build the notification: This is required to show notification //NotificationCompat.Builder builder = new NotificationCompat.Builder(this) // .SetAutoCancel(true) // Dismiss from the notif. area when clicked // .SetContentIntent(resultPendingIntent) // Start 2nd activity when the intent is clicked. // .SetContentTitle("Button Clicked") // Set its title // .SetVibrate(vibrate) // .SetNumber(count) // Display the count in the Content Info // .SetSmallIcon(Resource.Drawable.Icon) // Display this icon // .SetContentText(String.Format( // "The button has been clicked {0} times.", count)); // The message to display. //// Finally, publish the notification: //NotificationManager notificationManager = // (NotificationManager)GetSystemService(Context.NotificationService); //notificationManager.Notify(ButtonClickNotificationId, builder.Build()); // Increment the button press count: //count++; } //void onDateSet(object sender, DatePickerDialog.DateSetEventArgs e) //{ // // TODO Auto-generated method stub // int month = e.Month + 1; // mTxtDate.Text = month.ToString() + "/" + e.DayOfMonth.ToString() + "/" + e.Year.ToString(); //} void onTimeSet(object sender, TimePickerDialog.TimeSetEventArgs e) { // TODO Auto-generated method stub int hour = e.HourOfDay; int minutes = e.Minute; String aTime = hour.ToString() + ":" + minutes.ToString(); mTxtTime.Text = aTime; } //void mTxtDate_Click(object sender, EventArgs e) //{ // //User has clicked the edit text // DateTime today = DateTime.Today; // DatePickerDialog dialog = new DatePickerDialog(this, onDateSet, today.Year, today.Month - 1, today.Day); // dialog.Show(); //} void mTxtTime_Click(object sender, EventArgs e) { //User has clicked the edit text DateTime today = DateTime.Today; TimePickerDialog dialog = new TimePickerDialog(this, onTimeSet, today.Hour, today.Minute, true); dialog.Show(); } void ImageClick1(object sender, EventArgs e) { //player1 = MediaPlayer.Create(this, Resource.Raw.ialarm); //player1.Start(); //player1. if (mPlayer != null && mPlayer.IsPlaying) { mPlayer.Stop(); } radioButton1.Checked = true; radioButton2.Checked = false; radioButton3.Checked = false; mPlayer = MediaPlayer.Create(this, Resource.Raw.ialarm); mPlayer.Start(); } void ImageClick2(object sender, EventArgs e) { //player2 = MediaPlayer.Create(this, Resource.Raw.radar); //player2.Start(); if (mPlayer != null && mPlayer.IsPlaying) { mPlayer.Stop(); } radioButton1.Checked = false; radioButton2.Checked = true; radioButton3.Checked = false; mPlayer = MediaPlayer.Create(this, Resource.Raw.radar); mPlayer.Start(); } void ImageClick3(object sender, EventArgs e) { //player3 = MediaPlayer.Create(this, Resource.Raw.sunalarm); //player3.Start(); if (mPlayer != null && mPlayer.IsPlaying) { mPlayer.Stop(); } radioButton1.Checked = false; radioButton2.Checked = false; radioButton3.Checked = true; mPlayer = MediaPlayer.Create(this, Resource.Raw.sunalarm); mPlayer.Start(); } void ImageClickStop(object sender, EventArgs e) { //player1 = MediaPlayer.Create(this, Resource.Raw.ialarm); //player2 = MediaPlayer.Create(this, Resource.Raw.radar); //player3 = MediaPlayer.Create(this, Resource.Raw.sunalarm); ////player.Start(); //if ((player1.IsPlaying == false) || (player2.IsPlaying == false) || (player3.IsPlaying == false)) //{ // player1.Stop(); //} //else if ((player1.IsPlaying == true) || (player2.IsPlaying == true) || (player3.IsPlaying == true)) //{ // player1.Stop(); //} //else ////player1.Stop(); ////player1.Stop(); ////player2.Stop(); ////player3.Stop(); //if (radioButton1.Checked == true) //{ // player1.Stop(); //} //else if (radioButton2.Checked == true) //{ // player1.Stop(); //} //else if (radioButton3.Checked == true) //{ // player1.Stop(); //} if (mPlayer != null && mPlayer.IsPlaying) { mPlayer.Stop(); } } }