Added the ability to set some values of the Simulator.

This commit is contained in:
Aareschluchtje
2015-09-11 15:40:38 +02:00
parent beda8c50e2
commit dbc3b886a7
2 changed files with 25 additions and 4 deletions
@@ -39,7 +39,30 @@ namespace ErgometerSimulator
default:
break;
}
if (input.StartsWith("PT"))
{
dg.Time.currentvalue = int.Parse(input.Substring(3, 2)) * 60 + int.Parse(input.Substring(5, 2));
dg.Time.value1 = int.Parse(input.Substring(3,2)) * 60 + int.Parse(input.Substring(5,2));
Console.WriteLine(dg.Time.currentvalue);
}
else if (input.StartsWith("PD"))
{
dg.Distance.currentvalue = int.Parse(input.Substring(3));
dg.Distance.value1 = int.Parse(input.Substring(3));
Console.WriteLine(dg.Distance.currentvalue);
}
else if (input.StartsWith("PW"))
{
dg.Power.currentvalue = int.Parse(input.Substring(3));
dg.Power.value1 = int.Parse(input.Substring(3));
Console.WriteLine(dg.Power.currentvalue);
}
else if (input.StartsWith("PE"))
{
dg.Energy.currentvalue = int.Parse(input.Substring(3));
dg.Energy.value1 = int.Parse(input.Substring(3));
Console.WriteLine(dg.Energy.currentvalue);
}
return response;
}
}
@@ -96,9 +96,7 @@ namespace ErgometerSimulator
// ComPortBox
//
this.ComPortBox.FormattingEnabled = true;
this.ComPortBox.Items.AddRange(new object[] {
"COM8",
"COM9"});
this.ComPortBox.Items.AddRange(SerialPort.GetPortNames());
this.ComPortBox.Location = new System.Drawing.Point(15, 308);
this.ComPortBox.Name = "ComPortBox";
this.ComPortBox.Size = new System.Drawing.Size(121, 24);