コード例 #1
0
        /// <summary>
        /// Starts the video channel: VideoChannel.BeginStop()
        /// </summary>
        private void StopVideo()
        {
            //removes video from the conversation
            AsyncCallback callback = new AsyncOperationHandler(_videoChannel.EndStop).Callback;

            try
            {
                _videoChannel.BeginStop(callback, null);
            }
            catch (LyncClientException lyncClientException)
            {
                Console.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (LyncModelExceptionHelper.IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }
        }
コード例 #2
0
        //*****************************************************************************************
        //                              VideoChannel related actions
        //
        // The video channel action will behave differently depending on whether the audio is already
        // connected.
        //
        // If audio is not connected, starting video is equivalent to connecting the modality. If the
        // conversation already has audio, starting video will start the outgoing video stream. The
        // other participants in the conversation also need to start their own video.
        //
        // Stopping the video channel will stop both outgoing and incoming video. It will remove video
        // from the conversation.
        //
        //*****************************************************************************************

        /// <summary>
        /// Starts the video channel: VideoChannel.BeginStart()
        /// </summary>
        private void StartVideo()
        {
            _log.Debug("StartVideo");

            if (!_videoChannel.CanInvoke(ChannelAction.Start))
            {
                _log.Debug("StartVideo  can't  start");
                return;
            }

            //starts a video call or the video stream in a audio call
            AsyncCallback callback = new AsyncOperationHandler(_videoChannel.EndStart).Callback;

            try
            {
                _videoChannel.BeginStart(callback, null);
            }
            catch (LyncClientException lyncClientException)
            {
                Console.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (LyncModelExceptionHelper.IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    _log.ErrorException("Error: ", systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Ends the conversation if the user closes the window.
        /// </summary>
        public void Close()
        {
            if (Conversation == null)
            {
                return;
            }

            _log.Debug("Close");
            //need to remove event listeners otherwide events may be received after the form has been unloaded
            Conversation.StateChanged              -= OnConversationStateChanged;
            Conversation.ParticipantAdded          -= OnConversationParticipantAdded;
            Conversation.ParticipantRemoved        -= OnConversationParticipantRemoved;
            Conversation.ActionAvailabilityChanged -= OnConversationActionAvailabilityChanged;

            InvokePartClose();

            //if the conversation is active, will end it
            if (Conversation.State != ConversationState.Terminated)
            {
                //ends the conversation which will disconnect all modalities
                try
                {
                    Conversation.End();
                }
                catch (LyncClientException lyncClientException)
                {
                    _log.ErrorException("Close", lyncClientException);
                }
                catch (SystemException systemException)
                {
                    if (LyncModelExceptionHelper.IsLyncException(systemException))
                    {
                        // Log the exception thrown by the Lync Model API.
                        _log.ErrorException("Error: ", systemException);
                    }
                    else
                    {
                        // Rethrow the SystemException which did not come from the Lync Model API.
                        throw;
                    }
                }
            }

            Conversation = null;
        }