Bart Reedijk 10 anni fa
parent
commit
732baae818

+ 19 - 2
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.cs

@@ -94,14 +94,21 @@ namespace FietsClient
             int minutes, seconds;
             bool isNumericS = int.TryParse(minuteBox.Text, out minutes);
             bool isNumericM = int.TryParse(secondBox.Text, out seconds);
-
-            if (isNumericM)
+            if (patientModel.askdata)
+            {
+                MessageBox.Show("Er is nog een sessie bezig, deze moet eerst gestopt worden");
+            }
+            else if (isNumericM)
             {
                 if (isNumericS)
+                {
                     patientModel.setTimeMode(minutes + ":" + seconds);
+                    this.label19.Text = "Huidige sessie: Tijd: " + minutes + ":" + seconds;
+                }
                 else MessageBox.Show("Minutes is not a valid number.");
             }
             else MessageBox.Show("Seconds is not a valid number.");
+
         }
 
         private void stopTrainingToolStripMenuItem_Click(object sender, EventArgs e)
@@ -234,5 +241,15 @@ namespace FietsClient
             _connection.disconnect();
             Application.Exit();
         }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            patientModel.startAskingData();
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            patientModel.stopAskingData();
+        }
     }
 }

+ 41 - 0
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.designer.cs

@@ -36,6 +36,7 @@ namespace FietsClient
             System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
             System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
             System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PatientForm));
             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
             this.archiefToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.selectSessionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -66,6 +67,9 @@ namespace FietsClient
             this.bpmBox = new System.Windows.Forms.GroupBox();
             this.bpmChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.sessionInfoBox = new System.Windows.Forms.GroupBox();
+            this.label19 = new System.Windows.Forms.Label();
+            this.button2 = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
             this.requestedBox = new System.Windows.Forms.TextBox();
             this.actualBox = new System.Windows.Forms.TextBox();
             this.nameBox = new System.Windows.Forms.TextBox();
@@ -362,6 +366,9 @@ namespace FietsClient
             // 
             // sessionInfoBox
             // 
+            this.sessionInfoBox.Controls.Add(this.label19);
+            this.sessionInfoBox.Controls.Add(this.button2);
+            this.sessionInfoBox.Controls.Add(this.button1);
             this.sessionInfoBox.Controls.Add(this.requestedBox);
             this.sessionInfoBox.Controls.Add(this.actualBox);
             this.sessionInfoBox.Controls.Add(this.nameBox);
@@ -397,6 +404,34 @@ namespace FietsClient
             this.sessionInfoBox.TabStop = false;
             this.sessionInfoBox.Text = "Session info:";
             // 
+            // label19
+            // 
+            this.label19.AutoSize = true;
+            this.label19.Location = new System.Drawing.Point(197, 286);
+            this.label19.Name = "label19";
+            this.label19.Size = new System.Drawing.Size(0, 13);
+            this.label19.TabIndex = 40;
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(99, 281);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(75, 23);
+            this.button2.TabIndex = 39;
+            this.button2.Text = "Stop sessie";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(9, 281);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 38;
+            this.button1.Text = "Start sessie";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
             // requestedBox
             // 
             this.requestedBox.Location = new System.Drawing.Point(99, 221);
@@ -718,7 +753,10 @@ namespace FietsClient
             this.Controls.Add(this.bpmBox);
             this.Controls.Add(this.speedBox);
             this.Controls.Add(this.menuStrip1);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
             this.MainMenuStrip = this.menuStrip1;
+            this.MaximizeBox = false;
             this.Name = "PatientForm";
             this.Text = "Patient";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PatientForm_FormClosing);
@@ -806,6 +844,9 @@ namespace FietsClient
         public System.Windows.Forms.DataVisualization.Charting.Chart speedChart;
         public Chart bpmChart;
         public Chart rpmChart;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.Label label19;
     }
 }
 

+ 9 - 7
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.resx

@@ -117,13 +117,15 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing">
     <value>17, 17</value>
-  </metadata>
-  <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  </data>
+  <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="$this.Locked" type="System.Boolean, mscorlib">
     <value>True</value>
-  </metadata>
-  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>53</value>
-  </metadata>
+  </data>
+  <data name="$this.TrayHeight" type="System.Int32, mscorlib">
+    <value>25</value>
+  </data>
 </root>

+ 13 - 1
Proftaak Remote Healthcare/FietsClientV2/PatientModel.cs

@@ -21,6 +21,7 @@ namespace FietsClient
         private Thread workerThread;
 
         private string powerLog;
+        public Boolean askdata;
 
         public string CurrentDoctorID { get; set; }
 
@@ -37,13 +38,24 @@ namespace FietsClient
 
         public void startAskingData()
         {
+            askdata = true;
+            speedPoints.Clear();
+            bpmPoints.Clear();
+            rpmPoints.Clear();
+
             workerThread = new Thread(() => workerThreadLoop());
             workerThread.Start();
         }
 
+        public void stopAskingData()
+        {
+            askdata = false;
+            dataHandler.sendData(DataHandler.RESET);
+        }
+
         private void workerThreadLoop()
         {
-            while (true)
+            while (askdata)
             {
                 Thread.Sleep(1000);