示例#1
0
        TreeNode MakeNode(ChannelTree tree)
        {
            TreeNode <Channel> result = new TreeNode <Channel>();

            result.Text      = tree.Channel.Name;
            result.BackColor = Color.LightBlue; //the colors might be quite ugly
            result.Value     = tree.Channel;
            foreach (var child in tree.Children)
            {
                result.Nodes.Add(MakeNode(child));
            }
            foreach (var user in tree.Users)
            {
                TreeNode <User> newNode = new TreeNode <User>();
                newNode.Text      = user.Name;
                newNode.BackColor = Color.LightGreen;
                newNode.Value     = user;
                result.Nodes.Add(newNode);
            }
            return(result);
        }
示例#2
0
        public Form1()
        {
            InitializeComponent();

            connection = new MumbleConnection("mumble.placeholder-software.co.uk", 64738);
            protocol   = connection.Connect <BasicMumbleProtocol>("testuser", "", "mumble.placeholder-software.co.uk");
            protocol.MessageRecieved += Protocol_MessageRecieved;
            while (connection.Protocol.LocalUser == null)
            {
                connection.Process();
            }

            Dictionary <uint, ChannelTree> channels = new Dictionary <uint, ChannelTree>();

            foreach (var channel in protocol.Channels)
            {
                channels.Add(channel.Id, new ChannelTree(channel));
            }
            foreach (var channelTree in channels.Values)
            {
                if (channelTree.Channel.Id != 0)
                {
                    channelTree.Parent = channels[channelTree.Channel.Parent];
                    channelTree.Parent.Children.Add(channelTree);
                }
            }
            foreach (var user in protocol.Users)
            {
                channels[user.Channel.Id].Users.Add(user);
            }
            ChannelTree RootChannel = channels[0];

            tvUsers.Nodes.Add(MakeNode(RootChannel));
            tvUsers.ExpandAll();

            //MessageBox.Show("Connected as " + connection.Protocol.LocalUser.Id);
        }
示例#3
0
文件: Core.cs 项目: zakyrion/Nexus
 private void StopCoreInternal()
 {
     ChannelTree.Shootdown();
 }
示例#4
0
文件: Node.cs 项目: zakyrion/Nexus
 public override void OnAdd(Address address, Invoker parent)
 {
     base.OnAdd(address, parent);
     ChannelTree = new ChannelTree(address, this);
 }