Beispiel #1
0
        private void ScannedLineupGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            Comparison <Channel> old_sort = current_scanned_sort_;
            Comparison <Channel> new_sort = null;
            ScannedGridColumn    column   = ScannedColumnToEnum(e.ColumnIndex);

            switch (column)
            {
            case ScannedGridColumn.Number:
                new_sort = CompareChannelNumbers;
                break;

            case ScannedGridColumn.Listing:
                new_sort = CompareListing;
                break;

            case ScannedGridColumn.Type:
                new_sort = CompareChannelType;
                break;

            case ScannedGridColumn.TunerCount:
                new_sort = CompareTunerCount;
                break;

            case ScannedGridColumn.Encrypted:
                new_sort = CompareScannedEncrypted;
                break;

            case ScannedGridColumn.TuningParams:
                new_sort = CompareTuningParams;
                break;

            case ScannedGridColumn.Callsign:
                new_sort = CompareCallsigns;
                break;
            }
            if (new_sort == null)
            {
                return;
            }
            reverse_scanned_sort_ = (new_sort == old_sort) && !reverse_scanned_sort_;
            current_scanned_sort_ = new_sort;
            SortScannedChannels();
            ScannedLineupGridView.Invalidate();
        }
Beispiel #2
0
        private void SelectScannedChannel(Channel scanned_channel)
        {
            int scanned_channel_index = -1;

            for (int index = 0; index < scanned_channels_.Count; ++index)
            {
                if (scanned_channels_[index].StoredObjectGuid == scanned_channel.StoredObjectGuid)
                {
                    scanned_channel_index = index;
                    break;
                }
            }
            if (scanned_channel_index >= 0)
            {
                ScannedLineupGridView.ClearSelection();
                ScannedLineupGridView.CurrentCell = ScannedLineupGridView.Rows[scanned_channel_index].Cells[0];
                foreach (DataGridViewCell cell in ScannedLineupGridView.Rows[scanned_channel_index].Cells)
                {
                    cell.Selected = true;
                }
                if (ScannedLineupGridView.FirstDisplayedScrollingRowIndex > scanned_channel_index)
                {
                    ScannedLineupGridView.FirstDisplayedScrollingRowIndex = scanned_channel_index;
                }
                else
                {
                    if (ScannedLineupGridView.DisplayedRowCount(false) + ScannedLineupGridView.FirstDisplayedScrollingRowIndex <= scanned_channel_index)
                    {
                        ScannedLineupGridView.FirstDisplayedScrollingRowIndex = scanned_channel_index - ScannedLineupGridView.DisplayedRowCount(false) + 1;
                    }
                }
            }
        }