Added chat functionality (broken)
This commit is contained in:
Binary file not shown.
@@ -159,7 +159,7 @@ namespace ErgometerApplication
|
||||
ParseValueSet(command);
|
||||
break;
|
||||
case NetCommand.CommandType.CHAT:
|
||||
Chat.Add(new ChatMessage(Name, command.ChatMessage));
|
||||
Chat.Add(new ChatMessage(Name, command.ChatMessage, true));
|
||||
Client.chat.AddChatItem(command.ChatMessage);
|
||||
break;
|
||||
case NetCommand.CommandType.RESPONSE:
|
||||
|
||||
@@ -139,26 +139,28 @@ namespace ErgometerApplication
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "container";
|
||||
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel3_MouseWheel);
|
||||
|
||||
Form.CheckForIllegalCrossThreadCalls = false;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (richTextBox1.TextLength > 1)
|
||||
{
|
||||
AddChatItem(richTextBox1.Text, DateTime.Now.ToString("h:mm:ss tt"), false);
|
||||
AddChatItem(richTextBox1.Text, Helper.MillisecondsToTime(Helper.Now), false);
|
||||
MainClient.SendNetCommand(new NetCommand(richTextBox1.Text, MainClient.Session));
|
||||
richTextBox1.ResetText();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddChatItem(string chatmessage)
|
||||
public void AddChatItem(string text)
|
||||
{
|
||||
|
||||
}
|
||||
flowLayoutPanel1.Controls.Add(new ChatItem(text, Helper.MillisecondsToTime(Helper.Now), true));
|
||||
}
|
||||
|
||||
public void AddChatItem(string text, bool isDoctor)
|
||||
{
|
||||
flowLayoutPanel1.Controls.Add(new ChatItem(text, DateTime.Now.ToString("h:mm:ss tt"), isDoctor));
|
||||
flowLayoutPanel1.Controls.Add(new ChatItem(text, Helper.MillisecondsToTime(Helper.Now), isDoctor));
|
||||
}
|
||||
|
||||
public void AddChatItem(string text, string time, bool isDoctor)
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace ErgometerApplication
|
||||
this.textBoxPassword.PasswordChar = '*';
|
||||
this.textBoxPassword.Size = new System.Drawing.Size(167, 20);
|
||||
this.textBoxPassword.TabIndex = 2;
|
||||
this.textBoxPassword.KeyDown += TextBoxPassword_KeyDown;
|
||||
//
|
||||
// textBoxUsername
|
||||
//
|
||||
@@ -138,6 +139,14 @@ namespace ErgometerApplication
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBike)).EndInit();
|
||||
}
|
||||
|
||||
private void TextBoxPassword_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
buttonLogin_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public void buttonLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
string username = textBoxUsername.Text;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user