MessageEventArgs
Namespace: Wisej.Web.Ext.ChatControl
Assembly: Wisej.Web.Ext.ChatControl (4.1.0.0)
Provides data for the SentMessage and FormatMessage events.
- C#
- VB.NET
public class MessageEventArgs : EventArgs
Public Class MessageEventArgs
Inherits EventArgs
Example:
private void chatBox_SentMessage(object sender, MessageEventArgs e)
{
if (!e.IsChatBoxUser)
AlertBox.Show("New message from " + e.Message.User?.Name);
}
Constructors
MessageEventArgs(isChatBoxUser, message)
Initializes a new instance of the MessageEventArgs class with the specified message.
| Name | Type | Description |
|---|---|---|
| isChatBoxUser | Boolean | true if the message is from the User; otherwise false. |
| message | Message | The Message the event refers to. |
Example:
var message = new Message("Hello", null, chatBox.User);
var args = new MessageEventArgs(message.User == chatBox.User, message);
Properties
IsChatBoxUser
Boolean: Returns whether the message is from the User.
Value: true if the message's User is the User; otherwise false.
Example:
private void chatBox_SentMessage(object sender, MessageEventArgs e)
{
if (e.IsChatBoxUser)
e.Message.UserData = "outgoing";
}
Message
Message: Returns the Message the event refers to.
Example:
private void chatBox_FormatMessage(object sender, MessageEventArgs e)
{
e.Message.Content = e.Message.Content.Replace(":)", "🙂");
}
Used By
| Name | Description |
|---|---|
| FormatMessageEventHandler | Represents the method that will handle the FormatMessage event, fired when a message is added to the ChatBox and can be formatted before it is displayed. |
| MessageEventHandler | Represents the method that will handle the SentMessage event, fired after a message has been added to the ChatBox. |