Fix crash when checkbox checked via spacebar.
This commit is contained in:
parent
76cb280933
commit
d2892f9076
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ApplicationServices;
|
using ApplicationServices;
|
||||||
using DataLayer;
|
using DataLayer;
|
||||||
|
using Dinah.Core.Threading;
|
||||||
using Dinah.Core.DataBinding;
|
using Dinah.Core.DataBinding;
|
||||||
using InternalUtilities;
|
using InternalUtilities;
|
||||||
using LibationWinForms.Login;
|
using LibationWinForms.Login;
|
||||||
@ -32,9 +33,8 @@ namespace LibationWinForms.Dialogs
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_labelFormat = label1.Text;
|
_labelFormat = label1.Text;
|
||||||
|
|
||||||
_dataGridView.CellContentClick += (s, e) => _dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
|
_dataGridView.CellContentClick +=(s,e) => _dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
|
||||||
_dataGridView.CellValueChanged += DataGridView1_CellValueChanged;
|
_dataGridView.BindingContextChanged += _dataGridView_BindingContextChanged;
|
||||||
_dataGridView.BindingContextChanged += (s, e) => UpdateSelection();
|
|
||||||
|
|
||||||
var orderedGridEntries = _libraryBooks
|
var orderedGridEntries = _libraryBooks
|
||||||
.Select(lb => new RemovableGridEntry(lb))
|
.Select(lb => new RemovableGridEntry(lb))
|
||||||
@ -47,10 +47,10 @@ namespace LibationWinForms.Dialogs
|
|||||||
_dataGridView.Enabled = false;
|
_dataGridView.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
private void _dataGridView_BindingContextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ColumnIndex == 0)
|
_dataGridView.Sort(_dataGridView.Columns[0], ListSortDirection.Descending);
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void RemoveBooksDialog_Shown(object sender, EventArgs e)
|
private async void RemoveBooksDialog_Shown(object sender, EventArgs e)
|
||||||
@ -124,7 +124,6 @@ namespace LibationWinForms.Dialogs
|
|||||||
}
|
}
|
||||||
private void UpdateSelection()
|
private void UpdateSelection()
|
||||||
{
|
{
|
||||||
_dataGridView.Sort(_dataGridView.Columns[0], ListSortDirection.Descending);
|
|
||||||
var selectedCount = SelectedCount;
|
var selectedCount = SelectedCount;
|
||||||
label1.Text = string.Format(_labelFormat, selectedCount, selectedCount != 1 ? "s" : string.Empty);
|
label1.Text = string.Format(_labelFormat, selectedCount, selectedCount != 1 ? "s" : string.Empty);
|
||||||
btnRemoveBooks.Enabled = selectedCount > 0;
|
btnRemoveBooks.Enabled = selectedCount > 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user