From 350a28cd8349c8c4b3c48b5534a860324f797ec1 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Thu, 17 Sep 2015 16:34:34 +0200 Subject: [PATCH] Change structure, bugfixes, change file saving. --- .../.vs/ErgometerApplication/v14/.suo | Bin 55296 -> 65024 bytes .../Ergometer.Designer.cs | 150 ++++++++++-------- .../ErgometerApplication/Ergometer.cs | 147 ++++++++--------- .../ErgometerApplication/Ergometer.resx | 5 +- .../ErgometerApplication/FormatHelper.cs | 2 +- .../ErgometerApplication/Meting.cs | 4 +- 6 files changed, 158 insertions(+), 150 deletions(-) diff --git a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo index b56e9c71c98eaacc2b2d54aa3cf72dace39a134e..104d76594a09b4a2f858564b7ca48a4ba8bf7650 100644 GIT binary patch delta 5302 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 DCOLiy diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs b/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs index 869d1f8..eb8dabb 100644 --- a/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs +++ b/ErgometerApplication/ErgometerApplication/Ergometer.Designer.cs @@ -43,27 +43,28 @@ 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.button3 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); + this.metingNextButton = new System.Windows.Forms.Button(); + this.metingBackButton = new System.Windows.Forms.Button(); + this.readButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // richTextBox1 // - this.richTextBox1.Location = new System.Drawing.Point(13, 42); + this.richTextBox1.Location = new System.Drawing.Point(10, 34); + this.richTextBox1.Margin = new System.Windows.Forms.Padding(2); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.ReadOnly = true; - this.richTextBox1.Size = new System.Drawing.Size(203, 243); + this.richTextBox1.Size = new System.Drawing.Size(153, 198); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // // connectButton // - this.connectButton.Location = new System.Drawing.Point(115, 291); + this.connectButton.Location = new System.Drawing.Point(86, 236); + this.connectButton.Margin = new System.Windows.Forms.Padding(2); this.connectButton.Name = "connectButton"; - this.connectButton.Size = new System.Drawing.Size(101, 26); + this.connectButton.Size = new System.Drawing.Size(76, 21); this.connectButton.TabIndex = 1; this.connectButton.Text = "Connect"; this.connectButton.UseVisualStyleBackColor = true; @@ -73,21 +74,21 @@ namespace ErgometerApplication // this.ComPortBox.FormattingEnabled = true; this.ComPortBox.Items.AddRange(new object[] { - "CNCA0", - "CNCB0", - "COM3", - "COM4"}); - this.ComPortBox.Location = new System.Drawing.Point(12, 291); + "COM8", + "COM9"}); + this.ComPortBox.Location = new System.Drawing.Point(9, 236); + this.ComPortBox.Margin = new System.Windows.Forms.Padding(2); this.ComPortBox.Name = "ComPortBox"; - this.ComPortBox.Size = new System.Drawing.Size(97, 24); + this.ComPortBox.Size = new System.Drawing.Size(74, 21); this.ComPortBox.TabIndex = 11; // // statusButton // this.statusButton.Enabled = false; - this.statusButton.Location = new System.Drawing.Point(127, 12); + this.statusButton.Location = new System.Drawing.Point(95, 10); + this.statusButton.Margin = new System.Windows.Forms.Padding(2); this.statusButton.Name = "statusButton"; - this.statusButton.Size = new System.Drawing.Size(89, 26); + this.statusButton.Size = new System.Drawing.Size(67, 21); this.statusButton.TabIndex = 3; this.statusButton.Text = "Status"; this.statusButton.UseVisualStyleBackColor = true; @@ -96,9 +97,10 @@ namespace ErgometerApplication // resetButton // this.resetButton.Enabled = false; - this.resetButton.Location = new System.Drawing.Point(12, 12); + this.resetButton.Location = new System.Drawing.Point(9, 10); + this.resetButton.Margin = new System.Windows.Forms.Padding(2); this.resetButton.Name = "resetButton"; - this.resetButton.Size = new System.Drawing.Size(97, 26); + this.resetButton.Size = new System.Drawing.Size(73, 21); this.resetButton.TabIndex = 4; this.resetButton.Text = "Reset"; this.resetButton.UseVisualStyleBackColor = true; @@ -113,9 +115,10 @@ namespace ErgometerApplication // this.timerStatus.AutoSize = true; this.timerStatus.Enabled = false; - this.timerStatus.Location = new System.Drawing.Point(223, 12); + this.timerStatus.Location = new System.Drawing.Point(167, 10); + this.timerStatus.Margin = new System.Windows.Forms.Padding(2); this.timerStatus.Name = "timerStatus"; - this.timerStatus.Size = new System.Drawing.Size(113, 21); + this.timerStatus.Size = new System.Drawing.Size(88, 17); this.timerStatus.TabIndex = 5; this.timerStatus.Text = "Auto Refresh"; this.timerStatus.UseVisualStyleBackColor = true; @@ -124,17 +127,19 @@ namespace ErgometerApplication // inputTextBox // this.inputTextBox.Enabled = false; - this.inputTextBox.Location = new System.Drawing.Point(223, 42); + this.inputTextBox.Location = new System.Drawing.Point(167, 34); + this.inputTextBox.Margin = new System.Windows.Forms.Padding(2); this.inputTextBox.Name = "inputTextBox"; - this.inputTextBox.Size = new System.Drawing.Size(113, 22); + this.inputTextBox.Size = new System.Drawing.Size(86, 20); this.inputTextBox.TabIndex = 6; // // powerButton // this.powerButton.Enabled = false; - this.powerButton.Location = new System.Drawing.Point(223, 134); + this.powerButton.Location = new System.Drawing.Point(167, 109); + this.powerButton.Margin = new System.Windows.Forms.Padding(2); this.powerButton.Name = "powerButton"; - this.powerButton.Size = new System.Drawing.Size(113, 26); + this.powerButton.Size = new System.Drawing.Size(85, 21); this.powerButton.TabIndex = 7; this.powerButton.Text = "Set Power"; this.powerButton.UseVisualStyleBackColor = true; @@ -143,9 +148,10 @@ namespace ErgometerApplication // timeButton // this.timeButton.Enabled = false; - this.timeButton.Location = new System.Drawing.Point(223, 70); + this.timeButton.Location = new System.Drawing.Point(167, 57); + this.timeButton.Margin = new System.Windows.Forms.Padding(2); this.timeButton.Name = "timeButton"; - this.timeButton.Size = new System.Drawing.Size(113, 26); + this.timeButton.Size = new System.Drawing.Size(85, 21); this.timeButton.TabIndex = 8; this.timeButton.Text = "Set Time"; this.timeButton.UseVisualStyleBackColor = true; @@ -154,9 +160,10 @@ namespace ErgometerApplication // energyButton // this.energyButton.Enabled = false; - this.energyButton.Location = new System.Drawing.Point(223, 166); + this.energyButton.Location = new System.Drawing.Point(167, 135); + this.energyButton.Margin = new System.Windows.Forms.Padding(2); this.energyButton.Name = "energyButton"; - this.energyButton.Size = new System.Drawing.Size(113, 26); + this.energyButton.Size = new System.Drawing.Size(85, 21); this.energyButton.TabIndex = 9; this.energyButton.Text = "Set Energy"; this.energyButton.UseVisualStyleBackColor = true; @@ -165,54 +172,63 @@ namespace ErgometerApplication // distanceButton // this.distanceButton.Enabled = false; - this.distanceButton.Location = new System.Drawing.Point(223, 102); + this.distanceButton.Location = new System.Drawing.Point(167, 83); + this.distanceButton.Margin = new System.Windows.Forms.Padding(2); this.distanceButton.Name = "distanceButton"; - this.distanceButton.Size = new System.Drawing.Size(113, 26); + this.distanceButton.Size = new System.Drawing.Size(85, 21); this.distanceButton.TabIndex = 10; this.distanceButton.Text = "Set Distance"; this.distanceButton.UseVisualStyleBackColor = true; this.distanceButton.Click += new System.EventHandler(this.distanceButton_Click); // - // button3 + // writeTimer // - this.button3.Enabled = false; - this.button3.Location = new System.Drawing.Point(224, 268); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(110, 27); - this.button3.TabIndex = 16; - this.button3.Text = "next"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); + this.writeTimer.Interval = 10000; + this.writeTimer.Tick += new System.EventHandler(this.writeTimer_Tick); // - // button2 + // metingNextButton // - this.button2.Enabled = false; - this.button2.Location = new System.Drawing.Point(223, 233); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(113, 29); - this.button2.TabIndex = 15; - this.button2.Text = "back"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); + this.metingNextButton.Enabled = false; + this.metingNextButton.Location = new System.Drawing.Point(167, 235); + this.metingNextButton.Margin = new System.Windows.Forms.Padding(2); + this.metingNextButton.Name = "metingNextButton"; + this.metingNextButton.Size = new System.Drawing.Size(85, 21); + this.metingNextButton.TabIndex = 16; + this.metingNextButton.Text = "Next ->"; + this.metingNextButton.UseVisualStyleBackColor = true; + this.metingNextButton.Click += new System.EventHandler(this.metingNextButton_Click); // - // button1 + // metingBackButton // - this.button1.Location = new System.Drawing.Point(221, 198); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(113, 29); - this.button1.TabIndex = 17; - this.button1.Text = "Read File"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.metingBackButton.Enabled = false; + this.metingBackButton.Location = new System.Drawing.Point(167, 210); + this.metingBackButton.Margin = new System.Windows.Forms.Padding(2); + this.metingBackButton.Name = "metingBackButton"; + this.metingBackButton.Size = new System.Drawing.Size(85, 21); + this.metingBackButton.TabIndex = 15; + this.metingBackButton.Text = "<- Back"; + this.metingBackButton.UseVisualStyleBackColor = true; + this.metingBackButton.Click += new System.EventHandler(this.metingBackButton_Click); + // + // readButton + // + this.readButton.Location = new System.Drawing.Point(167, 185); + this.readButton.Margin = new System.Windows.Forms.Padding(2); + this.readButton.Name = "readButton"; + this.readButton.Size = new System.Drawing.Size(85, 21); + this.readButton.TabIndex = 17; + this.readButton.Text = "Read File"; + this.readButton.UseVisualStyleBackColor = true; + this.readButton.Click += new System.EventHandler(this.readButton_Click); // // Ergometer // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(351, 328); - this.Controls.Add(this.button1); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); + this.ClientSize = new System.Drawing.Size(265, 273); + this.Controls.Add(this.readButton); + this.Controls.Add(this.metingNextButton); + this.Controls.Add(this.metingBackButton); this.Controls.Add(this.distanceButton); this.Controls.Add(this.energyButton); this.Controls.Add(this.timeButton); @@ -224,8 +240,9 @@ namespace ErgometerApplication this.Controls.Add(this.ComPortBox); this.Controls.Add(this.connectButton); this.Controls.Add(this.richTextBox1); - this.MaximumSize = new System.Drawing.Size(369, 375); - this.MinimumSize = new System.Drawing.Size(369, 375); + this.Margin = new System.Windows.Forms.Padding(2); + this.MaximumSize = new System.Drawing.Size(281, 312); + this.MinimumSize = new System.Drawing.Size(281, 312); this.Name = "Ergometer"; this.Text = "Ergometer"; this.ResumeLayout(false); @@ -247,10 +264,9 @@ 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; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button metingNextButton; + private System.Windows.Forms.Button metingBackButton; + private System.Windows.Forms.Button readButton; } } diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.cs b/ErgometerApplication/ErgometerApplication/Ergometer.cs index c70740b..deb03eb 100644 --- a/ErgometerApplication/ErgometerApplication/Ergometer.cs +++ b/ErgometerApplication/ErgometerApplication/Ergometer.cs @@ -10,20 +10,21 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Newtonsoft.Json; +using System.IO; namespace ErgometerApplication { public partial class Ergometer : Form { private ComPort comPort; - private Meting Write; private List _data; private int i = 0; - List readedFile = new List(); + List readFile = new List(); public Ergometer() { InitializeComponent(); comPort = new ComPort(); + _data = new List(); } private void connectButton_Click(object sender, EventArgs e) @@ -54,12 +55,9 @@ namespace ErgometerApplication string response = comPort.Read(); Console.WriteLine(response); - Meting test = FormatHelper.Status(response); - - Write = test; - - string test2 = test.ToString(); - richTextBox1.Text = test2; + Meting m = FormatHelper.Status(response); + SaveData(m); + richTextBox1.Text = m.ToString(); } } else @@ -79,6 +77,8 @@ namespace ErgometerApplication ComPortBox.Enabled = true; richTextBox1.Text = ""; + WriteFile(); + } } @@ -90,7 +90,11 @@ namespace ErgometerApplication comPort.Write("ST"); string response = comPort.Read(); Console.WriteLine(response); - richTextBox1.Text = FormatHelper.Status(response).ToString(); + Meting m = FormatHelper.Status(response); + SaveData(m); + richTextBox1.Text = m.ToString(); + + WriteFile(); } private void resetButton_Click(object sender, EventArgs e) @@ -109,7 +113,9 @@ namespace ErgometerApplication comPort.Write("ST"); string response = comPort.Read(); Console.WriteLine(response); - richTextBox1.Text = FormatHelper.Status(response).ToString(); + Meting m = FormatHelper.Status(response); + SaveData(m); + richTextBox1.Text = m.ToString(); } } @@ -161,102 +167,89 @@ 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(Write); - } + - private void writeFile() + private void readButton_Click(object sender, EventArgs e) { - - string json = Newtonsoft.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() + ReadFile(); + if (readFile != null) { - HeartBeat = Write.HeartBeat, - RPM = Write.RPM, - Speed = Write.Speed, - Distance = Write.Distance, - Power = Write.Power, - Energy = Write.Energy, - Seconds = Write.Seconds, - ActualPower = Write.ActualPower - }); + metingNextButton.Enabled = true; + metingBackButton.Enabled = true; + } + + } + + private void metingBackButton_Click(object sender, EventArgs e) + { + if (i > 0) + { i--; + metingNextButton.Enabled = true; + } + if (i == 0) + { + metingBackButton.Enabled = false; + } + richTextBox1.Text = readFile.ElementAt(i).ToString(); + } + + private void metingNextButton_Click(object sender, EventArgs e) + { + if (i < (readFile.Count - 1)) + { i++; + metingBackButton.Enabled = true; + } + if (i == (readFile.Count - 1)) + { + metingNextButton.Enabled = false; + } + richTextBox1.Text = readFile.ElementAt(i).ToString(); } private void writeTimer_Tick(object sender, EventArgs e) { - writeFile(); + WriteFile(); } - private void readFile() + + private void WriteFile() + { + string json = Newtonsoft.Json.JsonConvert.SerializeObject(_data); + string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ErgometerSessionData.ergo"); + System.IO.File.WriteAllText(path, json); + Console.WriteLine("Writing file: " + path); + } + + private void SaveData(Meting meting) + { + _data.Add(meting); + } + + private void ReadFile() { string path; OpenFileDialog file = new OpenFileDialog(); + file.Filter = "Ergometer files(*.ergo) | *.ergo | All files(*.*) | *.*"; if (file.ShowDialog() == DialogResult.OK) { path = file.FileName; - readedFile = Newtonsoft.Json.JsonConvert.DeserializeObject>(System.IO.File.ReadAllText(path)); - richTextBox1.Text = readedFile.ElementAt(i).ToString(); + readFile = Newtonsoft.Json.JsonConvert.DeserializeObject>(System.IO.File.ReadAllText(path)); + richTextBox1.Text = readFile.ElementAt(i).ToString(); } else { - readedFile = null; + readFile = null; } - - } - - private void button1_Click(object sender, EventArgs e) - { - readFile(); - if (readedFile != null) - { - button3.Enabled = true; - button2.Enabled = true; - } - - } - - private void button2_Click(object sender, EventArgs e) - { - if (i > 0) - { i--; - button3.Enabled = true; - } - if (i == 0) - { - button2.Enabled = false; - } - richTextBox1.Text = readedFile.ElementAt(i).ToString(); - } - - private void button3_Click(object sender, EventArgs e) - { - if (i < (readedFile.Count - 1)) - { i++; - button2.Enabled = true; - } - if (i == (readedFile.Count - 1)) - { - button3.Enabled = false; - } - richTextBox1.Text = readedFile.ElementAt(i).ToString(); } } } \ No newline at end of file diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.resx b/ErgometerApplication/ErgometerApplication/Ergometer.resx index 67b00e8..e7c8a0a 100644 --- a/ErgometerApplication/ErgometerApplication/Ergometer.resx +++ b/ErgometerApplication/ErgometerApplication/Ergometer.resx @@ -120,10 +120,7 @@ 17, 17 - - 160, 17 - - 285, 17 + 147, 19 \ No newline at end of file diff --git a/ErgometerApplication/ErgometerApplication/FormatHelper.cs b/ErgometerApplication/ErgometerApplication/FormatHelper.cs index e68be3f..b514bbd 100644 --- a/ErgometerApplication/ErgometerApplication/FormatHelper.cs +++ b/ErgometerApplication/ErgometerApplication/FormatHelper.cs @@ -26,7 +26,7 @@ namespace ErgometerApplication string[] temp = status[6].Split(':'); int seconds = (int.Parse(temp[0]) * 60) + (int.Parse(temp[1])); - return new Meting(heartbeat, rpm, speed, distance, power, energy, seconds, actualpower); + return new Meting(heartbeat, rpm, speed, distance, power, energy, seconds, actualpower, (DateTime.Now - DateTime.Parse("1/1/1870 0:0:0")).TotalMilliseconds); } } } \ No newline at end of file diff --git a/ErgometerApplication/ErgometerApplication/Meting.cs b/ErgometerApplication/ErgometerApplication/Meting.cs index 656fa3f..c17535a 100644 --- a/ErgometerApplication/ErgometerApplication/Meting.cs +++ b/ErgometerApplication/ErgometerApplication/Meting.cs @@ -16,8 +16,9 @@ namespace ErgometerApplication public int Energy { get; set; } public int Seconds { get; set; } public int ActualPower { get; set; } + public double TimeStamp { get; } - public Meting(int heartbeat, int rpm, double speed, double distance, int power, int energy, int seconds, int actualpower) + public Meting(int heartbeat, int rpm, double speed, double distance, int power, int energy, int seconds, int actualpower, double timestamp) { HeartBeat = heartbeat; RPM = rpm; @@ -27,6 +28,7 @@ namespace ErgometerApplication Energy = energy; Seconds = seconds; ActualPower = actualpower; + TimeStamp = timestamp; } public Meting() {