Kaynağa Gözat

Client Chat deels af

Daniel 10 yıl önce
ebeveyn
işleme
fa6314d9c7

+ 3 - 3
Proftaak Remote Healthcare/FietsClientV2/FietsClient.csproj

@@ -82,10 +82,10 @@
     </Compile>
     <Compile Include="JSONObjecten\Session.cs" />
     <Compile Include="JSONObjecten\Measurement.cs" />
-    <Compile Include="Forms\PatientForm.cs">
+    <Compile Include="Resources\PatientForm.cs">
       <SubType>Form</SubType>
     </Compile>
-    <Compile Include="Forms\PatientForm.Designer.cs">
+    <Compile Include="Resources\PatientForm.Designer.cs">
       <DependentUpon>PatientForm.cs</DependentUpon>
     </Compile>
     <Compile Include="lib\JsonConverter.cs" />
@@ -99,7 +99,7 @@
     <EmbeddedResource Include="Forms\DoctorForm.resx">
       <DependentUpon>DoctorForm.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="Forms\PatientForm.resx">
+    <EmbeddedResource Include="Resources\PatientForm.resx">
       <DependentUpon>PatientForm.cs</DependentUpon>
     </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">

+ 44 - 42
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.Designer.cs → Proftaak Remote Healthcare/FietsClientV2/Resources/PatientForm.Designer.cs

@@ -30,12 +30,12 @@ namespace FietsClient
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            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.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            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.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.Series series6 = 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();
@@ -139,7 +139,7 @@ namespace FietsClient
             this.selectSessionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.sESSIONSToolStripMenuItem});
             this.selectSessionToolStripMenuItem.Name = "selectSessionToolStripMenuItem";
-            this.selectSessionToolStripMenuItem.Size = new System.Drawing.Size(177, 26);
+            this.selectSessionToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
             this.selectSessionToolStripMenuItem.Text = "Select Session";
             // 
             // sESSIONSToolStripMenuItem
@@ -164,7 +164,7 @@ namespace FietsClient
             this.requestDataToolStripMenuItem,
             this.closePortToolStripMenuItem});
             this.selectPortToolStripMenuItem.Name = "selectPortToolStripMenuItem";
-            this.selectPortToolStripMenuItem.Size = new System.Drawing.Size(156, 26);
+            this.selectPortToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
             this.selectPortToolStripMenuItem.Text = "Select port";
             // 
             // toolStripComboBox1
@@ -213,7 +213,7 @@ namespace FietsClient
             this.distanceTraining,
             this.setTimeToolStripMenuItem});
             this.distanceToolStripMenuItem.Name = "distanceToolStripMenuItem";
-            this.distanceToolStripMenuItem.Size = new System.Drawing.Size(179, 26);
+            this.distanceToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
             this.distanceToolStripMenuItem.Text = "Select training";
             // 
             // distanceTraining
@@ -269,7 +269,7 @@ namespace FietsClient
             // stopTrainingToolStripMenuItem
             // 
             this.stopTrainingToolStripMenuItem.Name = "stopTrainingToolStripMenuItem";
-            this.stopTrainingToolStripMenuItem.Size = new System.Drawing.Size(179, 26);
+            this.stopTrainingToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
             this.stopTrainingToolStripMenuItem.Text = "Reset training";
             this.stopTrainingToolStripMenuItem.Click += new System.EventHandler(this.stopTrainingToolStripMenuItem_Click);
             // 
@@ -279,7 +279,7 @@ namespace FietsClient
             this.powerBox,
             this.setPower});
             this.setToolStripMenuItem.Name = "setToolStripMenuItem";
-            this.setToolStripMenuItem.Size = new System.Drawing.Size(179, 26);
+            this.setToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
             this.setToolStripMenuItem.Text = "Power";
             // 
             // powerBox
@@ -300,7 +300,7 @@ namespace FietsClient
             this.toolStripTextBox3,
             this.toolStripMenuItem1});
             this.energyBox.Name = "energyBox";
-            this.energyBox.Size = new System.Drawing.Size(179, 26);
+            this.energyBox.Size = new System.Drawing.Size(181, 26);
             this.energyBox.Text = "Energy";
             // 
             // toolStripTextBox3
@@ -328,19 +328,19 @@ namespace FietsClient
             // 
             // speedChart
             // 
-            chartArea1.Name = "ChartArea1";
-            this.speedChart.ChartAreas.Add(chartArea1);
+            chartArea4.Name = "ChartArea1";
+            this.speedChart.ChartAreas.Add(chartArea4);
             this.speedChart.Location = new System.Drawing.Point(8, 23);
             this.speedChart.Margin = new System.Windows.Forms.Padding(4);
             this.speedChart.Name = "speedChart";
-            series1.BorderWidth = 10;
-            series1.ChartArea = "ChartArea1";
-            series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series1.Name = "Speed";
-            series1.XValueMember = "Time";
-            series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
-            series1.YValueMembers = "Speed";
-            this.speedChart.Series.Add(series1);
+            series4.BorderWidth = 10;
+            series4.ChartArea = "ChartArea1";
+            series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series4.Name = "Speed";
+            series4.XValueMember = "Time";
+            series4.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
+            series4.YValueMembers = "Speed";
+            this.speedChart.Series.Add(series4);
             this.speedChart.Size = new System.Drawing.Size(517, 351);
             this.speedChart.TabIndex = 0;
             this.speedChart.Text = "Speed chart";
@@ -359,19 +359,19 @@ namespace FietsClient
             // 
             // bpmChart
             // 
-            chartArea2.Name = "ChartArea1";
-            this.bpmChart.ChartAreas.Add(chartArea2);
+            chartArea5.Name = "ChartArea1";
+            this.bpmChart.ChartAreas.Add(chartArea5);
             this.bpmChart.Location = new System.Drawing.Point(8, 23);
             this.bpmChart.Margin = new System.Windows.Forms.Padding(4);
             this.bpmChart.Name = "bpmChart";
-            series2.BorderWidth = 10;
-            series2.ChartArea = "ChartArea1";
-            series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series2.Name = "Beats per minute";
-            series2.XValueMember = "Time";
-            series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
-            series2.YValueMembers = "Beats per minutes";
-            this.bpmChart.Series.Add(series2);
+            series5.BorderWidth = 10;
+            series5.ChartArea = "ChartArea1";
+            series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series5.Name = "Beats per minute";
+            series5.XValueMember = "Time";
+            series5.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
+            series5.YValueMembers = "Beats per minutes";
+            this.bpmChart.Series.Add(series5);
             this.bpmChart.Size = new System.Drawing.Size(517, 351);
             this.bpmChart.TabIndex = 1;
             this.bpmChart.Text = "beats per second";
@@ -699,19 +699,19 @@ namespace FietsClient
             // 
             // rpmChart
             // 
-            chartArea3.Name = "ChartArea1";
-            this.rpmChart.ChartAreas.Add(chartArea3);
+            chartArea6.Name = "ChartArea1";
+            this.rpmChart.ChartAreas.Add(chartArea6);
             this.rpmChart.Location = new System.Drawing.Point(8, 23);
             this.rpmChart.Margin = new System.Windows.Forms.Padding(4);
             this.rpmChart.Name = "rpmChart";
-            series3.BorderWidth = 10;
-            series3.ChartArea = "ChartArea1";
-            series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series3.Name = "Rounds per minute";
-            series3.XValueMember = "Time";
-            series3.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
-            series3.YValueMembers = "Rounds per minutes";
-            this.rpmChart.Series.Add(series3);
+            series6.BorderWidth = 10;
+            series6.ChartArea = "ChartArea1";
+            series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series6.Name = "Rounds per minute";
+            series6.XValueMember = "Time";
+            series6.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
+            series6.YValueMembers = "Rounds per minutes";
+            this.rpmChart.Series.Add(series6);
             this.rpmChart.Size = new System.Drawing.Size(517, 351);
             this.rpmChart.TabIndex = 2;
             this.rpmChart.Text = "rounds per minute";
@@ -733,6 +733,7 @@ namespace FietsClient
             this.messageBox.Name = "messageBox";
             this.messageBox.Size = new System.Drawing.Size(303, 22);
             this.messageBox.TabIndex = 6;
+            this.messageBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.messageBox_KeyPress);
             // 
             // chatArea
             // 
@@ -757,6 +758,7 @@ namespace FietsClient
             this.sendButton.TabIndex = 7;
             this.sendButton.Text = "send";
             this.sendButton.UseVisualStyleBackColor = true;
+            this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
             // 
             // PatientForm
             // 

+ 15 - 0
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.cs → Proftaak Remote Healthcare/FietsClientV2/Resources/PatientForm.cs

@@ -104,5 +104,20 @@ namespace FietsClient
             else
                 MessageBox.Show("Power is not a valid number.");
         }
+
+        private void sendButton_Click(object sender, EventArgs e)
+        {
+            if(messageBox.Text != null)
+            {
+                string message = messageBox.Text;
+                messageBox.Clear();
+                _connection.SendChatMessage(message);
+            }
+        }
+
+        private void messageBox_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            sendButton_Click(sender, e);
+        }
     }
 }

+ 0 - 0
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.resx → Proftaak Remote Healthcare/FietsClientV2/Resources/PatientForm.resx


+ 7 - 0
Proftaak Remote Healthcare/FietsClientV2/TCPConnection.cs

@@ -138,5 +138,12 @@ namespace FietsClient
             serverStream.Flush();
         }
 
+        public void SendChatMessage(string message)
+        {
+            // send command ( cmdID | username sender | username patient | message )
+            string protocol = "6 | " + this.userID +" | "/* + idPatient */ + " | " + message;
+            SendString(protocol);
+        }
+
     }
 }