Skip to main content

MessageEventArgs

Namespace: Wisej.Web.Ext.ChatControl

Assembly: Wisej.Web.Ext.ChatControl (4.1.0.0)

Provides data for the SentMessage and FormatMessage events.

public class MessageEventArgs : EventArgs

Example:

private void chatBox_SentMessage(object sender, MessageEventArgs e)
{
if (!e.IsChatBoxUser)
AlertBox.Show("New message from " + e.Message.User?.Name);
}

Constructors​

Instance member MessageEventArgs(isChatBoxUser, message)​

Initializes a new instance of the MessageEventArgs class with the specified message.

NameTypeDescription
isChatBoxUserBooleantrue if the message is from the User; otherwise false.
messageMessageThe Message the event refers to.

Example:

var message = new Message("Hello", null, chatBox.User);
var args = new MessageEventArgs(message.User == chatBox.User, message);

Properties​

Instance member 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";
}

Instance member 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​

NameDescription
FormatMessageEventHandlerRepresents 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.
MessageEventHandlerRepresents the method that will handle the SentMessage event, fired after a message has been added to the ChatBox.