示例#1
0
        private void _tree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            // Early outs
            if (e.Button != MouseButtons.Right)
            {
                return;
            }
            if (e.Node == null)
            {
                return;
            }
            if (e.Node.Parent == null)
            {
                return;
            }
            // Get the data
            ChatTreeNode branch = (ChatTreeNode)e.Node.Parent;
            string       target = e.Node.Text;

            // Set as selected node
            this._tree.SelectedNode = e.Node;
            // Show menu
            if (e.Node.Parent == this._onlineFriends ||
                e.Node.Parent == this._offlineFriends ||
                e.Node.Parent == this._recentFriends)
            {
                // Character menu
                this._contextMenu.Show(new MessageTarget(MessageType.Character, target));
            }
            else if (e.Node.Parent == this._channels)
            {
                // Channel menu
                this._contextMenu.Show(new MessageTarget(MessageType.Channel, target));
            }
            else if (e.Node.Parent == this._privateChannels)
            {
                // Private channel menu
                this._contextMenu.Show(new MessageTarget(MessageType.PrivateChannel, target));
            }
            else if (e.Node.Parent == this._guests)
            {
                // Character menu
                this._contextMenu.Show(new MessageTarget(MessageType.Character, target));
            }
        }
示例#2
0
        private void _tree_DoubleClick(object sender, EventArgs e)
        {
            // Check if something sensible is selected
            if (this._tree.SelectedNode == null)
            {
                return;
            }
            if (this._tree.SelectedNode.Parent == null)
            {
                return;
            }
            // Get the data
            ChatTreeNode branch = (ChatTreeNode)this._tree.SelectedNode.Parent;
            string       target = this._tree.SelectedNode.Text;

            // Set the target
            this.SetTarget(new MessageTarget(branch.Type, target));
        }