Exemplo n.º 1
0
        // ----------------------------------------------------------------------------

        #region Helper Functions

        public void AddChannel(int nChannelID)
        {
            string path = voipclient.GetChannelPath(nChannelID);

            if (null == path)
            {
                path = "/";
            }
            string[] tokens = TokenizeChannelPath(path);
            int      i      = 0;

            path = "/";
            while (i < tokens.Length - 1)  //strip the new channel
            {
                path += tokens[i++] + "/";
            }

            if (tokens.Length == 0)  //add root channel
            {
                channelsTreeView.Nodes.Clear();
                //note that the root channel does not have a name
                TreeNode node = new TreeNode(voipclient.GetServerName(), ( int )ImageIndex.CHANNEL, ( int )ImageIndex.CHANNEL, new TreeNode[0]);
                node.Tag = nChannelID;
                channelsTreeView.Nodes.Add(node);
            }
            else
            {
                //add new sub channel
                TreeNode node = new TreeNode(tokens[tokens.Length - 1], ( int )ImageIndex.CHANNEL, ( int )ImageIndex.CHANNEL, new TreeNode[0]);
                node.Tag = nChannelID;
                TreeNode parent = GetChannelNode(voipclient.GetChannelParentID(nChannelID));

                parent.Nodes.Add(node);
            }
        }