Time Break
The TimeBreak mechanism of RadChat is intended to encapsulate a group of messages for a given time interval. It can be either added manually or automatically.
Adding a TimeBreak Automatically
RadChat can automatically add a TimeBreak at a given interval. This can achieved by setting the AutoIncludeTimeBreaks boolean property of RadChat to True. Also, the needed TimeSpan needs to be set to the TimeBreakInterval property of the control.
Adding a TimeBreak Manually
RadChat provides the AddTimeBreak method for adding a TimeBreak which accepts a string parameter for its header.
Example 2: Adding TimeBreak
var firstTextMessage = new TextMessage(this.otherAuthor, "Hello Peter! How are you?");
var secondTextMessage = new TextMessage(this.otherAuthor, "I hope I find you well!");
var thirdTextMessage = new TextMessage(this.otherAuthor, "How is family? ");
this.chat.AddMessage(firstTextMessage);
this.chat.AddMessage(secondTextMessage);
this.chat.AddMessage(thirdTextMessage);
this.chat.AddTimeBreak(DateTime.Now.DayOfWeek.ToString() + " " + DateTime.Now.TimeOfDay.Hours.ToString() + " : " + DateTime.Now.TimeOfDay.Minutes.ToString());
Figure 2: Adding a TimeBreak
Handling the AddingTimeBreak Event
The AddingTimeBreak event provides various information regarding the last MessageGroup and the Messages in it. Also, the event can be canceled. The following event arguments are exposed for this purpose.
- Cancel: The event can be canceled by setting the property to True.
- Header: Provides information regarding the current Header that is to be set for the TimeBreak.
- LastMessageGroup
The LastMessageGroup itself provides the following information.
- Alignment: Gets the alignment of the MessageGroup.
- Author: The group's Author.
- AvatarAlignment: Gets the alignment of the Avatar according to the CurrentAuthor.
- CreationDate: Gets the time when the first Message of the group was created.
- Messages: The collection of all messages within the group.