Esempio n. 1
0
        private static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            if (e.NewState != ChannelState.Receive)
            {
                return;
            }

            var vc = (VideoChannel)sender;

            if (vc.CanInvoke(ChannelAction.Start))
            {
                vc.StartAsync().ContinueWith(t =>
                {
                    // Go looking around for the IM Window (there had better just be the one we just started)
                    // and force it to the foreground
                    IntPtr childHandle = UnsafeNativeMethods.FindWindowEx(IntPtr.Zero, IntPtr.Zero, "IMWindowClass", null);
                    UnsafeNativeMethods.SetForegroundWindow(childHandle);

                    // Try to get the video to go full screen by pressing F5
                    WindowsInput.InputSimulator.SimulateKeyPress(WindowsInput.VirtualKeyCode.F5);
                });
            }
            else
            {
                Debug.WriteLine("CanInvoke said NO!");
            }
        }
Esempio n. 2
0
        //*****************************************************************************************
        //                              AudioChannel event handling
        //*****************************************************************************************

        /// <summary>
        /// Updates the status bar when the new Audio Channel state.
        /// </summary>
        void audioChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            this.BeginInvoke(new MethodInvoker(delegate()
            {
                //updates the status bar with the video channel state
                toolStripStatusLabelAudioChannel.Text = e.NewState.ToString();
            }));
        }
Esempio n. 3
0
 private void OnAudioChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
 {
     _log.Debug("OnAudioChannelStateChanged  NewState:{0}", e.NewState.ToString());
     ////posts the execution into the UI thread
     //this.BeginInvoke(new MethodInvoker(delegate ()
     //{
     //	//updates the status bar with the video channel state
     //	toolStripStatusLabelAudioChannel.Text = e.NewState.ToString();
     //}));
     if (e.NewState == ChannelState.Inactive)
     {
     }
 }
Esempio n. 4
0
        private void OnVideoChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            RunAtUI(() =>
            {
                //*****************************************************************************************
                //                              Video Content
                //
                // The video content is only available when the Lync client is running in UISuppressionMode.
                //
                // The video content is not directly accessible as a stream. It's rather available through
                // a video window that can de drawn in any panel or window.
                //
                // The outgoing video is accessible from videoChannel.CaptureVideoWindow
                // The window will be available when the video channel state is either Send or SendReceive.
                //
                // The incoming video is accessible from videoChannel.RenderVideoWindow
                // The window will be available when the video channel state is either Receive or SendReceive.
                //
                //*****************************************************************************************

                _log.Debug("OnVideoChannelStateChanged  OldState:{0} NewState:{1} channel:{2}  channelCode:{3}"
                           , e.OldState.ToString()
                           , e.NewState.ToString()
                           , sender.ToString()
                           , sender.GetHashCode()
                           );


                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send ||
                     e.NewState == ChannelState.SendReceive) && _videoChannel.CaptureVideoWindow != null)
                {
                    LocalParticipantVideoModel.View = _videoChannel.CaptureVideoWindow;
                    ShowVideoPartView?.Invoke();
                    //presents the video in the panel
                    //  ShowVideo(panelOutgoingVideo, _videoChannel.CaptureVideoWindow);
                }

                //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Receive ||
                     e.NewState == ChannelState.SendReceive) && _videoChannel.RenderVideoWindow != null)
                {
                    //presents the video in the panel
                    // SetParticipantVideoWindow(_videoChannel, _videoChannel.RenderVideoWindow);
                }
            });
        }
Esempio n. 5
0
        private void OnParticipantVideoChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            RunAtUI(() =>
            {
                _log.Debug("OnParticipantVideoChannelStateChanged  OldState:{0} NewState:{1} Channel:{2} ChannelCode:{3}"
                           , e.OldState.ToString()
                           , e.NewState.ToString()
                           , sender.ToString()
                           , sender.GetHashCode()
                           );

                var channel = sender as VideoChannel;

                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send ||
                     e.NewState == ChannelState.SendReceive) && _videoChannel.CaptureVideoWindow != null)
                {
                    ParticipantCollection.UpdateVideoWindow(channel, _videoChannel.CaptureVideoWindow, true);
                    //SetParticipantVideoWindow(channel, _videoChannel.CaptureVideoWindow);
                }


                if (e.NewState == ChannelState.Receive && _videoChannel.RenderVideoWindow != null)
                {
                    if (RemoteConnectParticipantVideoModel != null)
                    {
                        RemoteConnectParticipantVideoModel.View = null;
                    }
                    RemoteConnectParticipantVideoModel = null;
                }


                //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                if (
                    e.NewState == ChannelState.SendReceive && _videoChannel.RenderVideoWindow != null)
                {
                    ParticipantCollection.UpdateVideoWindow(channel, _videoChannel.RenderVideoWindow, false);

                    ShowVideoPartView?.Invoke();

                    SetParticipantVideoWindow(channel, _videoChannel.RenderVideoWindow);
                }
            });
        }
Esempio n. 6
0
        /// <summary>
        /// Called when the video state changes.
        ///
        /// Will show Incoming/Outgoing video based on the channel state.
        /// </summary>
        void videoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            this.BeginInvoke(new MethodInvoker(delegate()
            {
                //updates the status bar with the video channel state
                toolStripStatusLabelVideoChannel.Text = e.NewState.ToString();


                //*****************************************************************************************
                //                              Video Content
                //
                // The video content is only available when the Lync client is running in UISuppressionMode.
                //
                // The video content is not directly accessible as a stream. It's rather available through
                // a video window that can de drawn in any panel or window.
                //
                // The outgoing video is accessible from videoChannel.CaptureVideoWindow
                // The window will be available when the video channel state is either Send or SendReceive.
                //
                // The incoming video is accessible from videoChannel.RenderVideoWindow
                // The window will be available when the video channel state is either Receive or SendReceive.
                //
                //*****************************************************************************************

                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send ||
                     e.NewState == ChannelState.SendReceive) && videoChannel.CaptureVideoWindow != null)
                {
                    //presents the video in the panel
                    ShowVideo(panelOutgoingVideo, videoChannel.CaptureVideoWindow);
                }

                //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Receive ||
                     e.NewState == ChannelState.SendReceive) && videoChannel.RenderVideoWindow != null)
                {
                    //presents the video in the panel
                    ShowVideo(panelIncomingVideo, videoChannel.RenderVideoWindow);
                }
            }));
        }
Esempio n. 7
0
        /// <summary>
        /// Called when the video state changes.
        ///
        /// Will show Incoming/Outgoing video based on the channel state.
        /// </summary>
        void videoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            CommunicationManager.UiThreadControl.BeginInvoke(new MethodInvoker(delegate()
            {
                //*****************************************************************************************
                //                              Video Content
                //
                // The video content is only available when the Lync client is running in UISuppressionMode.
                //
                // The video content is not directly accessible as a stream. It's rather available through
                // a video window that can de drawn in any panel or window.
                //
                // The incoming video is accessible from videoChannel.RenderVideoWindow
                // The window will be available when the video channel state is either Receive or SendReceive.
                //
                //*****************************************************************************************

                //TODO: Temprary to see my own window
                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send ||
                     e.NewState == ChannelState.SendReceive) && videoChannel.CaptureVideoWindow != null)
                {
                    if (this.VideoCallStarted != null)
                    {
                        this.VideoCallStarted(null);
                    }

                    //presents the video in the panel
                    ShowVideo(parentHandle, bounds, videoChannel.CaptureVideoWindow);
                }

                // switch to see incoming
                ////if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                //if ((e.NewState == ChannelState.Receive
                //    || e.NewState == ChannelState.SendReceive) && videoChannel.RenderVideoWindow != null)
                //{
                //    //presents the video in the panel
                //    ShowVideo(parentHandle, bounds, videoChannel.CaptureVideoWindow);
                //}
            }));
        }
        private static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("Video Channel state change from {0} to {1}", e.OldState, e.NewState));
            var videoChannel = (VideoChannel)sender;



            if (_incomingChannelStates.Contains(e.NewState) && !_incomingChannelStates.Contains(e.OldState))    // Incoming newly available
            {
                RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (!_incomingChannelStates.Contains(e.NewState) && _incomingChannelStates.Contains(e.OldState))    // Incoming newly unavailable
            {
                RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }

            if (e.NewState == ChannelState.Send)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
            else if (e.NewState == ChannelState.Receive)
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
            else if (e.NewState == ChannelState.SendReceive)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
            else
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
        }
Esempio n. 9
0
        static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            var videoChannel = (VideoChannel)sender;

            if (_incomingChannelStates.Contains(e.NewState) && !_incomingChannelStates.Contains(e.OldState))    // Incoming newly available
            {
                RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (!_incomingChannelStates.Contains(e.NewState) && _incomingChannelStates.Contains(e.OldState))    // Incoming newly unavailable
            {
                RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }

            if (e.NewState == ChannelState.Send)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
            else if (e.NewState == ChannelState.Receive)
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
            else if (e.NewState == ChannelState.SendReceive)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
            else
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);
                }

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                {
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
                }
            }
        }
        private void VideoChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            this.SetVideoStatus(e.NewState.ToString());

            //*****************************************************************************************
            //                              Video Content
            //
            // The video content is only available when the Lync client is running in UISuppressionMode.
            //
            // The video content is not directly accessible as a stream. It's rather available through
            // a video window that can de drawn in any panel or window.
            //
            // The outgoing video is accessible from videoChannel.CaptureVideoWindow
            // The window will be available when the video channel state is either Send or SendReceive.
            //
            // The incoming video is accessible from videoChannel.RenderVideoWindow
            // The window will be available when the video channel state is either Receive or SendReceive.
            //
            //*****************************************************************************************

            // TODO: this one is working only if the app is located somewhere in user's directory due to some Windows user permissions.

            ////if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
            //if ((e.NewState == ChannelState.Send || e.NewState == ChannelState.SendReceive) &&
            //    videoChannel.CaptureVideoWindow != null)
            //{
            //    //presents the video in the panel
            //    //ShowVideo(this.outVideo, videoChannel.CaptureVideoWindow);
            //    ShowVideo(this.outVideo, videoChannel.CaptureVideoWindow);
            //}

            //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
            if ((e.NewState == ChannelState.Receive || e.NewState == ChannelState.SendReceive) &&
                videoChannel.RenderVideoWindow != null)
            {
                //presents the video in the panel
                //ShowVideo(this.inVideo, videoChannel.RenderVideoWindow);
                ShowVideo(this.inVideo, videoChannel.RenderVideoWindow);
            }
        }
 private void AudioChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
 {
     this.SetAudioStatus(e.NewState.ToString());
 }
Esempio n. 12
0
        private static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            if (e.NewState != ChannelState.Receive)
            {
                return;
            }

            var vc = (VideoChannel)sender;
            if (vc.CanInvoke(ChannelAction.Start))
            {
                vc.StartAsync().ContinueWith(t =>
                {
                    // Go looking around for the IM Window (there had better just be the one we just started)
                    // and force it to the foreground
                    IntPtr childHandle = UnsafeNativeMethods.FindWindowEx(IntPtr.Zero, IntPtr.Zero, "IMWindowClass", null);
                    UnsafeNativeMethods.SetForegroundWindow(childHandle);

                    // Try to get the video to go full screen by pressing F5
                    WindowsInput.InputSimulator.SimulateKeyPress(WindowsInput.VirtualKeyCode.F5);
                });
            }
            else
            {
                Debug.WriteLine("CanInvoke said NO!");
            }
        }
        static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            var videoChannel = (VideoChannel)sender;

            if (_incomingChannelStates.Contains(e.NewState) && !_incomingChannelStates.Contains(e.OldState))    // Incoming newly available
            {
                RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (!_incomingChannelStates.Contains(e.NewState) && _incomingChannelStates.Contains(e.OldState))    // Incoming newly unavailable
            {
                RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }

            if (e.NewState == ChannelState.Send)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (e.NewState == ChannelState.Receive)
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (e.NewState == ChannelState.SendReceive)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }

        }
        /// <summary>
        /// Called when the video state changes.
        /// 
        /// Will show Incoming/Outgoing video based on the channel state.
        /// </summary>
        void videoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            CommunicationManager.UiThreadControl.BeginInvoke(new MethodInvoker(delegate()
            {

                //*****************************************************************************************
                //                              Video Content
                //
                // The video content is only available when the Lync client is running in UISuppressionMode.
                //
                // The video content is not directly accessible as a stream. It's rather available through
                // a video window that can de drawn in any panel or window.
                //
                // The incoming video is accessible from videoChannel.RenderVideoWindow
                // The window will be available when the video channel state is either Receive or SendReceive.
                //
                //*****************************************************************************************

                //TODO: Temprary to see my own window
                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send
                    || e.NewState == ChannelState.SendReceive) && videoChannel.CaptureVideoWindow != null)
                {

                    if (this.VideoCallStarted != null)
                        this.VideoCallStarted(null);

                    //presents the video in the panel
                    ShowVideo(parentHandle, bounds, videoChannel.CaptureVideoWindow);
                }

                // switch to see incoming
                ////if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                //if ((e.NewState == ChannelState.Receive
                //    || e.NewState == ChannelState.SendReceive) && videoChannel.RenderVideoWindow != null)
                //{
                //    //presents the video in the panel
                //    ShowVideo(parentHandle, bounds, videoChannel.CaptureVideoWindow);
                //}

            }));
        }
Esempio n. 15
0
 private void channel_ChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
 {
     outputBox.Items.Add(string.Format("Channel: {0}", e.NewState));
 }
        private static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("Video Channel state change from {0} to {1}", e.OldState, e.NewState));
            var videoChannel = (VideoChannel)sender;



            if (_incomingChannelStates.Contains(e.NewState) && !_incomingChannelStates.Contains(e.OldState))    // Incoming newly available
            {
                RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (!_incomingChannelStates.Contains(e.NewState) && _incomingChannelStates.Contains(e.OldState))    // Incoming newly unavailable
            {
                RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }

            if (e.NewState == ChannelState.Send)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (e.NewState == ChannelState.Receive)
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else if (e.NewState == ChannelState.SendReceive)
            {
                // If outgoing is newly available, then raise the Available event
                if (!_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming is newly available, then raise the Available event
                if (_incomingVideoStreamStarted && !_incomingChannelStates.Contains(e.OldState))
                    RaiseVideoAvailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }
            else
            {
                // If outgoing was previously available, then raise the Unavailable event
                if (_outgoingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.CaptureVideoWindow, VideoDirection.Outgoing);

                // If incoming was previously available, then raise the Unavailable event
                if (_incomingVideoStreamStarted && _incomingChannelStates.Contains(e.OldState))
                    RaiseVideoUnavailable(videoChannel.RenderVideoWindow, VideoDirection.Incoming);
            }

        }
Esempio n. 17
0
        static void VideoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            VideoChannel vc = (VideoChannel)sender;

            //Are we receiving? Let's try to send!
            if (e.NewState == ChannelState.Receive)
            {
                if (vc.CanInvoke(ChannelAction.Start))
                {
                    vc.BeginStart(videoCallBack, vc);
                }
                else {  Debug.WriteLine("CanInvoke said NO!"); }

                //Go looking around for the IM Window (there had better just be the one we just started)
                // and force it to the foreground
                IntPtr childHandle = UnsafeNativeMethods.FindWindowEx(IntPtr.Zero, IntPtr.Zero, "IMWindowClass", null);
                UnsafeNativeMethods.SetForegroundWindow(childHandle);

                //Try to get the video to go full screen by pressing F5
                WindowsInput.InputSimulator.SimulateKeyPress(WindowsInput.VirtualKeyCode.F5);
            }
        }