示例#1
0
        private void DeviceProxy_ConnectionStateChanged(object eventSource, Bosch.VideoSDK.Device.ConnectResultEnum state)
        {
            if (state == Bosch.VideoSDK.Device.ConnectResultEnum.creConnectionTerminated)
            {
                m_cameo.SetVideoStream(null);
                m_deviceProxy.ConnectionStateChanged -= new Bosch.VideoSDK.GCALib._IDeviceProxyEvents_ConnectionStateChangedEventHandler(DeviceProxy_ConnectionStateChanged);
                m_deviceProxy = null;
                m_state       = State.Disconnected;

                UpdateGUI();
            }
        }
示例#2
0
        private void DeviceConnector_ConnectResult(Bosch.VideoSDK.Device.ConnectResultEnum connectResult, string url, Bosch.VideoSDK.Device.DeviceProxy deviceProxy)
        {
            bool success = false;

            if (connectResult == Bosch.VideoSDK.Device.ConnectResultEnum.creInitialized)
            {
                if (deviceProxy.VideoInputs.Count > 0)
                {
                    success = true;

                    try
                    {
                        m_cameo.SetVideoStream(deviceProxy.VideoInputs[1].Stream);
                        this.m_videoInputVCAEvents      = deviceProxy.VideoInputs[(object)1] as Bosch.VideoSDK.GCALib._IVideoInputVCAEvents_Event;
                        m_axCameo.VcaConfig.DisplayMode = Bosch.VideoSDK.Live.VcaDisplayModes.vcmRenderVCD;

                        if (this.m_videoInputVCAEvents != null)
                        {
                            // ISSUE: method pointer
                            m_videoInputVCAEvents.MotionDetectorsStateChanged += new Bosch.VideoSDK.GCALib._IVideoInputVCAEvents_MotionDetectorsStateChangedEventHandler(VideoInputVCAEvents_MotionDetectorsStateChanged);
                            //this.m_videoInputVCAEvents.add_MotionDetectorsStateChanged(new _IVideoInputVCAEvents_MotionDetectorsStateChangedEventHandler((object) this, (UIntPtr) __methodptr(VideoInputVCAEvents_MotionDetectorsStateChanged)));
                        }
                    }
                    catch (Exception ex)
                    {
                        CheckException(ex, "Failed to render first video stream of {0}", url);
                        success = false;
                    }
                }
            }

            if (success)
            {
                m_deviceProxy = deviceProxy;
                m_deviceProxy.ConnectionStateChanged += new Bosch.VideoSDK.GCALib._IDeviceProxyEvents_ConnectionStateChangedEventHandler(DeviceProxy_ConnectionStateChanged);
                m_state = State.Connected;
            }
            else
            {
                if (deviceProxy != null)
                {
                    deviceProxy.Disconnect();
                }
                m_state = State.Disconnected;
                MessageBox.Show("Failed to connect to \"" + url + "\".");
            }

            UpdateGUI();
        }