Пример #1
0
        /// <summary>
        /// 启动视频
        /// </summary>
        /// <param name="conversationWindow"></param>
        public static void StartVideo(ConversationWindow conversationWindow)
        {
            try
            {
                ThreadPool.QueueUserWorkItem((o) =>
                {
                    AVModality avModality = (AVModality)conversationWindow.Conversation.SelfParticipant.Modalities[ModalityTypes.AudioVideo];
                    if (avModality != null)
                    {
                        VideoChannel videoChannel = avModality.VideoChannel;

                        //object obV = videoChannel.InnerObject;
                        if (videoChannel != null)
                        {
                            if (videoChannel != null && videoChannel.CanInvoke(ChannelAction.Start))
                            {
                                videoChannel.BeginStart(null, null);
                            }

                            TimerJob.StartRun(new Action(() =>
                            {
                                if (videoChannel.State != ChannelState.Connecting)
                                {
                                    if (videoChannel != null && videoChannel.CanInvoke(ChannelAction.Start))
                                    {
                                        videoChannel.BeginStart(null, null);
                                    }
                                }
                            }), 1500);
                            LyncHelper.ExitFullScreen();
                            LyncHelper.FullScreen();
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(LyncHelper), ex);
            }
            finally
            {
            }
        }
Пример #2
0
        /// <summary>
        /// 附加到新窗体
        /// </summary>
        /// <param name="handle"></param>
        public static void DockToNewParentWindow(IntPtr handle, Action <bool> callBack)
        {
            try
            {
                if (ConversationCodeEnterEntity.lyncClient != null && ConversationCodeEnterEntity.lyncClient.State == ClientState.SignedIn && LyncHelper.MainConversation != null && !LyncHelper.MainConversation.IsDocked)
                {
                    if (LyncHelper.MainConversation != null)
                    {
                        if (LyncHelper.MainConversation.IsFullScreen)
                        {
                            //先退出全屏
                            LyncHelper.ExitFullScreen();
                        }

                        TimerJob.StartRun(new Action(() =>
                        {
                            if (!LyncHelper.MainConversation.IsDocked && LyncHelper.MainConversation.State == ConversationWindowState.Initialized)
                            {
                                Thread.Sleep(500);
                                if (LyncHelper.DockNewWindowCallBack != null)
                                {
                                    LyncHelper.DockNewWindowCallBack();
                                }
                                LyncHelper.MainConversation.Dock(handle);
                                LyncHelper.FullScreen();
                                callBack(true);
                            }
                        }));
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(LyncHelper), ex);
            }
            finally
            {
            }
        }