PatientForm.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO.Ports;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace FietsClientV2
  12. {
  13. public partial class PatientForm : Form
  14. {
  15. private PatientModel patienModel;
  16. public PatientForm()
  17. {
  18. InitializeComponent();
  19. patienModel = PatientModel.patientModel;
  20. }
  21. private void Form1_Load(object sender, EventArgs e)
  22. {
  23. string[] ports = SerialPort.GetPortNames();
  24. toolStripComboBox1.Items.AddRange(ports);
  25. }
  26. private void toolStripComboBox1_Click(object sender, EventArgs e)
  27. {
  28. if (!(toolStripComboBox1.Text == ""))
  29. patienModel.startComPort(toolStripComboBox1.SelectedItem.ToString());
  30. requestDataToolStripMenuItem.Enabled = true;
  31. closePortToolStripMenuItem.Enabled = true;
  32. }
  33. private void requestDataToolStripMenuItem_Click(object sender, EventArgs e)
  34. {
  35. patienModel.startAskingData();
  36. }
  37. private void closePortToolStripMenuItem_Click(object sender, EventArgs e)
  38. {
  39. patienModel.closeComPort();
  40. }
  41. }
  42. }