Beispiel #1
0
 private void OnRefreshSeqAsync(object sender, EventArgs e)
 {
     if (_item != null)
     {
         SequenceDataSource dataSource = new SequenceDataSource(_item);
         dataSource.GetDataAsync(listBox1, DateTime.Now, new TimeSpan(24, 0, 0), 5, new TimeSpan(0, 0, 0), 0, AsyncSeqHandler);
     }
 }
Beispiel #2
0
 private void OnRefreshMDAsync(object sender, EventArgs e)
 {
     if (_item != null)
     {
         SequenceDataSource dataSource = new SequenceDataSource(_item);
         dataSource.GetDataAsync(listBox1, DateTime.Now, new TimeSpan(24, 0, 0), 5, new TimeSpan(0, 0, 0), 0, VideoOS.Platform.Data.DataType.SequenceTypeGuids.MotionSequence, AsyncSeqHandler);
     }
 }
        private void SetShowTime(long offset)
        {
            if (_timeBeforeMouseMove.Ticks == 0 || pictureBox.Height == 0)
            {
                return;
            }

            _currentTime = _timeBeforeMouseMove + TimeSpan.FromTicks(offset);

            _startTime = _currentTime - TimeSpan.FromMinutes(30);
            _endTime   = _currentTime + TimeSpan.FromMinutes(30);

            _graphics.Dispose();
            _timeLine = new Bitmap(pictureBox.Width, pictureBox.Height);
            _graphics = Graphics.FromImage(_timeLine);

            _ticksPerPixel  = (_endTime.Ticks - _startTime.Ticks) / _timeLine.Height;
            _ticksPerMouseY = (_endTime.Ticks - _startTime.Ticks) / pictureBox.Height;

            _graphics.FillRectangle(Brushes.Black, 0, 0, _timeLine.Width, _timeLine.Height);
            _graphics.DrawLine(Pens.White, new Point(0, _timeLine.Height / 2), new Point(_timeLine.Width, _timeLine.Height / 2));

            pictureBox.Image = new Bitmap(_timeLine, pictureBox.Size);

            labelStartTime.Text   = _startTime.ToShortTimeString();
            labelEndTime.Text     = _endTime.ToShortTimeString();
            labelCurrent.Text     = _currentTime.ToShortTimeString();
            labelCurrent.Location = new Point(labelCurrent.Location.X, pictureBox.Location.Y + pictureBox.Height / 2 - 8);

            if (_isRequestInProgress == false && _isMouseDown == false)
            {
                if (_startTime < _minRequested)
                {
                    TimeSpan ts = TimeSpan.FromHours(1);
                    if (_endTime > _minRequested)
                    {
                        ts = (_startCache - _startTime) - TimeSpan.FromSeconds(5);
                    }

                    _isRequestInProgress = true;
                    if (_isMotionSequencesSupported)
                    {
                        _dataSource.GetDataAsync(_syncState, _startTime.ToUniversalTime(), TimeSpan.FromSeconds(0), 0, ts, 300,
                                                 VideoOS.Platform.Data.DataType.SequenceTypeGuids.MotionSequence,
                                                 new AsyncCallbackHandler(SequenceHandler));
                    }

                    if (_isRecordingSequencesSupported)
                    {
                        _dataSource.GetDataAsync(_syncState, _startTime.ToUniversalTime(), TimeSpan.FromSeconds(0), 0, ts, 300,
                                                 VideoOS.Platform.Data.DataType.SequenceTypeGuids.RecordingSequence,
                                                 new AsyncCallbackHandler(SequenceRecordingsHandler));
                    }


                    Debug.WriteLine("Seq Request:" + _startTime.ToUniversalTime().ToShortTimeString() + " ... " + ts.ToString());

                    if (_startTime < _minRequested)
                    {
                        _minRequested = _startTime;
                    }
                    if (_endTime > _maxRequested)
                    {
                        _maxRequested = _endTime;
                    }
                }
                else if (_maxRequested < _endTime)
                {
                    DateTime startRequest = _startTime;
                    if (_startTime < _maxRequested)
                    {
                        startRequest = _maxRequested;
                    }
                    TimeSpan ts = _endTime - startRequest;
                    _isRequestInProgress = true;
                    if (_isMotionSequencesSupported)
                    {
                        _dataSource.GetDataAsync(_syncState, startRequest.ToUniversalTime(), TimeSpan.FromSeconds(0), 0, ts, 300,
                                                 VideoOS.Platform.Data.DataType.SequenceTypeGuids.MotionSequence,
                                                 new AsyncCallbackHandler(SequenceHandler));
                    }

                    if (_isRecordingSequencesSupported)
                    {
                        _dataSource.GetDataAsync(_syncState, startRequest.ToUniversalTime(), TimeSpan.FromSeconds(0), 0, ts, 300,
                                                 VideoOS.Platform.Data.DataType.SequenceTypeGuids.RecordingSequence,
                                                 new AsyncCallbackHandler(SequenceRecordingsHandler));
                    }

                    Debug.WriteLine("Seq Request:" + startRequest.ToUniversalTime().ToShortTimeString() + " ... " + ts.ToString());

                    if (_startTime < _minRequested)
                    {
                        _minRequested = _startTime;
                    }
                    if (_endTime > _maxRequested)
                    {
                        _maxRequested = _endTime;
                    }
                }
            }
            DisplayLine();
        }