/// <summary>
/// Handles the ChannelCreated event of Yaircc.UI.IRCMarshal.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="channel">The newly created channel.</param>
public void ChannelCreated(object sender, IRCChannel channel)
{
this.splitContainer.Panel1.InvokeAction(() =>
{
channel.NamesPopulated += new IRCChannel.NamesPopulatedHandler(this.ChannelUsersPopulated);
TreeView userTreeView = new TreeView();
userTreeView.Name = string.Format("{0}_TreeView", channel.ToString());
userTreeView.ImageList = userModeImageList;
userTreeView.TreeViewNodeSorter = new UserNodeSorter();
userTreeView.MouseDown += new MouseEventHandler(UserTreeView_MouseDown);
if (channel.TabPage.TabType == IRCTabType.Channel)
{
userTreeView.Nodes.Add("Fetching user list...");
}
else if (channel.TabPage.TabType == IRCTabType.PM)
{
TreeNode node = new TreeNode();
node.Text = channel.Name;
node.ImageKey = "user";
node.SelectedImageKey = node.ImageKey;
userTreeView.Nodes.Add(node);
}
splitContainer.Panel1.Controls.Add(userTreeView);
userTreeView.Dock = DockStyle.Fill;
channel.TabPage.UserTreeView = userTreeView;
channel.TabPage.NickNameMentioned += new IRCTabPage.NickNameMentionedHandler(this.FlashWindowInTaskBar);
if (channelsTabControl.SelectedTab == channel.TabPage)
{
userTreeView.BringToFront();
this.inputTextBox.MaxLength = this.CurrentTab.Marshal.GetChannelByTab(this.CurrentTab).MaximumMessageSize;
this.UpdateStatusBarText();
}
this.RefreshWindowsMenuItems(null);
});
}