Example #1
0
        // ----------------------------------------------------------------------------

        #region Forms Event Handlers

        private void VoIPClientControl_Load(object sender, EventArgs e)
        {
            bool soundInited = initSoundSystem();

            if (soundInited && Connect())
            {
                // Register push-to-talk key
                bHotKeyRegistered = m_voipclient.RegisterHotKey(
                    kiPUSH_TO_TALK_ID,
                    false,  // control
                    false,  // alt
                    false,  // shift
                    false,  // windows key
                    kcPushToTalkKey);

                this.m_timer1.Tick += new System.EventHandler(this.timer1_Tick);

                // Give it a little time or you won't get the nodes when you log in
                // I found it works at 1/2 second but not less  -- shorvitz 3/10/08
                System.Threading.Thread.Sleep(500);
                login();
            }
        }
Example #2
0
        private void registerButton_Click(object sender, EventArgs e)
        {
            if (bHotKeyRegistered)
            {
                bHotKeyRegistered     = !voipclient.UnregisterHotKey(PUSH_TO_TALK_ID);
                registerButton.Text   = "Register hotkey";
                ctrlCheckBox.Checked  = false;
                altCheckBox.Checked   = false;
                shiftCheckBox.Checked = false;
                winCheckBox.Checked   = false;
                vkTextBox.Text        = "";
            }
            else
            {
                if (vkTextBox.Text.Length == 1)
                {
                    voipclient.UnregisterHotKey(PUSH_TO_TALK_ID);
//                    int iASCII = Convert.ToInt32( vkTextBox.Text.ToCharArray().GetValue(0) );
                    char cKey = (char)vkTextBox.Text.ToCharArray().GetValue(0);
                    bHotKeyRegistered = voipclient.RegisterHotKey(
                        PUSH_TO_TALK_ID,
                        ctrlCheckBox.Checked,
                        altCheckBox.Checked,
                        shiftCheckBox.Checked,
                        winCheckBox.Checked,
                        //                        0 );
                        //                        iASCII );
                        cKey);
                    registerButton.Text = "Clear hotkey";
                }
                else
                {
                    MessageBox.Show("Please enter a virtual key");
                }
            }
        }
Example #3
0
        public void initialize(
            //IVoiceClientEventCommunicator controller,
            String strDM,
            int channelID,
            String strVoiceServerHostname,
            int iVoiceServerPort,
            String strConaitoServerPasswd)
        {
            //if (null == controller)
            //{
            //    throw new Exception("Voice client controller is null");
            //}
            //m_eventCommunicator = controller;
            _strDM = strDM;
            _strVoiceServerHostname = strVoiceServerHostname;
            _iVoiceServerPort       = iVoiceServerPort;
            _strConaitoServerPasswd = strConaitoServerPasswd;
            _iChannelID             = channelID;

            // It can take a while for a remote server to exchange the messages,
            // so give it a few tries to initialize.
            bool bAuthorized = false;

            for (int i = 0; i < 5; i++)
            {
                if (m_voipclient.InitVoIP(true))
                {
                    bAuthorized = true;
                    //logDebugOnly(
                    //    String.Format("Conaito initialization succeeded for user {0}\n", strDM));
                    //logDebugOnly(
                    //    String.Format("  VoiceServerHostname = {0}, VoiceServerPort = {1}\n",
                    //   strVoiceServerHostname, Convert.ToInt32(iVoiceServerPort).ToString()));
                    break;
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (!bAuthorized)
            {
                throw new Exception("Voice client failed to initialize");
            }

            //String strChannelPassword = "";
            //String strTopic = "";
            //String strOpPassword = "";
            bool soundInited = initSoundSystem();

            if (soundInited && Connect())
            {
                // Register push-to-talk key
                bHotKeyRegistered = m_voipclient.RegisterHotKey(
                    kiPUSH_TO_TALK_ID,
                    false,  // control
                    false,  // alt
                    false,  // shift
                    false,  // windows key
                    kcPushToTalkKey);

                //this.m_timer1.Tick += new System.EventHandler( this.timer1_Tick );

                // Give it a little time or you won't get the nodes when you log in
                // I found it works at 1/2 second but not less  -- shorvitz 3/10/08
                System.Threading.Thread.Sleep(500);
                login();
                System.Threading.Thread.Sleep(500);
                //bool joinsuccess = m_voipclient.DoJoinChannel(m_voipclient.GetChannelPath(_iChannelID), strChannelPassword, strTopic, strOpPassword);
            }
        }