diff --git a/ErgometerApplication/ErgometerApplication/ChatItem.cs b/ErgometerApplication/ErgometerApplication/ChatItem.cs index 5cd9cd4..00c9b18 100644 --- a/ErgometerApplication/ErgometerApplication/ChatItem.cs +++ b/ErgometerApplication/ErgometerApplication/ChatItem.cs @@ -20,7 +20,7 @@ namespace ErgometerApplication this.setAppearance(isDoctor); this.Controls.Add(this.messageLabel); this.Controls.Add(this.timeLabel); - this.MinimumSize = new System.Drawing.Size(100, 40); + this.MinimumSize = new System.Drawing.Size(150, 60); this.Name = "messageContainer"; this.Padding = new System.Windows.Forms.Padding(6); @@ -31,7 +31,7 @@ namespace ErgometerApplication this.messageLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.messageLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.messageLabel.Location = new System.Drawing.Point(6, 6); - this.messageLabel.MaximumSize = new System.Drawing.Size(190, 0); + this.messageLabel.MaximumSize = new System.Drawing.Size(250, 0); this.messageLabel.Size = new System.Drawing.Size(121, 20); this.messageLabel.Text = message; // diff --git a/ErgometerApplication/ErgometerApplication/MainClient.cs b/ErgometerApplication/ErgometerApplication/MainClient.cs index 9a2bfdf..f39bc14 100644 --- a/ErgometerApplication/ErgometerApplication/MainClient.cs +++ b/ErgometerApplication/ErgometerApplication/MainClient.cs @@ -160,7 +160,7 @@ namespace ErgometerApplication break; case NetCommand.CommandType.CHAT: Chat.Add(new ChatMessage(Name, command.ChatMessage, true)); - Client.chat.AddChatItem(command.ChatMessage); + Client.chat.Invoke(Client.chat.passChatMessage, new Object[] {command.ChatMessage, Helper.MillisecondsToTime(command.Timestamp), true}); break; case NetCommand.CommandType.RESPONSE: Console.WriteLine(command.Response.ToString()); diff --git a/ErgometerApplication/ErgometerApplication/PanelClientChat.cs b/ErgometerApplication/ErgometerApplication/PanelClientChat.cs index b1eb161..0c4d7b9 100644 --- a/ErgometerApplication/ErgometerApplication/PanelClientChat.cs +++ b/ErgometerApplication/ErgometerApplication/PanelClientChat.cs @@ -140,7 +140,7 @@ namespace ErgometerApplication this.Name = "container"; this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel3_MouseWheel); - Form.CheckForIllegalCrossThreadCalls = false; + passChatMessage = new ChatDelegate(this.AddChatItem); } private void button1_Click(object sender, EventArgs e) @@ -203,5 +203,8 @@ namespace ErgometerApplication button1_Click(this, new EventArgs()); } } + + public delegate void ChatDelegate(string text, string time, bool isDoctor); + public ChatDelegate passChatMessage; } } diff --git a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll index 1e827cc..68219db 100644 Binary files a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll and b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll differ