Fixed some errors in ErgometerApplication

This commit is contained in:
Aareschluchtje
2015-09-25 13:56:01 +02:00
parent d34af65274
commit 483ebbc46e
2 changed files with 11 additions and 5 deletions
@@ -73,9 +73,7 @@ namespace ErgometerApplication
// ComPortBox
//
this.ComPortBox.FormattingEnabled = true;
this.ComPortBox.Items.AddRange(new object[] {
"COM8",
"COM9"});
this.ComPortBox.Items.AddRange(SerialPort.GetPortNames());
this.ComPortBox.Location = new System.Drawing.Point(12, 290);
this.ComPortBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ComPortBox.Name = "ComPortBox";
@@ -13,6 +13,7 @@ using Newtonsoft.Json;
using System.IO;
using ErgometerLibrary;
using System.Net.Sockets;
using System.Net;
namespace ErgometerApplication
{
@@ -24,6 +25,7 @@ namespace ErgometerApplication
int sessionID;
NetCommand command;
List<Meting> readFile = new List<Meting>();
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
public Ergometer()
{
InitializeComponent();
@@ -61,7 +63,7 @@ namespace ErgometerApplication
Meting m = Meting.Parse(response);
SaveData(m);
richTextBox1.Text = m.ToString();
// richTextBox1.Text = m.ToString();
}
}
else
@@ -85,6 +87,12 @@ namespace ErgometerApplication
}
}
IPAddress ipAddress; //= IPAddress.Parse("127.0.0.1");
bool ipIsOk = IPAddress.TryParse("127.0.0.1", out ipAddress); //GetIp()
if (!ipIsOk) { Console.WriteLine("ip adres kan niet geparsed worden."); Environment.Exit(1); }
client.Connect("127.0.0.1", 8888);
WriteServer("5»ses?");
sessionID = int.Parse(ReadServer());
}
@@ -257,7 +265,7 @@ namespace ErgometerApplication
readFile = null;
}
}
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
private String ReadServer()
{