소스 검색

GUI now displays values given

Mauro de Lyon 10 년 전
부모
커밋
190c2c3a10

+ 0 - 1
Proftaak Remote Healthcare/FietsClientV2/DataHandler.cs

@@ -129,7 +129,6 @@ namespace FietsClientV2
         private void handleBikeValues(string buffer)
         {
             buffer = buffer.TrimEnd('\r');
-            Console.WriteLine(buffer);
             bufferIn = buffer.Split('\t');
             OnIncomingDataEvent(bufferIn);
         }

+ 320 - 179
Proftaak Remote Healthcare/FietsClientV2/PatientForm.Designer.cs

@@ -28,15 +28,15 @@
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend();
-            System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Legend legend5 = new System.Windows.Forms.DataVisualization.Charting.Legend();
-            System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend();
-            System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea7 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Legend legend7 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+            System.Windows.Forms.DataVisualization.Charting.Series series7 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea8 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Legend legend8 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+            System.Windows.Forms.DataVisualization.Charting.Series series8 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea9 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Legend legend9 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+            System.Windows.Forms.DataVisualization.Charting.Series series9 = new System.Windows.Forms.DataVisualization.Charting.Series();
             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
             this.archiefToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.selectSessionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -44,8 +44,25 @@
             this.bicycleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.selectPortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
+            this.openPortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.requestDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.closePortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.startTrainingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.distanceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.distanceTraining = new System.Windows.Forms.ToolStripMenuItem();
+            this.distanceBox = new System.Windows.Forms.ToolStripTextBox();
+            this.confirmDistanceBox = new System.Windows.Forms.ToolStripMenuItem();
+            this.setTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.minuteBox = new System.Windows.Forms.ToolStripTextBox();
+            this.secondBox = new System.Windows.Forms.ToolStripTextBox();
+            this.confirmTimeBox = new System.Windows.Forms.ToolStripMenuItem();
+            this.stopTrainingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.setToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.powerBox = new System.Windows.Forms.ToolStripTextBox();
+            this.setPower = new System.Windows.Forms.ToolStripMenuItem();
+            this.energyBox = new System.Windows.Forms.ToolStripMenuItem();
+            this.toolStripTextBox3 = new System.Windows.Forms.ToolStripTextBox();
+            this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
             this.speedBox = new System.Windows.Forms.GroupBox();
             this.speedChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.bpmBox = new System.Windows.Forms.GroupBox();
@@ -59,16 +76,6 @@
             this.label13 = new System.Windows.Forms.Label();
             this.label12 = new System.Windows.Forms.Label();
             this.label11 = new System.Windows.Forms.Label();
-            this.naamLabel = new System.Windows.Forms.Label();
-            this.sessionLabel = new System.Windows.Forms.Label();
-            this.pulseLabel = new System.Windows.Forms.Label();
-            this.rpmLabel = new System.Windows.Forms.Label();
-            this.speedLabel = new System.Windows.Forms.Label();
-            this.distanceLabel = new System.Windows.Forms.Label();
-            this.energyLabel = new System.Windows.Forms.Label();
-            this.timeLabel = new System.Windows.Forms.Label();
-            this.actualPowerLabel = new System.Windows.Forms.Label();
-            this.requestedPowerLabel = new System.Windows.Forms.Label();
             this.label10 = new System.Windows.Forms.Label();
             this.label9 = new System.Windows.Forms.Label();
             this.label8 = new System.Windows.Forms.Label();
@@ -85,7 +92,16 @@
             this.messageBox = new System.Windows.Forms.TextBox();
             this.chatArea = new System.Windows.Forms.GroupBox();
             this.sendButton = new System.Windows.Forms.Button();
-            this.openPortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.speedInfoBox = new System.Windows.Forms.TextBox();
+            this.distanceInfoBox = new System.Windows.Forms.TextBox();
+            this.energyInfoBox = new System.Windows.Forms.TextBox();
+            this.rpmInfoBox = new System.Windows.Forms.TextBox();
+            this.pulseBox = new System.Windows.Forms.TextBox();
+            this.timeBox = new System.Windows.Forms.TextBox();
+            this.sessionBox = new System.Windows.Forms.TextBox();
+            this.nameBox = new System.Windows.Forms.TextBox();
+            this.actualBox = new System.Windows.Forms.TextBox();
+            this.requestedBox = new System.Windows.Forms.TextBox();
             this.menuStrip1.SuspendLayout();
             this.speedBox.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.speedChart)).BeginInit();
@@ -101,7 +117,8 @@
             // 
             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.archiefToolStripMenuItem,
-            this.bicycleToolStripMenuItem});
+            this.bicycleToolStripMenuItem,
+            this.startTrainingToolStripMenuItem});
             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
             this.menuStrip1.Name = "menuStrip1";
             this.menuStrip1.Size = new System.Drawing.Size(1064, 24);
@@ -146,7 +163,7 @@
             this.requestDataToolStripMenuItem,
             this.closePortToolStripMenuItem});
             this.selectPortToolStripMenuItem.Name = "selectPortToolStripMenuItem";
-            this.selectPortToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.selectPortToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
             this.selectPortToolStripMenuItem.Text = "Select port";
             // 
             // toolStripComboBox1
@@ -155,6 +172,13 @@
             this.toolStripComboBox1.Name = "toolStripComboBox1";
             this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23);
             // 
+            // openPortToolStripMenuItem
+            // 
+            this.openPortToolStripMenuItem.Name = "openPortToolStripMenuItem";
+            this.openPortToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
+            this.openPortToolStripMenuItem.Text = "Open port";
+            this.openPortToolStripMenuItem.Click += new System.EventHandler(this.openPortToolStripMenuItem_Click);
+            // 
             // requestDataToolStripMenuItem
             // 
             this.requestDataToolStripMenuItem.Enabled = false;
@@ -171,6 +195,124 @@
             this.closePortToolStripMenuItem.Text = "Close port";
             this.closePortToolStripMenuItem.Click += new System.EventHandler(this.closePortToolStripMenuItem_Click);
             // 
+            // startTrainingToolStripMenuItem
+            // 
+            this.startTrainingToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.distanceToolStripMenuItem,
+            this.stopTrainingToolStripMenuItem,
+            this.setToolStripMenuItem,
+            this.energyBox});
+            this.startTrainingToolStripMenuItem.Name = "startTrainingToolStripMenuItem";
+            this.startTrainingToolStripMenuItem.Size = new System.Drawing.Size(87, 20);
+            this.startTrainingToolStripMenuItem.Text = "Start training";
+            // 
+            // distanceToolStripMenuItem
+            // 
+            this.distanceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.distanceTraining,
+            this.setTimeToolStripMenuItem});
+            this.distanceToolStripMenuItem.Name = "distanceToolStripMenuItem";
+            this.distanceToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.distanceToolStripMenuItem.Text = "Select training";
+            // 
+            // distanceTraining
+            // 
+            this.distanceTraining.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.distanceBox,
+            this.confirmDistanceBox});
+            this.distanceTraining.Name = "distanceTraining";
+            this.distanceTraining.Size = new System.Drawing.Size(138, 22);
+            this.distanceTraining.Text = "Set Distance";
+            // 
+            // distanceBox
+            // 
+            this.distanceBox.Name = "distanceBox";
+            this.distanceBox.Size = new System.Drawing.Size(100, 23);
+            // 
+            // confirmDistanceBox
+            // 
+            this.confirmDistanceBox.Name = "confirmDistanceBox";
+            this.confirmDistanceBox.Size = new System.Drawing.Size(165, 22);
+            this.confirmDistanceBox.Text = "Confirm distance";
+            this.confirmDistanceBox.Click += new System.EventHandler(this.confirmDistanceBox_Click);
+            // 
+            // setTimeToolStripMenuItem
+            // 
+            this.setTimeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.minuteBox,
+            this.secondBox,
+            this.confirmTimeBox});
+            this.setTimeToolStripMenuItem.Name = "setTimeToolStripMenuItem";
+            this.setTimeToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
+            this.setTimeToolStripMenuItem.Text = "Set Time";
+            // 
+            // minuteBox
+            // 
+            this.minuteBox.Name = "minuteBox";
+            this.minuteBox.Size = new System.Drawing.Size(100, 23);
+            this.minuteBox.Text = "MM";
+            // 
+            // secondBox
+            // 
+            this.secondBox.Name = "secondBox";
+            this.secondBox.Size = new System.Drawing.Size(160, 23);
+            this.secondBox.Text = "SS";
+            // 
+            // confirmTimeBox
+            // 
+            this.confirmTimeBox.Name = "confirmTimeBox";
+            this.confirmTimeBox.Size = new System.Drawing.Size(220, 22);
+            this.confirmTimeBox.Text = "Confirm time";
+            this.confirmTimeBox.Click += new System.EventHandler(this.confirmTimeBox_Click);
+            // 
+            // stopTrainingToolStripMenuItem
+            // 
+            this.stopTrainingToolStripMenuItem.Name = "stopTrainingToolStripMenuItem";
+            this.stopTrainingToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.stopTrainingToolStripMenuItem.Text = "Reset training";
+            this.stopTrainingToolStripMenuItem.Click += new System.EventHandler(this.stopTrainingToolStripMenuItem_Click);
+            // 
+            // setToolStripMenuItem
+            // 
+            this.setToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.powerBox,
+            this.setPower});
+            this.setToolStripMenuItem.Name = "setToolStripMenuItem";
+            this.setToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.setToolStripMenuItem.Text = "Power";
+            // 
+            // powerBox
+            // 
+            this.powerBox.Name = "powerBox";
+            this.powerBox.Size = new System.Drawing.Size(100, 23);
+            // 
+            // setPower
+            // 
+            this.setPower.Name = "setPower";
+            this.setPower.Size = new System.Drawing.Size(160, 22);
+            this.setPower.Text = "Set power";
+            this.setPower.Click += new System.EventHandler(this.setPower_Click);
+            // 
+            // energyBox
+            // 
+            this.energyBox.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.toolStripTextBox3,
+            this.toolStripMenuItem1});
+            this.energyBox.Name = "energyBox";
+            this.energyBox.Size = new System.Drawing.Size(152, 22);
+            this.energyBox.Text = "Energy";
+            // 
+            // toolStripTextBox3
+            // 
+            this.toolStripTextBox3.Name = "toolStripTextBox3";
+            this.toolStripTextBox3.Size = new System.Drawing.Size(100, 23);
+            // 
+            // toolStripMenuItem1
+            // 
+            this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+            this.toolStripMenuItem1.Size = new System.Drawing.Size(160, 22);
+            this.toolStripMenuItem1.Text = "Set energy";
+            // 
             // speedBox
             // 
             this.speedBox.Controls.Add(this.speedChart);
@@ -183,16 +325,16 @@
             // 
             // speedChart
             // 
-            chartArea4.Name = "ChartArea1";
-            this.speedChart.ChartAreas.Add(chartArea4);
-            legend4.Name = "Legend1";
-            this.speedChart.Legends.Add(legend4);
+            chartArea7.Name = "ChartArea1";
+            this.speedChart.ChartAreas.Add(chartArea7);
+            legend7.Name = "Legend1";
+            this.speedChart.Legends.Add(legend7);
             this.speedChart.Location = new System.Drawing.Point(6, 19);
             this.speedChart.Name = "speedChart";
-            series4.ChartArea = "ChartArea1";
-            series4.Legend = "Legend1";
-            series4.Name = "Series1";
-            this.speedChart.Series.Add(series4);
+            series7.ChartArea = "ChartArea1";
+            series7.Legend = "Legend1";
+            series7.Name = "Series1";
+            this.speedChart.Series.Add(series7);
             this.speedChart.Size = new System.Drawing.Size(388, 285);
             this.speedChart.TabIndex = 0;
             this.speedChart.Text = "Speed chart";
@@ -209,22 +351,32 @@
             // 
             // bpmChart
             // 
-            chartArea5.Name = "ChartArea1";
-            this.bpmChart.ChartAreas.Add(chartArea5);
-            legend5.Name = "Legend1";
-            this.bpmChart.Legends.Add(legend5);
+            chartArea8.Name = "ChartArea1";
+            this.bpmChart.ChartAreas.Add(chartArea8);
+            legend8.Name = "Legend1";
+            this.bpmChart.Legends.Add(legend8);
             this.bpmChart.Location = new System.Drawing.Point(6, 19);
             this.bpmChart.Name = "bpmChart";
-            series5.ChartArea = "ChartArea1";
-            series5.Legend = "Legend1";
-            series5.Name = "Series1";
-            this.bpmChart.Series.Add(series5);
+            series8.ChartArea = "ChartArea1";
+            series8.Legend = "Legend1";
+            series8.Name = "Series1";
+            this.bpmChart.Series.Add(series8);
             this.bpmChart.Size = new System.Drawing.Size(388, 285);
             this.bpmChart.TabIndex = 1;
             this.bpmChart.Text = "beats per second";
             // 
             // sessionInfoBox
             // 
+            this.sessionInfoBox.Controls.Add(this.requestedBox);
+            this.sessionInfoBox.Controls.Add(this.actualBox);
+            this.sessionInfoBox.Controls.Add(this.nameBox);
+            this.sessionInfoBox.Controls.Add(this.sessionBox);
+            this.sessionInfoBox.Controls.Add(this.timeBox);
+            this.sessionInfoBox.Controls.Add(this.pulseBox);
+            this.sessionInfoBox.Controls.Add(this.rpmInfoBox);
+            this.sessionInfoBox.Controls.Add(this.energyInfoBox);
+            this.sessionInfoBox.Controls.Add(this.distanceInfoBox);
+            this.sessionInfoBox.Controls.Add(this.speedInfoBox);
             this.sessionInfoBox.Controls.Add(this.label18);
             this.sessionInfoBox.Controls.Add(this.label17);
             this.sessionInfoBox.Controls.Add(this.label16);
@@ -233,16 +385,6 @@
             this.sessionInfoBox.Controls.Add(this.label13);
             this.sessionInfoBox.Controls.Add(this.label12);
             this.sessionInfoBox.Controls.Add(this.label11);
-            this.sessionInfoBox.Controls.Add(this.naamLabel);
-            this.sessionInfoBox.Controls.Add(this.sessionLabel);
-            this.sessionInfoBox.Controls.Add(this.pulseLabel);
-            this.sessionInfoBox.Controls.Add(this.rpmLabel);
-            this.sessionInfoBox.Controls.Add(this.speedLabel);
-            this.sessionInfoBox.Controls.Add(this.distanceLabel);
-            this.sessionInfoBox.Controls.Add(this.energyLabel);
-            this.sessionInfoBox.Controls.Add(this.timeLabel);
-            this.sessionInfoBox.Controls.Add(this.actualPowerLabel);
-            this.sessionInfoBox.Controls.Add(this.requestedPowerLabel);
             this.sessionInfoBox.Controls.Add(this.label10);
             this.sessionInfoBox.Controls.Add(this.label9);
             this.sessionInfoBox.Controls.Add(this.label8);
@@ -263,7 +405,7 @@
             // label18
             // 
             this.label18.AutoSize = true;
-            this.label18.Location = new System.Drawing.Point(165, 107);
+            this.label18.Location = new System.Drawing.Point(165, 202);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(42, 13);
             this.label18.TabIndex = 27;
@@ -272,7 +414,7 @@
             // label17
             // 
             this.label17.AutoSize = true;
-            this.label17.Location = new System.Drawing.Point(165, 120);
+            this.label17.Location = new System.Drawing.Point(165, 228);
             this.label17.Name = "label17";
             this.label17.Size = new System.Drawing.Size(30, 13);
             this.label17.TabIndex = 26;
@@ -281,7 +423,7 @@
             // label16
             // 
             this.label16.AutoSize = true;
-            this.label16.Location = new System.Drawing.Point(165, 133);
+            this.label16.Location = new System.Drawing.Point(165, 254);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(30, 13);
             this.label16.TabIndex = 25;
@@ -290,7 +432,7 @@
             // label15
             // 
             this.label15.AutoSize = true;
-            this.label15.Location = new System.Drawing.Point(165, 94);
+            this.label15.Location = new System.Drawing.Point(165, 176);
             this.label15.Name = "label15";
             this.label15.Size = new System.Drawing.Size(30, 13);
             this.label15.TabIndex = 24;
@@ -299,7 +441,7 @@
             // label14
             // 
             this.label14.AutoSize = true;
-            this.label14.Location = new System.Drawing.Point(165, 81);
+            this.label14.Location = new System.Drawing.Point(165, 150);
             this.label14.Name = "label14";
             this.label14.Size = new System.Drawing.Size(54, 13);
             this.label14.TabIndex = 23;
@@ -308,7 +450,7 @@
             // label13
             // 
             this.label13.AutoSize = true;
-            this.label13.Location = new System.Drawing.Point(165, 68);
+            this.label13.Location = new System.Drawing.Point(165, 124);
             this.label13.Name = "label13";
             this.label13.Size = new System.Drawing.Size(96, 13);
             this.label13.TabIndex = 22;
@@ -317,7 +459,7 @@
             // label12
             // 
             this.label12.AutoSize = true;
-            this.label12.Location = new System.Drawing.Point(165, 55);
+            this.label12.Location = new System.Drawing.Point(165, 98);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(91, 13);
             this.label12.TabIndex = 21;
@@ -326,106 +468,16 @@
             // label11
             // 
             this.label11.AutoSize = true;
-            this.label11.Location = new System.Drawing.Point(165, 42);
+            this.label11.Location = new System.Drawing.Point(165, 72);
             this.label11.Name = "label11";
             this.label11.Size = new System.Drawing.Size(86, 13);
             this.label11.TabIndex = 20;
             this.label11.Text = "Beats per minute";
             // 
-            // naamLabel
-            // 
-            this.naamLabel.AutoSize = true;
-            this.naamLabel.Location = new System.Drawing.Point(106, 16);
-            this.naamLabel.Name = "naamLabel";
-            this.naamLabel.Size = new System.Drawing.Size(53, 13);
-            this.naamLabel.TabIndex = 19;
-            this.naamLabel.Text = "Unknown";
-            // 
-            // sessionLabel
-            // 
-            this.sessionLabel.AutoSize = true;
-            this.sessionLabel.Location = new System.Drawing.Point(106, 29);
-            this.sessionLabel.Name = "sessionLabel";
-            this.sessionLabel.Size = new System.Drawing.Size(53, 13);
-            this.sessionLabel.TabIndex = 18;
-            this.sessionLabel.Text = "Unknown";
-            // 
-            // pulseLabel
-            // 
-            this.pulseLabel.AutoSize = true;
-            this.pulseLabel.Location = new System.Drawing.Point(106, 42);
-            this.pulseLabel.Name = "pulseLabel";
-            this.pulseLabel.Size = new System.Drawing.Size(53, 13);
-            this.pulseLabel.TabIndex = 17;
-            this.pulseLabel.Text = "Unknown";
-            // 
-            // rpmLabel
-            // 
-            this.rpmLabel.AutoSize = true;
-            this.rpmLabel.Location = new System.Drawing.Point(106, 55);
-            this.rpmLabel.Name = "rpmLabel";
-            this.rpmLabel.Size = new System.Drawing.Size(53, 13);
-            this.rpmLabel.TabIndex = 16;
-            this.rpmLabel.Text = "Unknown";
-            // 
-            // speedLabel
-            // 
-            this.speedLabel.AutoSize = true;
-            this.speedLabel.Location = new System.Drawing.Point(106, 68);
-            this.speedLabel.Name = "speedLabel";
-            this.speedLabel.Size = new System.Drawing.Size(53, 13);
-            this.speedLabel.TabIndex = 15;
-            this.speedLabel.Text = "Unknown";
-            // 
-            // distanceLabel
-            // 
-            this.distanceLabel.AutoSize = true;
-            this.distanceLabel.Location = new System.Drawing.Point(106, 81);
-            this.distanceLabel.Name = "distanceLabel";
-            this.distanceLabel.Size = new System.Drawing.Size(53, 13);
-            this.distanceLabel.TabIndex = 14;
-            this.distanceLabel.Text = "Unknown";
-            // 
-            // energyLabel
-            // 
-            this.energyLabel.AutoSize = true;
-            this.energyLabel.Location = new System.Drawing.Point(106, 94);
-            this.energyLabel.Name = "energyLabel";
-            this.energyLabel.Size = new System.Drawing.Size(53, 13);
-            this.energyLabel.TabIndex = 13;
-            this.energyLabel.Text = "Unknown";
-            // 
-            // timeLabel
-            // 
-            this.timeLabel.AutoSize = true;
-            this.timeLabel.Location = new System.Drawing.Point(106, 107);
-            this.timeLabel.Name = "timeLabel";
-            this.timeLabel.Size = new System.Drawing.Size(53, 13);
-            this.timeLabel.TabIndex = 12;
-            this.timeLabel.Text = "Unknown";
-            // 
-            // actualPowerLabel
-            // 
-            this.actualPowerLabel.AutoSize = true;
-            this.actualPowerLabel.Location = new System.Drawing.Point(106, 133);
-            this.actualPowerLabel.Name = "actualPowerLabel";
-            this.actualPowerLabel.Size = new System.Drawing.Size(53, 13);
-            this.actualPowerLabel.TabIndex = 11;
-            this.actualPowerLabel.Text = "Unknown";
-            // 
-            // requestedPowerLabel
-            // 
-            this.requestedPowerLabel.AutoSize = true;
-            this.requestedPowerLabel.Location = new System.Drawing.Point(106, 120);
-            this.requestedPowerLabel.Name = "requestedPowerLabel";
-            this.requestedPowerLabel.Size = new System.Drawing.Size(53, 13);
-            this.requestedPowerLabel.TabIndex = 10;
-            this.requestedPowerLabel.Text = "Unknown";
-            // 
             // label10
             // 
             this.label10.AutoSize = true;
-            this.label10.Location = new System.Drawing.Point(6, 133);
+            this.label10.Location = new System.Drawing.Point(6, 254);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(69, 13);
             this.label10.TabIndex = 9;
@@ -434,7 +486,7 @@
             // label9
             // 
             this.label9.AutoSize = true;
-            this.label9.Location = new System.Drawing.Point(6, 120);
+            this.label9.Location = new System.Drawing.Point(6, 228);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(94, 13);
             this.label9.TabIndex = 8;
@@ -443,7 +495,7 @@
             // label8
             // 
             this.label8.AutoSize = true;
-            this.label8.Location = new System.Drawing.Point(6, 107);
+            this.label8.Location = new System.Drawing.Point(6, 202);
             this.label8.Name = "label8";
             this.label8.Size = new System.Drawing.Size(33, 13);
             this.label8.TabIndex = 7;
@@ -452,7 +504,7 @@
             // label7
             // 
             this.label7.AutoSize = true;
-            this.label7.Location = new System.Drawing.Point(6, 94);
+            this.label7.Location = new System.Drawing.Point(6, 176);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(43, 13);
             this.label7.TabIndex = 6;
@@ -461,7 +513,7 @@
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(6, 81);
+            this.label6.Location = new System.Drawing.Point(6, 150);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(52, 13);
             this.label6.TabIndex = 5;
@@ -470,7 +522,7 @@
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(6, 68);
+            this.label5.Location = new System.Drawing.Point(6, 124);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(41, 13);
             this.label5.TabIndex = 4;
@@ -479,7 +531,7 @@
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(6, 55);
+            this.label4.Location = new System.Drawing.Point(6, 98);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(34, 13);
             this.label4.TabIndex = 3;
@@ -488,7 +540,7 @@
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(6, 29);
+            this.label3.Location = new System.Drawing.Point(6, 46);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(47, 13);
             this.label3.TabIndex = 2;
@@ -497,7 +549,7 @@
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(6, 42);
+            this.label2.Location = new System.Drawing.Point(6, 72);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(36, 13);
             this.label2.TabIndex = 1;
@@ -506,7 +558,7 @@
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(6, 16);
+            this.label1.Location = new System.Drawing.Point(6, 20);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(38, 13);
             this.label1.TabIndex = 0;
@@ -524,16 +576,16 @@
             // 
             // rpmChart
             // 
-            chartArea6.Name = "ChartArea1";
-            this.rpmChart.ChartAreas.Add(chartArea6);
-            legend6.Name = "Legend1";
-            this.rpmChart.Legends.Add(legend6);
+            chartArea9.Name = "ChartArea1";
+            this.rpmChart.ChartAreas.Add(chartArea9);
+            legend9.Name = "Legend1";
+            this.rpmChart.Legends.Add(legend9);
             this.rpmChart.Location = new System.Drawing.Point(6, 19);
             this.rpmChart.Name = "rpmChart";
-            series6.ChartArea = "ChartArea1";
-            series6.Legend = "Legend1";
-            series6.Name = "Series1";
-            this.rpmChart.Series.Add(series6);
+            series9.ChartArea = "ChartArea1";
+            series9.Legend = "Legend1";
+            series9.Name = "Series1";
+            this.rpmChart.Series.Add(series9);
             this.rpmChart.Size = new System.Drawing.Size(388, 285);
             this.rpmChart.TabIndex = 2;
             this.rpmChart.Text = "rounds per minute";
@@ -575,12 +627,85 @@
             this.sendButton.Text = "send";
             this.sendButton.UseVisualStyleBackColor = true;
             // 
-            // openPortToolStripMenuItem
+            // speedInfoBox
             // 
-            this.openPortToolStripMenuItem.Name = "openPortToolStripMenuItem";
-            this.openPortToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
-            this.openPortToolStripMenuItem.Text = "Open port";
-            this.openPortToolStripMenuItem.Click += new System.EventHandler(this.openPortToolStripMenuItem_Click);
+            this.speedInfoBox.Location = new System.Drawing.Point(99, 117);
+            this.speedInfoBox.Name = "speedInfoBox";
+            this.speedInfoBox.ReadOnly = true;
+            this.speedInfoBox.Size = new System.Drawing.Size(60, 20);
+            this.speedInfoBox.TabIndex = 28;
+            // 
+            // distanceInfoBox
+            // 
+            this.distanceInfoBox.Location = new System.Drawing.Point(99, 143);
+            this.distanceInfoBox.Name = "distanceInfoBox";
+            this.distanceInfoBox.ReadOnly = true;
+            this.distanceInfoBox.Size = new System.Drawing.Size(60, 20);
+            this.distanceInfoBox.TabIndex = 29;
+            // 
+            // energyInfoBox
+            // 
+            this.energyInfoBox.Location = new System.Drawing.Point(99, 169);
+            this.energyInfoBox.Name = "energyInfoBox";
+            this.energyInfoBox.ReadOnly = true;
+            this.energyInfoBox.Size = new System.Drawing.Size(60, 20);
+            this.energyInfoBox.TabIndex = 30;
+            // 
+            // rpmInfoBox
+            // 
+            this.rpmInfoBox.Location = new System.Drawing.Point(99, 91);
+            this.rpmInfoBox.Name = "rpmInfoBox";
+            this.rpmInfoBox.ReadOnly = true;
+            this.rpmInfoBox.Size = new System.Drawing.Size(60, 20);
+            this.rpmInfoBox.TabIndex = 31;
+            // 
+            // pulseBox
+            // 
+            this.pulseBox.Location = new System.Drawing.Point(99, 65);
+            this.pulseBox.Name = "pulseBox";
+            this.pulseBox.ReadOnly = true;
+            this.pulseBox.Size = new System.Drawing.Size(60, 20);
+            this.pulseBox.TabIndex = 32;
+            // 
+            // timeBox
+            // 
+            this.timeBox.Location = new System.Drawing.Point(99, 195);
+            this.timeBox.Name = "timeBox";
+            this.timeBox.ReadOnly = true;
+            this.timeBox.Size = new System.Drawing.Size(60, 20);
+            this.timeBox.TabIndex = 33;
+            // 
+            // sessionBox
+            // 
+            this.sessionBox.Location = new System.Drawing.Point(99, 39);
+            this.sessionBox.Name = "sessionBox";
+            this.sessionBox.ReadOnly = true;
+            this.sessionBox.Size = new System.Drawing.Size(60, 20);
+            this.sessionBox.TabIndex = 34;
+            // 
+            // nameBox
+            // 
+            this.nameBox.Location = new System.Drawing.Point(99, 13);
+            this.nameBox.Name = "nameBox";
+            this.nameBox.ReadOnly = true;
+            this.nameBox.Size = new System.Drawing.Size(60, 20);
+            this.nameBox.TabIndex = 35;
+            // 
+            // actualBox
+            // 
+            this.actualBox.Location = new System.Drawing.Point(99, 247);
+            this.actualBox.Name = "actualBox";
+            this.actualBox.ReadOnly = true;
+            this.actualBox.Size = new System.Drawing.Size(60, 20);
+            this.actualBox.TabIndex = 36;
+            // 
+            // requestedBox
+            // 
+            this.requestedBox.Location = new System.Drawing.Point(99, 221);
+            this.requestedBox.Name = "requestedBox";
+            this.requestedBox.ReadOnly = true;
+            this.requestedBox.Size = new System.Drawing.Size(60, 20);
+            this.requestedBox.TabIndex = 37;
             // 
             // PatientForm
             // 
@@ -639,16 +764,6 @@
         private System.Windows.Forms.Label label13;
         private System.Windows.Forms.Label label12;
         private System.Windows.Forms.Label label11;
-        private System.Windows.Forms.Label naamLabel;
-        private System.Windows.Forms.Label sessionLabel;
-        private System.Windows.Forms.Label pulseLabel;
-        private System.Windows.Forms.Label rpmLabel;
-        private System.Windows.Forms.Label speedLabel;
-        private System.Windows.Forms.Label distanceLabel;
-        private System.Windows.Forms.Label energyLabel;
-        private System.Windows.Forms.Label timeLabel;
-        private System.Windows.Forms.Label actualPowerLabel;
-        private System.Windows.Forms.Label requestedPowerLabel;
         private System.Windows.Forms.Label label10;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.Label label8;
@@ -666,6 +781,32 @@
         private System.Windows.Forms.ToolStripMenuItem requestDataToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem closePortToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem openPortToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem startTrainingToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem distanceToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem distanceTraining;
+        private System.Windows.Forms.ToolStripMenuItem stopTrainingToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem setToolStripMenuItem;
+        private System.Windows.Forms.ToolStripTextBox powerBox;
+        private System.Windows.Forms.ToolStripMenuItem setPower;
+        private System.Windows.Forms.ToolStripMenuItem energyBox;
+        private System.Windows.Forms.ToolStripTextBox toolStripTextBox3;
+        private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
+        private System.Windows.Forms.ToolStripTextBox distanceBox;
+        private System.Windows.Forms.ToolStripMenuItem confirmDistanceBox;
+        private System.Windows.Forms.ToolStripMenuItem setTimeToolStripMenuItem;
+        private System.Windows.Forms.ToolStripTextBox minuteBox;
+        private System.Windows.Forms.ToolStripTextBox secondBox;
+        private System.Windows.Forms.ToolStripMenuItem confirmTimeBox;
+        public System.Windows.Forms.TextBox requestedBox;
+        public System.Windows.Forms.TextBox actualBox;
+        public System.Windows.Forms.TextBox nameBox;
+        public System.Windows.Forms.TextBox sessionBox;
+        public System.Windows.Forms.TextBox timeBox;
+        public System.Windows.Forms.TextBox pulseBox;
+        public System.Windows.Forms.TextBox rpmInfoBox;
+        public System.Windows.Forms.TextBox energyInfoBox;
+        public System.Windows.Forms.TextBox distanceInfoBox;
+        public System.Windows.Forms.TextBox speedInfoBox;
     }
 }
 

+ 43 - 0
Proftaak Remote Healthcare/FietsClientV2/PatientForm.cs

@@ -18,6 +18,7 @@ namespace FietsClientV2
         {
             InitializeComponent();
             patienModel = PatientModel.patientModel;
+            patienModel.patientform = this;
         }
 
         private void Form1_Load(object sender, EventArgs e)
@@ -42,5 +43,47 @@ namespace FietsClientV2
             requestDataToolStripMenuItem.Enabled = true;
             closePortToolStripMenuItem.Enabled = true;
         }
+
+        private void confirmDistanceBox_Click(object sender, EventArgs e)
+        {
+            int n;
+            if (int.TryParse(distanceBox.Text, out n))
+            {
+                patienModel.setDistanceMode(distanceBox.Text);
+            }
+            else
+            {
+                MessageBox.Show("Distance is not a valid number.");
+            }
+        }
+
+        private void confirmTimeBox_Click(object sender, EventArgs e)
+        {
+            int minutes, seconds;
+            bool isNumericS = int.TryParse(minuteBox.Text, out minutes);
+            bool isNumericM = int.TryParse(secondBox.Text, out seconds);
+
+            if (isNumericM)
+            {
+                if (isNumericS)
+                    patienModel.setTimeMode(minutes + ":" + seconds);
+                else MessageBox.Show("Seconds is not a valid number.");
+            }
+            else MessageBox.Show("Minutes is not a valid number.");
+        }
+
+        private void stopTrainingToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            patienModel.reset();
+        }
+
+        private void setPower_Click(object sender, EventArgs e)
+        {
+            int n;
+            if (int.TryParse(powerBox.Text, out n))
+                patienModel.setPower(powerBox.Text);
+            else
+                MessageBox.Show("Power is not a valid number.");
+        }
     }
 }

+ 44 - 2
Proftaak Remote Healthcare/FietsClientV2/PatientModel.cs

@@ -11,6 +11,8 @@ namespace FietsClientV2
     {
 
         private static PatientModel _patientModel;
+        public PatientForm patientform { private get; set; }
+
         public static PatientModel patientModel { get { return _patientModel ?? (_patientModel = new PatientModel()); } }
 
         private DataHandler dataHandler;
@@ -41,11 +43,27 @@ namespace FietsClientV2
                 dataHandler.sendData(DataHandler.STATUS);
             }
         }
-
+        delegate void trySetText(string[] text);
         //event handler
         private void HandleBikeData(string[] data)
         {
-            //doe iets ermee...
+            if (patientform.pulseBox.InvokeRequired)
+            {
+                trySetText t = new trySetText(HandleBikeData);
+                patientform.Invoke(t, new object[] { data });
+            }
+            else
+            {
+                patientform.pulseBox.Text = data[0];
+                patientform.rpmInfoBox.Text = data[1];
+                patientform.speedInfoBox.Text = data[2];
+                patientform.distanceInfoBox.Text = data[3];
+                patientform.requestedBox.Text = data[4];
+                patientform.energyInfoBox.Text = data[5];
+                patientform.timeBox.Text = data[6];
+                patientform.actualBox.Text = data[7];
+            }
+            
         }
 
         public void closeComPort()
@@ -54,5 +72,29 @@ namespace FietsClientV2
                 workerThread.Interrupt();
             dataHandler.closeComm();
         }
+
+        //change bike values
+        public void setTimeMode(string time)
+        {
+            dataHandler.sendData("CU");
+            dataHandler.sendData("PT " + time);
+        }
+
+        public void setPower(string power)
+        {
+            dataHandler.sendData("CU");
+            dataHandler.sendData("PW " + power);
+        }
+
+        public void setDistanceMode(string distance)
+        {
+            dataHandler.sendData("CU");
+            dataHandler.sendData("PD " + distance);
+        }
+
+        public void reset()
+        {
+            dataHandler.sendData("RS");
+        }
     }
 }