diff --git a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo index 5df19c5..0620cff 100644 Binary files a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo and b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo differ diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs b/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs index c71e80b..46db67c 100644 --- a/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs +++ b/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs @@ -43,6 +43,8 @@ namespace ErgometerApplication this.timeButton = new System.Windows.Forms.Button(); this.energyButton = new System.Windows.Forms.Button(); this.distanceButton = new System.Windows.Forms.Button(); + this.saveTimer = new System.Windows.Forms.Timer(this.components); + this.writeTimer = new System.Windows.Forms.Timer(this.components); this.SuspendLayout(); // // richTextBox1 @@ -67,11 +69,15 @@ namespace ErgometerApplication // ComPortBox // this.ComPortBox.FormattingEnabled = true; - this.ComPortBox.Items.AddRange(SerialPort.GetPortNames()); + this.ComPortBox.Items.AddRange(new object[] { + "CNCA0", + "CNCB0", + "COM3", + "COM4"}); this.ComPortBox.Location = new System.Drawing.Point(12, 291); this.ComPortBox.Name = "ComPortBox"; this.ComPortBox.Size = new System.Drawing.Size(97, 24); - this.ComPortBox.SelectedItem = 1; + this.ComPortBox.TabIndex = 11; // // statusButton // @@ -203,5 +209,7 @@ namespace ErgometerApplication private System.Windows.Forms.Button timeButton; private System.Windows.Forms.Button energyButton; private System.Windows.Forms.Button distanceButton; + private System.Windows.Forms.Timer saveTimer; + private System.Windows.Forms.Timer writeTimer; } } diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.cs b/ErgometerApplication/ErgometerApplication/Ergometer.cs index fd50c13..16f42f3 100644 --- a/ErgometerApplication/ErgometerApplication/Ergometer.cs +++ b/ErgometerApplication/ErgometerApplication/Ergometer.cs @@ -15,7 +15,8 @@ namespace ErgometerApplication public partial class Ergometer : Form { private ComPort comPort; - + private Meting schrijfweg; + private List _data; public Ergometer() { InitializeComponent(); @@ -154,12 +155,54 @@ namespace ErgometerApplication { statusButton.Enabled = false; updateTimer.Start(); + saveTimer.Start(); + writeTimer.Start(); } else { statusButton.Enabled = true; updateTimer.Stop(); + saveTimer.Stop(); + writeTimer.Stop(); } } + + private void saveTimer_Tick(object sender, EventArgs e) + { + saveData(schrijfweg); + } + + private void writeFile() + { + + string json = JsonConvert.SerializeObject(_data.ToArray()); + + System.IO.File.WriteAllText(@Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "//path.ergo", json); + } + private void saveData(Meting meting) + { + _data = new List(); + _data.Add(new Meting() + { + HeartBeat = schrijfweg.HeartBeat, + RPM = schrijfweg.RPM, + Speed = schrijfweg.Speed, + Distance = schrijfweg.Distance, + Power = schrijfweg.Power, + Energy = schrijfweg.Energy, + Seconds = schrijfweg.Seconds, + ActualPower = schrijfweg.ActualPower + }); + } + + private void writeTimer_Tick(object sender, EventArgs e) + { + writeFile(); + } + + private void Ergometer_Load(object sender, EventArgs e) + { + + } } } \ No newline at end of file diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.resx b/ErgometerApplication/ErgometerApplication/Ergometer.resx new file mode 100644 index 0000000..67b00e8 --- /dev/null +++ b/ErgometerApplication/ErgometerApplication/Ergometer.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 160, 17 + + + 285, 17 + + \ No newline at end of file diff --git a/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj b/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj index e72cd80..de8ff05 100644 --- a/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj +++ b/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj @@ -57,6 +57,9 @@ + + Ergometer.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/ErgometerApplication/ErgometerApplication/Meting.cs b/ErgometerApplication/ErgometerApplication/Meting.cs index 6c88117..656fa3f 100644 --- a/ErgometerApplication/ErgometerApplication/Meting.cs +++ b/ErgometerApplication/ErgometerApplication/Meting.cs @@ -6,16 +6,16 @@ using System.Threading.Tasks; namespace ErgometerApplication { - class Meting + public class Meting { - public int HeartBeat { get; } - public int RPM { get; } - public double Speed { get; } - public double Distance { get; } - public int Power { get; } - public int Energy { get; } - public int Seconds { get; } - public int ActualPower { get; } + public int HeartBeat { get; set; } + public int RPM { get; set; } + public double Speed { get; set; } + public double Distance { get; set; } + public int Power { get; set; } + public int Energy { get; set; } + public int Seconds { get; set; } + public int ActualPower { get; set; } public Meting(int heartbeat, int rpm, double speed, double distance, int power, int energy, int seconds, int actualpower) { @@ -28,7 +28,10 @@ namespace ErgometerApplication Seconds = seconds; ActualPower = actualpower; } + public Meting() + { + } public override string ToString() { string temp = ""; diff --git a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerApplication.vshost.exe.manifest b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerApplication.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerApplication.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ErgometerApplication/ErgometerApplication/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ErgometerApplication/ErgometerApplication/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 99638d1..664d167 100644 Binary files a/ErgometerApplication/ErgometerApplication/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/ErgometerApplication/ErgometerApplication/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csproj.FileListAbsolute.txt b/ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csproj.FileListAbsolute.txt index 98090cc..e0dd5a5 100644 --- a/ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csproj.FileListAbsolute.txt +++ b/ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csproj.FileListAbsolute.txt @@ -7,3 +7,5 @@ C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\Ergome C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb +C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe +C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb