// ---------------------------------------------------------------------------- #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); } } }
public void AddChannel( int nChannelID ) { Channel channel = m_voipclient.GetChannel(nChannelID); string strChannelName = channel.szName; string path = m_voipclient.GetChannelPath( nChannelID ); if ( null == path ) { path = "/"; } if ( 0 == path.CompareTo( "/DDD/" ) ) { String strChannelPassword = ""; String strTopic = ""; String strOpPassword = ""; // 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 ); m_voipclient.DoJoinChannel(path, strChannelPassword, strChannelPassword, strOpPassword); } 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; node.ToolTipText = "Double click to join or leave the voice channel"; TreeNode parent = GetChannelNode( channel.nParentID ); if ( parent != null ) { // Make sure this parent does not already contain this channel if (ChannelAlreadyExists(parent, strChannelName)) { return; } parent.Nodes.Add( node ); forceExpandContract = true; parent.Expand(); forceExpandContract = false; 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, m_eventCommunicator); _voiceChannels[strChannelName].SetMasterVolume(255);//set to max, temp bug fix _voiceChannels[strChannelName].SetVoiceActivated(voiceActRadio.Checked); _voiceChannels[strChannelName].SetVoiceActivationLevel(voiceactTrackBar.Value); _voiceChannels[strChannelName].SetPushToTalk(pushToTalkRadio.Checked); } } }
// ---------------------------------------------------------------------------- #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); } } }