Sends messages to server, but can't display them.
This commit is contained in:
Binary file not shown.
@@ -20,9 +20,11 @@ namespace ErgometerApplication
|
|||||||
{
|
{
|
||||||
public partial class ClientApplicatie : Form
|
public partial class ClientApplicatie : Form
|
||||||
{
|
{
|
||||||
|
public PanelClientChat chat;
|
||||||
public ClientApplicatie()
|
public ClientApplicatie()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
MainClient.Init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTimer_Tick(object sender, EventArgs e)
|
private void updateTimer_Tick(object sender, EventArgs e)
|
||||||
@@ -55,7 +57,7 @@ namespace ErgometerApplication
|
|||||||
panelLogin.lblVerification.ForeColor = Color.Red;
|
panelLogin.lblVerification.ForeColor = Color.Red;
|
||||||
panelLogin.lblVerification.Visible = true;
|
panelLogin.lblVerification.Visible = true;
|
||||||
}
|
}
|
||||||
if (password.Length > 0 && password.Length < 8)
|
if (password.Length > 0 && password.Length < 4)
|
||||||
{
|
{
|
||||||
panelLogin.lblVerification.Text = "Vul een wachtwoord in van minimaal 8 karakters.";
|
panelLogin.lblVerification.Text = "Vul een wachtwoord in van minimaal 8 karakters.";
|
||||||
panelLogin.lblVerification.ForeColor = Color.Red;
|
panelLogin.lblVerification.ForeColor = Color.Red;
|
||||||
@@ -75,6 +77,7 @@ namespace ErgometerApplication
|
|||||||
if(MainClient.Connect(SerialPort.GetPortNames()[0], username, password))
|
if(MainClient.Connect(SerialPort.GetPortNames()[0], username, password))
|
||||||
{
|
{
|
||||||
panelClientContainer.BringToFront();
|
panelClientContainer.BringToFront();
|
||||||
|
chat = panelClientChat;
|
||||||
this.labelUsername.Text = panelLogin.textBoxUsername.Text;
|
this.labelUsername.Text = panelLogin.textBoxUsername.Text;
|
||||||
panelTopBar.Visible = true;
|
panelTopBar.Visible = true;
|
||||||
updateTimer.Start();
|
updateTimer.Start();
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace ErgometerApplication
|
|||||||
public static string HOST = "127.0.0.1";
|
public static string HOST = "127.0.0.1";
|
||||||
public static int PORT = 8888;
|
public static int PORT = 8888;
|
||||||
|
|
||||||
|
public static ClientApplicatie Client;
|
||||||
|
|
||||||
static MainClient()
|
static MainClient()
|
||||||
{
|
{
|
||||||
ComPort = new ComPort();
|
ComPort = new ComPort();
|
||||||
@@ -42,6 +44,11 @@ namespace ErgometerApplication
|
|||||||
Loggedin = false;
|
Loggedin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Init(ClientApplicatie client)
|
||||||
|
{
|
||||||
|
Client = client;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool Connect(string comport, string name, string password)
|
public static bool Connect(string comport, string name, string password)
|
||||||
{
|
{
|
||||||
if (!Doctor.Connected)
|
if (!Doctor.Connected)
|
||||||
@@ -153,6 +160,7 @@ namespace ErgometerApplication
|
|||||||
break;
|
break;
|
||||||
case NetCommand.CommandType.CHAT:
|
case NetCommand.CommandType.CHAT:
|
||||||
Chat.Add(new ChatMessage(Name, command.ChatMessage));
|
Chat.Add(new ChatMessage(Name, command.ChatMessage));
|
||||||
|
Client.chat.AddChatItem(command.ChatMessage);
|
||||||
break;
|
break;
|
||||||
case NetCommand.CommandType.RESPONSE:
|
case NetCommand.CommandType.RESPONSE:
|
||||||
Console.WriteLine(command.Response.ToString());
|
Console.WriteLine(command.Response.ToString());
|
||||||
@@ -165,6 +173,11 @@ namespace ErgometerApplication
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SendNetCommand(NetCommand command)
|
||||||
|
{
|
||||||
|
NetHelper.SendNetCommand(Doctor, command);
|
||||||
|
}
|
||||||
|
|
||||||
private static void ParseValueSet(NetCommand command)
|
private static void ParseValueSet(NetCommand command)
|
||||||
{
|
{
|
||||||
switch(command.Value)
|
switch(command.Value)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using ErgometerLibrary;
|
||||||
|
|
||||||
namespace ErgometerApplication
|
namespace ErgometerApplication
|
||||||
{
|
{
|
||||||
@@ -144,12 +145,18 @@ namespace ErgometerApplication
|
|||||||
{
|
{
|
||||||
if (richTextBox1.TextLength > 1)
|
if (richTextBox1.TextLength > 1)
|
||||||
{
|
{
|
||||||
flowLayoutPanel1.Controls.Add(new ChatItem(richTextBox1.Text, DateTime.Now.ToString("h:mm:ss tt"), true));
|
|
||||||
flowLayoutPanel1.Controls.Add(new ChatItem(richTextBox1.Text, DateTime.Now.ToString("h:mm:ss tt"), false));
|
flowLayoutPanel1.Controls.Add(new ChatItem(richTextBox1.Text, DateTime.Now.ToString("h:mm:ss tt"), false));
|
||||||
|
MainClient.SendNetCommand(new NetCommand(richTextBox1.Text, MainClient.Session));
|
||||||
richTextBox1.ResetText();
|
richTextBox1.ResetText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddChatItem(string text)
|
||||||
|
{
|
||||||
|
flowLayoutPanel1.Controls.Add(new ChatItem(text, DateTime.Now.ToString("h:mm:ss tt"), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void panel3_MouseWheel(object sender, MouseEventArgs e)
|
private void panel3_MouseWheel(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
panel3.Focus();
|
panel3.Focus();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace ErgometerApplication
|
|||||||
public class PanelClientContainer:Panel
|
public class PanelClientContainer:Panel
|
||||||
{
|
{
|
||||||
|
|
||||||
private PanelClientChat panelClientChat;
|
public PanelClientChat panelClientChat;
|
||||||
private PanelGraphView panelGraphView;
|
private PanelGraphView panelGraphView;
|
||||||
|
|
||||||
public PanelClientContainer() : base()
|
public PanelClientContainer() : base()
|
||||||
|
|||||||
Reference in New Issue
Block a user