Ejemplo n.º 1
0
        private void InitializeVideo()
        {
            _imageViewerControl      = ClientControl.Instance.GenerateImageViewerControl();
            _imageViewerControl.Dock = DockStyle.Fill;
            panel1.Controls.Clear();
            panel1.Controls.Add(_imageViewerControl);
            _imageViewerControl.CameraFQID = _selectItem.FQID;
            _imageViewerControl.MaintainImageAspectRatio = true;
            _imageViewerControl.Initialize();
            _imageViewerControl.Connect();
            _imageViewerControl.Selected = true;

            _bitmapLiveSource = new BitmapLiveSource(_selectItem, BitmapFormat.BGR24);
            _bitmapLiveSource.LiveContentEvent += new EventHandler(BitmapLiveSourceLiveContentEvent);
            try
            {
                _bitmapLiveSource.Width  = pictureBoxEnhanced.Width;
                _bitmapLiveSource.Height = pictureBoxEnhanced.Height;
                _bitmapLiveSource.SetKeepAspectRatio(true, true);
                _bitmapLiveSource.Init();
                _bitmapLiveSource.LiveModeStart = true;
            } catch (Exception ex)
            {
                MessageBox.Show("Unable to connect to recording server:" + ex.Message);
            }
        }
 private void CloseLiveSession()
 {
     _stopLive = true;
     if (_bitmapLiveSource != null)
     {
         _bitmapLiveSource.LiveContentEvent -= BitmapLiveSourceLiveContentEvent;
         _bitmapLiveSource.LiveModeStart     = false;
         _bitmapLiveSource.Close();
         _bitmapLiveSource = null;
     }
     if (pictureBox.Height != 0 && pictureBox.Width != 0)
     {
         pictureBox.Image = new Bitmap(_blackImage, pictureBox.Size);
     }
 }
Ejemplo n.º 3
0
 private void TerminateVideo()
 {
     if (_bitmapLiveSource != null)
     {
         _bitmapLiveSource.LiveContentEvent -= new EventHandler(BitmapLiveSourceLiveContentEvent);
         _bitmapLiveSource.LiveModeStart     = false;
         _bitmapLiveSource.Close();
         _bitmapLiveSource = null;
     }
     if (_imageViewerControl != null)
     {
         _imageViewerControl.Disconnect();
         _imageViewerControl.Close();
         _imageViewerControl = null;
     }
 }
 private void OpenLiveSession()
 {
     if (_viewItemManager.SelectedCamera != null)
     {
         _selectedItem = Configuration.Instance.GetItem(_viewItemManager.SelectedCamera.FQID);
         if (_selectedItem != null)
         {
             _bitmapLiveSource = new BitmapLiveSource(_selectedItem, BitmapFormat.BGR24);
             _bitmapLiveSource.LiveContentEvent += BitmapLiveSourceLiveContentEvent;
             _bitmapLiveSource.Width             = pictureBox.Width;
             _bitmapLiveSource.Height            = pictureBox.Height;
             _bitmapLiveSource.SetKeepAspectRatio(true, true);
             _bitmapLiveSource.Init();
             _bitmapLiveSource.LiveModeStart    = true;
             _bitmapLiveSource.SingleFrameQueue = true;                                  // New property from MIPSDK 2014
             _stopLive = false;
         }
     }
 }