示例#1
0
 private void ProcessCommand(string command)
 {
     if (command.Length < 2)
     {
         return;
     }
     if (command.Substring(0, 2) == "ST")
     {
         replyBoxText.Clear();
         ErgometerData ergometerData = ergometer.GetData();
         replyBoxText.Text = ergometerData.ToString();
     }
     else if (command.Substring(0, 2) == "PW")
     {
         ergometer.SetPower(Convert.ToInt32(command.Substring(2)));
     }
     else if (command.Substring(0, 2) == "PD")
     {
         ergometer.SetDistance(Convert.ToInt32(command.Substring(2)));
     }
     else if (command.Substring(0, 2) == "PT")
     {
         ergometer.SetTime(Convert.ToInt32(command.Substring(2)));
     }
     else if (command.Substring(0, 2) == "CM")
     {
         ergometer.ErgometerCommandMode();
     }
     else if (command.Substring(0, 2) == "RS")
     {
         ergometer.Reset();
     }
 }
示例#2
0
 private void Data_Collector_Click(object sender, EventArgs e)
 {
     if (ergometer.IsConnected())
     {
         replyBoxText.Clear();
         ErgometerData ergometerData = ergometer.GetData();
         if (ergometerData != null)
         {
             replyBoxText.Text = ergometerData.ToString();
         }
     }
 }