Beispiel #1
0
        /// ------------------------------------------------------------------------------------
        protected override void OnMouseClick(DataGridViewCellMouseEventArgs e)
        {
            base.OnMouseClick(e);

            if (e.RowIndex != _grid.CurrentCellAddress.Y || !IsMouseIsOverButtonArea ||
                e.Button != MouseButtons.Left)
            {
                return;
            }

            if (_grid.PlaybackInProgress)
            {
                _grid.Stop();
            }
            else
            {
                _grid.Play();
            }

            _grid.InvalidateCell(this);
        }
        /// ------------------------------------------------------------------------------------
        private void HandleResegmentButtonClick(object sender, EventArgs e)
        {
            var  originallySelectedCell    = _grid.CurrentCellAddress;
            bool startPlayBackWhenFinished = false;

            ShowSegmentationDialog(delegate
            {
                if (ManualSegmenterDlg.ShowDialog(AssociatedComponentFile, this, _grid.CurrentCellAddress.Y) != null)
                {
                    if (!_grid.IsDisposed)
                    {
                        if (originallySelectedCell != _grid.CurrentCellAddress)
                        {
                            // User has already selected a different cell, so go ahead and
                            // start playback after refreshing the grid.
                            originallySelectedCell    = _grid.CurrentCellAddress;
                            startPlayBackWhenFinished = true;
                        }
                        SetComponentFile(_file);
                        if (_grid.RowCount > originallySelectedCell.Y && originallySelectedCell.Y >= 0 &&
                            _grid.ColumnCount > originallySelectedCell.X && originallySelectedCell.X >= 0)
                        {
                            _grid.CurrentCell = _grid.Rows[originallySelectedCell.Y].Cells[originallySelectedCell.X];
                        }
                        else
                        {
                            startPlayBackWhenFinished = false;                                     // Oops, that cell is gone!
                        }
                    }
                }
            });
            if (startPlayBackWhenFinished)
            {
                _grid.Play();
            }
        }