Ejemplo n.º 1
0
 /// <summary>
 /// Called when the action availability changes for the action channel.
 ///
 /// Will Enable/Disable buttons based off the availability.
 /// </summary>
 void audioChannel_ActionAvailabilityChanged(object sender, ChannelActionAvailabilityEventArgs e)
 {
     //posts the execution into the UI thread
     this.BeginInvoke(new MethodInvoker(delegate()
     {
         //only SendDtmf is used here since the button are already mapped
         //to the action availability of the modality itself
         if (e.Action == ChannelAction.SendDtmf)
         {
             buttonSendDTMF.Enabled = e.IsAvailable;
         }
     }));
 }
Ejemplo n.º 2
0
        //*****************************************************************************************
        //                              VideoChannel Event Handling
        //*****************************************************************************************

        /// <summary>
        /// Called when the action availability changes for the action channel.
        ///
        /// Will Enable/Disable buttons based off the availability.
        /// </summary>
        void videoChannel_ActionAvailabilityChanged(object sender, ChannelActionAvailabilityEventArgs e)
        {
            //posts the execution into the UI thread
            this.BeginInvoke(new MethodInvoker(delegate()
            {
                //each action is mapped to a button in the UI
                switch (e.Action)
                {
                case ChannelAction.Start:
                    buttonStartVideo.Enabled = e.IsAvailable;
                    break;

                case ChannelAction.Stop:
                    buttonStopVideo.Enabled = e.IsAvailable;
                    break;
                }
            }));
        }
Ejemplo n.º 3
0
        private void OnVideoChannelActionAvailabilityChanged(object sender, ChannelActionAvailabilityEventArgs e)
        {
            //posts the execution into the UI thread
            RunAtUI(() =>
            {
                //each action is mapped to a button in the UI
                switch (e.Action)
                {
                case ChannelAction.Start:
                    // buttonStartVideo.Enabled = e.IsAvailable;
                    break;

                case ChannelAction.Stop:
                    // buttonStopVideo.Enabled = e.IsAvailable;
                    break;
                }
            });
        }
        static void videoChannel_ActionAvailabilityChanged(object sender, ChannelActionAvailabilityEventArgs e)
        {
            try
            {
                if (e.Action == ChannelAction.Start && e.IsAvailable == true)
                {
                    var videoChannel = (VideoChannel)sender;
                    if (videoChannel.CanInvoke(ChannelAction.Start))
                    {
                        //even though the Action IsAvailable is set to true *AND* CanInvoke is true, sometimes the channel isn't ready. There's no good
                        //way of knowing when it'll become ready, and if you try and call it when it isn't ready, it won't error. However, the call back (videoChannelEndStart
                        //in this case) never gets hit. The only thing I can think of in this situation is to wait..
                        System.Threading.Thread.Sleep(2000);

                        videoChannel.BeginStart(videoChannelEndStart, videoChannel);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Ejemplo n.º 5
0
        private void OnAudioChannelActionAvailabilityChanged(object sender, ChannelActionAvailabilityEventArgs e)
        {
            _log.Debug("OnAudioChannelActionAvailabilityChanged  NewState:{0}", e.Action.ToString());
            ////posts the execution into the UI thread
            //this.BeginInvoke(new MethodInvoker(delegate ()
            //{

            //	//only SendDtmf is used here since the button are already mapped
            //	//to the action availability of the modality itself
            //	if (e.Action == ChannelAction.SendDtmf)
            //	{
            //		buttonSendDTMF.Enabled = e.IsAvailable;
            //	}

            //}));

            try
            {
                _log.Debug("OnVideoChannelActionAvailabilityChanged");
                if (e.Action == ChannelAction.Start && e.IsAvailable == true)
                {
                    var audioChannel = (AudioChannel)sender;
                    if (audioChannel.CanInvoke(ChannelAction.Start))
                    {
                        //even though the Action IsAvailable is set to true *AND* CanInvoke is true, sometimes the channel isn't ready. There's no good
                        //way of knowing when it'll become ready, and if you try and call it when it isn't ready, it won't error. However, the call back (videoChannelEndStart
                        //in this case) never gets hit. The only thing I can think of in this situation is to wait..

                        audioChannel.BeginStart(OnAudioChannelEndStart, audioChannel);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.ErrorException("", ex);
            }
        }
        static void videoChannel_ActionAvailabilityChanged(object sender, ChannelActionAvailabilityEventArgs e)
        {
            try
            {
                if (e.Action == ChannelAction.Start && e.IsAvailable == true)
                {
                    var videoChannel = (VideoChannel)sender;
                    if (videoChannel.CanInvoke(ChannelAction.Start))
                    {

                        //even though the Action IsAvailable is set to true *AND* CanInvoke is true, sometimes the channel isn't ready. There's no good
                        //way of knowing when it'll become ready, and if you try and call it when it isn't ready, it won't error. However, the call back (videoChannelEndStart
                        //in this case) never gets hit. The only thing I can think of in this situation is to wait..
                        System.Threading.Thread.Sleep(2000);

                        videoChannel.BeginStart(videoChannelEndStart, videoChannel);

                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }