Exemple #1
0
        private void startTraject()
        {
            patient = new Patient(naam);
            meetsessie = new Meetsessie(leeftijd, gewicht);
            patient.meetsessies.Add(meetsessie);
            int amount_of_seconds = (minutes * 60) + seconds;
            int sec_per_stap = amount_of_seconds / 10;
            int amount_per_stap = (maxPower - 25) / 10;

            int currentPower = 25;
            int tick = sec_per_stap;
            bicycle.sendData("CM");
            bicycle.sendData("PW " + currentPower);
            bicycle.sendData("CM");
            bicycle.sendData("PT " + Math.Floor(Convert.ToDecimal(amount_of_seconds / 60)) + ":" + Convert.ToDecimal(amount_of_seconds % 60));

            while (amount_of_seconds != 0)
            {
                bicycle.sendData(ConnectionToBicycle.STATUS);
                if (tick == 0)
                {
                    tick = sec_per_stap;
                    currentPower += amount_per_stap;
                    bicycle.sendData("CM");
                    bicycle.sendData("PW " + currentPower);
                    bicycle.sendData("CM");
                    bicycle.sendData("PT " + Math.Floor(Convert.ToDecimal(amount_of_seconds / 60)) + ":" + Convert.ToDecimal(amount_of_seconds % 60));

                }
                else tick--;
                Thread.Sleep(1000);
                amount_of_seconds--;
                Action min = () => patientScherm.Minutes.Value = Math.Floor(Convert.ToDecimal(amount_of_seconds / 60));
                patientScherm.WaarschuwingLabel.Invoke(min);
                Action sec = () => patientScherm.Seconds.Value = Convert.ToDecimal(amount_of_seconds % 60);
                patientScherm.WaarschuwingLabel.Invoke(sec);
            }
            Action pre = () => patientScherm.Stop_button.PerformClick();
            patientScherm.WaarschuwingLabel.Invoke(pre);
        }
Exemple #2
0
 private void MeetsessieBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     foreach (Patient patient in patients)
     {
         if (patient.naam == PatientBox.Text)
             foreach (Meetsessie sessie in patient.meetsessies)
             {
                 if (sessie.datum.ToString() == MeetsessieBox.Text)
                 {
                     selected_session = sessie;
                 }
             }
     }
 }