-
Notifications
You must be signed in to change notification settings - Fork 5
/
ChatMessageEventArgs.cs
62 lines (56 loc) · 2.07 KB
/
ChatMessageEventArgs.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Diagnostics;
namespace BNSharp
{
/// <summary>
/// Specifies the contract for chat events that involve another user and communication.
/// </summary>
/// <param name="sender">The object that raised the event.</param>
/// <param name="e">The event arguments.</param>
public delegate void ChatMessageEventHandler(object sender, ChatMessageEventArgs e);
/// <summary>
/// Represents the event information associated with a chat event with a given user and communication.
/// </summary>
[DataContract]
[DebuggerDisplay("Type={EventType}, User={Username}, \"{Text}\"")]
public class ChatMessageEventArgs : ChatEventArgs
{
#region fields
[DataMember(Name = "Flags")]
private UserFlags m_flags;
[DataMember(Name = "Username")]
private string m_un;
[DataMember(Name = "Text")]
private string m_txt;
#endregion
/// <summary>
/// Creates a new instance of <see>ChatMessageEventArgs</see> with the given parameters.
/// </summary>
/// <param name="eventType">The type of event.</param>
/// <param name="flags">The other user's flags.</param>
/// <param name="username">The primarily involved user.</param>
/// <param name="text">The message.</param>
public ChatMessageEventArgs(ChatEventType eventType, UserFlags flags, string username, string text)
: base(eventType)
{
m_flags = flags;
m_un = username;
m_txt = text;
}
/// <summary>
/// Gets the flags of the user.
/// </summary>
public UserFlags Flags { get { return m_flags; } }
/// <summary>
/// Gets the name of the user who communicated.
/// </summary>
public string Username { get { return m_un; } }
/// <summary>
/// Gets the message.
/// </summary>
public string Text { get { return m_txt; } }
}
}