Jelajahi Sumber

startup DocterModel

Mauro de Lyon 10 tahun lalu
induk
melakukan
b3bc245c0c

+ 76 - 0
Proftaak Remote Healthcare/FietsClientV2/DoctorModel.cs

@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms.DataVisualization.Charting;
+
+namespace FietsClient
+{
+    class DoctorModel
+    {
+
+        private static DoctorModel _doctorModel;
+        public DoctorForm doctorform { get; set; }
+        public static DoctorModel doctorModel { get { return _doctorModel ?? (_doctorModel = new DoctorModel()); } }
+        public TcpConnection tcpConnection { private get; set; }
+
+        public DoctorModel()
+        {
+        }
+
+        //display values
+        private List<DataPoint> speedPoints = new List<DataPoint>();
+        private List<DataPoint> bpmPoints = new List<DataPoint>();
+        private List<DataPoint> rpmPoints = new List<DataPoint>();
+        private void HandleBikeData(string[] data)
+        {
+            if (doctorform.InvokeRequired)
+            {
+                doctorform.Invoke((new Action(() => HandleBikeData(data))));
+            }
+            else
+            {
+                //fill fields
+                doctorform.pulseBox.Text = data[0];
+                doctorform.rpmInfoBox.Text = data[1];
+                doctorform.speedInfoBox.Text = data[2];
+                doctorform.distanceInfoBox.Text = data[3];
+                doctorform.requestedBox.Text = data[4];
+                doctorform.energyInfoBox.Text = data[5];
+                doctorform.timeBox.Text = data[6];
+                doctorform.actualBox.Text = data[7];
+                
+                //fill graph speed
+                speedPoints.Add(new DataPoint(Convert.ToDateTime(data[6]).ToOADate(), Convert.ToDouble(data[2])));
+                doctorform.speedChart.Series[0].Points.Clear();
+                for (int i = 0; i < speedPoints.Count; i++)
+                    doctorform.speedChart.Series[0].Points.Add(speedPoints[i]);
+                if (speedPoints.Count > 25)
+                    speedPoints.RemoveAt(0);
+                doctorform.speedChart.Update();
+
+                //fill graph pulse
+                bpmPoints.Add(new DataPoint(Convert.ToDateTime(data[6]).ToOADate(), Convert.ToDouble(data[0])));
+                doctorform.bpmChart.Series[0].Points.Clear();
+                for (int i = 0; i < bpmPoints.Count; i++)
+                    doctorform.bpmChart.Series[0].Points.Add(bpmPoints[i]);
+                if (bpmPoints.Count > 25)
+                    bpmPoints.RemoveAt(0);
+                doctorform.speedChart.Update();
+
+                //fill graph rpm
+                rpmPoints.Add(new DataPoint(Convert.ToDateTime(data[6]).ToOADate(), Convert.ToDouble(data[1])));
+                doctorform.rpmChart.Series[0].Points.Clear();
+                for (int i = 0; i < rpmPoints.Count; i++)
+                    doctorform.rpmChart.Series[0].Points.Add(rpmPoints[i]);
+                if (rpmPoints.Count > 25)
+                    rpmPoints.RemoveAt(0);
+                doctorform.rpmChart.Update();
+            }
+            
+        }
+    }
+}

+ 1 - 0
Proftaak Remote Healthcare/FietsClientV2/FietsClient.csproj

@@ -89,6 +89,7 @@
       <DependentUpon>PatientForm.cs</DependentUpon>
     </Compile>
     <Compile Include="lib\JsonConverter.cs" />
+    <Compile Include="DoctorModel.cs" />
     <Compile Include="PatientModel.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

File diff ditekan karena terlalu besar
+ 388 - 411
Proftaak Remote Healthcare/FietsClientV2/Forms/DoctorForm.Designer.cs


+ 18 - 1
Proftaak Remote Healthcare/FietsClientV2/Forms/DoctorForm.cs

@@ -12,9 +12,26 @@ namespace FietsClient
 {
     public partial class DoctorForm : Form
     {
-        public DoctorForm()
+        private TcpConnection connection;
+        private DoctorModel doctorModel;
+
+        public DoctorForm(TcpConnection connection)
         {
+            this.connection = connection;
             InitializeComponent();
+            doctorModel = DoctorModel.doctorModel;
+            doctorModel.doctorform = this;
+            doctorModel.tcpConnection = connection;
+            DataHandler.IncomingErrorEvent += HandleError;
+        }
+
+        private void HandleError(string error)
+        {
+            switch (error)
+            {
+                default:
+                    break;
+            }
         }
 
         private void Form1_Load(object sender, EventArgs e)

+ 0 - 5
Proftaak Remote Healthcare/FietsClientV2/Forms/Login.cs

@@ -33,12 +33,7 @@ namespace FietsClient
             errorLBL.Text = message;
         }
 
-<<<<<<< HEAD
         public void setError(string message)
-=======
-
-        public void setError(String message)
->>>>>>> origin/feature/prepare
         {
             errorLBL.Text = message;
         }

+ 38 - 38
Proftaak Remote Healthcare/FietsClientV2/Forms/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();
@@ -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";
@@ -348,7 +348,7 @@ namespace FietsClient
             // bpmBox
             // 
             this.bpmBox.Controls.Add(this.bpmChart);
-            this.bpmBox.Location = new System.Drawing.Point(16, 422);
+            this.bpmBox.Location = new System.Drawing.Point(16, 421);
             this.bpmBox.Margin = new System.Windows.Forms.Padding(4);
             this.bpmBox.Name = "bpmBox";
             this.bpmBox.Padding = new System.Windows.Forms.Padding(4);
@@ -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";
@@ -688,7 +688,7 @@ namespace FietsClient
             // rpmBox
             // 
             this.rpmBox.Controls.Add(this.rpmChart);
-            this.rpmBox.Location = new System.Drawing.Point(557, 422);
+            this.rpmBox.Location = new System.Drawing.Point(557, 421);
             this.rpmBox.Margin = new System.Windows.Forms.Padding(4);
             this.rpmBox.Name = "rpmBox";
             this.rpmBox.Padding = new System.Windows.Forms.Padding(4);
@@ -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";

+ 1 - 2
Proftaak Remote Healthcare/FietsClientV2/TCPConnection.cs

@@ -31,7 +31,6 @@ namespace FietsClient
             try
             {
                 client.Connect("145.48.226.156", 1288);
-
                 // create streams
                 serverStream = client.GetStream();
                 receiveThread = new Thread(receive);
@@ -63,7 +62,7 @@ namespace FietsClient
                             {
                                 if (response_parts[1] == "1" && response_parts[2] == "1")
                                 {
-                                    DoctorForm doctorForm = new DoctorForm();
+                                    DoctorForm doctorForm = new DoctorForm(this);
                                     doctorForm.Show();
                                     currentData = new CurrentData(userID);
                                 }

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini