naar server schrijven en readen als goed is
This commit is contained in:
Binary file not shown.
@@ -12,6 +12,7 @@ using System.Windows.Forms;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using ErgometerLibrary;
|
using ErgometerLibrary;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
|
||||||
namespace ErgometerApplication
|
namespace ErgometerApplication
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,8 @@ namespace ErgometerApplication
|
|||||||
private ComPort comPort;
|
private ComPort comPort;
|
||||||
private List<Meting> _data;
|
private List<Meting> _data;
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
|
int sessionID;
|
||||||
|
NetCommand command;
|
||||||
List<Meting> readFile = new List<Meting>();
|
List<Meting> readFile = new List<Meting>();
|
||||||
public Ergometer()
|
public Ergometer()
|
||||||
{
|
{
|
||||||
@@ -82,25 +85,7 @@ namespace ErgometerApplication
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Thread threadRead = new Thread(HandleServerRead);
|
sessionID = int.Parse(ReadServer());
|
||||||
threadRead.Start(client);
|
|
||||||
Thread threadWrite = new Thread(HandleServerRead);
|
|
||||||
threadWrite.Start(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleServerRead()
|
|
||||||
{
|
|
||||||
while (connectButton.Text == "Disconnect")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void HandleServerWrite()
|
|
||||||
{
|
|
||||||
while (connectButton.Text == "Disconnect")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void statusButton_Click(object sender, EventArgs e)
|
private void statusButton_Click(object sender, EventArgs e)
|
||||||
@@ -110,8 +95,9 @@ namespace ErgometerApplication
|
|||||||
Console.WriteLine(response);
|
Console.WriteLine(response);
|
||||||
Meting m = Meting.Parse(response);
|
Meting m = Meting.Parse(response);
|
||||||
SaveData(m);
|
SaveData(m);
|
||||||
|
command = new NetCommand(m, sessionID);
|
||||||
|
WriteServer(command.ToString());
|
||||||
richTextBox1.Text = m.ToString();
|
richTextBox1.Text = m.ToString();
|
||||||
|
|
||||||
WriteFile();
|
WriteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +119,8 @@ namespace ErgometerApplication
|
|||||||
Console.WriteLine(response);
|
Console.WriteLine(response);
|
||||||
Meting m = Meting.Parse(response);
|
Meting m = Meting.Parse(response);
|
||||||
SaveData(m);
|
SaveData(m);
|
||||||
|
command = new NetCommand(m, sessionID);
|
||||||
|
WriteServer(command.ToString());
|
||||||
richTextBox1.Text = m.ToString();
|
richTextBox1.Text = m.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user