private void updateMainTextHandler(object sender, IRCEventArg e) { this.mainText.BeginInvoke(new Action( () => { if (tree.SelectedNode.Tag == sender) //are we currently viewing the object that is trying to push text into the console? { mainText.AppendText(e.data[0] + "\r\n"); } })); }
private void removeNodeHandler(object sender, IRCEventArg e) { this.tree.BeginInvoke(new Action( () => { if (sender is Channel) { Channel ch = (Channel)sender; //Removing channel node. //TODO: SELECT CHANNEL ABOVE BEFORE PARENT NODE. MESSY MESS MESS. tree.SelectedNode = ch.treeTag.Parent; tree.Nodes.Remove(ch.treeTag); } if (sender is Server) { //TODO: TEST TEST TEST Server srv = (Server)sender; //Removing server node. tree.SelectedNode = tree.Nodes[srv.treeTag.Index - 1]; tree.Nodes.Remove(srv.treeTag); } })); }
private void updateChannelNickListHandler(object sender, IRCEventArg e) { this.tree.BeginInvoke(new Action( () => { if (tree.SelectedNode.Tag == sender) { Channel ch = (Channel)sender; nickListView.Items.Clear(); for (int i = 0; i < ch.nickList.Count(); i++) { ListViewItem item = new ListViewItem(); switch (ch.nickList[i].opMode) { case op.VOP: item.ImageIndex = 0; item.Text = ch.nickList[i].nick.Substring(1); break; case op.HOP: item.ImageIndex = 1; item.Text = ch.nickList[i].nick.Substring(1); break; case op.CHOP: item.ImageIndex = 2; item.Text = ch.nickList[i].nick.Substring(1); break; case op.SOP: item.ImageIndex = 3; item.Text = ch.nickList[i].nick.Substring(1); break; case op.NOOP: item.Text = ch.nickList[i].nick; break; } nickListView.Items.Add(item); } } })); }
private void createNodeHandler(object sender, IRCEventArg e) { this.tree.BeginInvoke(new Action( () => { TreeNode nod = new TreeNode(); if (sender is Server) { Server srv = (Server)sender; srv.treeTag = nod; nod = tree.Nodes.Add(e.data[0]); nod.Tag = sender; } if (sender is Channel) { Channel ch = (Channel)sender; ch.treeTag = nod; nod.Text = e.data[0]; nod.Tag = sender; //Get parent server Server parent = ch.parent; //find the node which belongs to that server for (int i = 0; i < tree.Nodes.Count; i++) { TreeNode n = tree.Nodes[i]; if (n.Tag == parent) { n.Nodes.Add(nod); } } } tree.SelectedNode = nod; })); }