Procházet zdrojové kódy

Fixed PatientForm bug

RD125632 před 10 roky
rodič
revize
6b425c2f41

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

@@ -33,6 +33,7 @@ namespace FietsClient
             errorLBL.Text = message;
         }
 
+
         public void setError(String message)
         {
             errorLBL.Text = message;

+ 3 - 1
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.cs

@@ -13,9 +13,11 @@ namespace FietsClient
 {
     public partial class PatientForm : Form
     {
+        private TcpConnection _connection;
         private PatientModel patienModel;
-        public PatientForm()
+        public PatientForm(TcpConnection connection)
         {
+            this._connection = connection;
             InitializeComponent();
             patienModel = PatientModel.patientModel;
             patienModel.patientform = this;

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

@@ -22,7 +22,7 @@ namespace FietsClient
 
         private String powerLog;
 
-        private PatientModel()
+        public PatientModel()
         {
             dataHandler = new DataHandler();
             DataHandler.IncomingDataEvent += HandleBikeData; //initialize event

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

@@ -18,6 +18,7 @@ namespace FietsClient
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             Application.Run(new Login(new TcpConnection()));
+            //Application.Run(new PatientForm());
         }
     }
 }

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

@@ -51,6 +51,7 @@ namespace FietsClient
                 }
         }
 
+
         public void recieve ()
         {
             while (true)
@@ -73,8 +74,17 @@ namespace FietsClient
                                     currentData = new CurrentData(userID);
                                 }
                                 else if(response_parts[2] == "0" && response_parts[1] == "1")
-                                { 
-                                    new PatientForm().Show();
+                                {
+                                    PatientForm form = new PatientForm(this);
+                                    Form activeForm = Form.ActiveForm;
+
+                                    activeForm.Invoke((MethodInvoker)delegate () {
+                                        activeForm.Hide();
+                                        form.Show();
+                                    });
+                                    
+
+
                                     currentData = new CurrentData(userID);
                                 }
                                 else