Example #1
0
        /*private void moveProgressBar()
         * {
         *  _currentProgressBar.Invoke((MethodInvoker )delegate {
         *      int curValue = Convert.ToInt32(_playbackController.PlaybackTime.Subtract(_currentSequenceStartTime).TotalSeconds);
         *      _currentProgressBar.Value = curValue;
         *  });
         * }*/

        private void _bitmapSource_NewBitmapEvent(Bitmap bitmap)
        {
            Control hostElement = _currentVideoPanel.Parent;

            if (hostElement.InvokeRequired)
            {
                try
                {
                    if (_currentOriginalBitmap != null)
                    {
                        _currentOriginalBitmap.Dispose();
                    }
                    _currentOriginalBitmap = new Bitmap(bitmap);
                    bitmap.Dispose();

                    hostElement.BeginInvoke(new MethodInvoker(() => _bitmapSource_NewBitmapEvent(_currentOriginalBitmap)));
                }
                catch
                {
                }
            }
            else
            {
                lock (hostElement)
                {
                    try
                    {
                        _videoPictureBox.Image = new Bitmap(bitmap, _videoPictureBox.Width, _videoPictureBox.Height);
                        //hostElement.Refresh();
                        _videoPictureBox.Refresh();
                    }
                    catch
                    {
                    }
                }
            }
        }