private void BComConnect_Click(object sender, EventArgs e)
 {
     CommForm commForm = new CommForm();
     DialogResult dialogResult = commForm.ShowDialog();
     if(dialogResult == DialogResult.OK)
     {
         bike = new Bike(commForm.getCommport);
        // modelLabel.Text = bike.GetModel();
         while(modelLabel.Text.Equals("ERROR") || modelLabel.Text.Equals(""))
             modelLabel.Text = bike.GetModel();
         //versionLabel.Text = bike.GetVersionNumber();
         while(versionLabel.Text.Equals("ERROR") || versionLabel.Text.Equals(""))
             versionLabel.Text = bike.GetVersionNumber();
         statusLabel.Text = bike.GetStatus();
         Thread refreshThread = new Thread(new ThreadStart(RefreshThread));
         refreshThread.IsBackground = true;
         refreshThread.Start();
     }
     commForm.Dispose();
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor of the bikeCommunication class.
 /// </summary>
 /// <param name="parent">The parent class.</param>
 public BikeCommunication(Bike parent)
 {
     this.parent         = parent;
     this.stillConnected = true;
     serialPort          = new SerialPort();
 }
Esempio n. 3
0
File: Client.cs Progetto: bemk/rhc
 private void virtualToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (bike == null || bike is PhysBike)
         bike = new VirtBike();
     setBike(bike);
 }
Esempio n. 4
0
File: Client.cs Progetto: bemk/rhc
 private void updateBike()
 {
     this.bike = new VirtBike(data.ElementAt(data.Count - 1).heartRate, data.ElementAt(data.Count - 1).RPM, data.ElementAt(data.Count - 1).speed, data.ElementAt(data.Count - 1).distance, data.ElementAt(data.Count - 1).power, data.ElementAt(data.Count - 1).energy, data.ElementAt(data.Count - 1).currentPower, data.ElementAt(data.Count - 1).time);
 }
Esempio n. 5
0
File: Client.cs Progetto: bemk/rhc
 private void setBike(Bike b)
 {
     if (b is PhysBike)
     {
         resetLabels();
         physicalToolStripMenuItem.Checked = true;
         virtualToolStripMenuItem.Checked = false;
         if(virtSettings != null)
             virtSettings.Close();
     }
     else if (b is VirtBike)
     {
         resetLabels();
         virtualToolStripMenuItem.Checked = true;
         physicalToolStripMenuItem.Checked = false;
         virtSettings = new VirtSettings((VirtBike)b, this);
         virtSettings.Show();
     }
 }
 /// <summary>
 /// Constructor of the bikeCommunication class.
 /// </summary>
 /// <param name="parent">The parent class.</param>
 public BikeCommunication(Bike parent)
 {
     this.parent = parent;
     this.stillConnected = true;
     serialPort = new SerialPort();
 }
Esempio n. 7
0
        private void BStartTraining_Click(object sender, EventArgs e)
        {
            if(bike == null)
            {
                bike = new Bike(3.ToString());
                // modelLabel.Text = bike.GetModel();
                while (modelLabel.Text.Equals("ERROR") || modelLabel.Text.Equals(""))
                    modelLabel.Text = bike.GetModel();
                //versionLabel.Text = bike.GetVersionNumber();
                while (versionLabel.Text.Equals("ERROR") || versionLabel.Text.Equals(""))
                    versionLabel.Text = bike.GetVersionNumber();
                statusLabel.Text = bike.GetStatus();
                Thread refreshThread = new Thread(new ThreadStart(RefreshThread));
                refreshThread.IsBackground = true;
                refreshThread.Start();
            }

            training = trainingen.newAstrand;
            Thread t = new Thread(new ThreadStart(Astrand));
            t.IsBackground = true;
            t.Start();
        }