// ---------------------------------------------------------------------------- #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); } }
// ---------------------------------------------------------------------------- #region Helper Functions public void AddChannel(int nChannelID) { string strChannelName = m_voipclient.GetChannelName(nChannelID); string path = m_voipclient.GetChannelPath(nChannelID); if (null == path) { path = "/"; } if (0 == path.CompareTo("/DDD/")) { // create the root node channelsTreeView.Nodes.Clear(); TreeNode node = new TreeNode(strChannelName, ( int )ImageIndex.CHANNEL, ( int )ImageIndex.CHANNEL, new TreeNode[0]); node.Tag = nChannelID; m_iDDDChannelID = nChannelID; channelsTreeView.Nodes.Add(node); } else { if (path.Contains("DDD")) { string[] tokens = TokenizeChannelPath(path); int i = 0; path = "/"; while (i < tokens.Length - 1) //strip the new channel { path += tokens[i++] + "/"; } //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(m_voipclient.GetChannelParentID(nChannelID)); if (parent != null) { parent.Nodes.Add(node); parent.Expand(); if (kbDEBUG) { logDebugOnly(String.Format("Channel {0} : {1} added\n", strChannelName, nChannelID)); } else { // We actually want the user to see this richTextBoxLog.AppendText(String.Format("Channel {0} added\n", strChannelName)); } } _voiceChannels[strChannelName] = new VoiceChannel(); _voiceChannels[strChannelName].initialize(_strDM, _aChannels[strChannelName], _strVoiceServerHostname, _iVoiceServerPort, _strConaitoServerPasswd); } } }