Merge branch 'master' of https://github.com/rmcrackan/Libation
This commit is contained in:
commit
62c98c66a3
@ -1,15 +1,15 @@
|
|||||||
using System;
|
using ApplicationServices;
|
||||||
|
using DataLayer;
|
||||||
|
using Dinah.Core.DataBinding;
|
||||||
|
using InternalUtilities;
|
||||||
|
using LibationWinForms.Login;
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ApplicationServices;
|
|
||||||
using DataLayer;
|
|
||||||
using Dinah.Core.DataBinding;
|
|
||||||
using InternalUtilities;
|
|
||||||
using LibationWinForms.Login;
|
|
||||||
|
|
||||||
namespace LibationWinForms.Dialogs
|
namespace LibationWinForms.Dialogs
|
||||||
{
|
{
|
||||||
@ -33,8 +33,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
_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,9 +46,9 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +123,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