ControlUtils: Cleanup SelectItem() method and use accordingly

This commit is contained in:
2024-03-18 17:55:27 +01:00
parent 51e345f1fd
commit 2f3524db9d
20 changed files with 181 additions and 194 deletions

View File

@ -22,12 +22,12 @@ namespace Elwig.Windows {
_attrList = new(await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync());
_attrs = _attrList.ToDictionary(a => a.AttrId, a => (string?)a.AttrId);
_attrIds = _attrList.ToDictionary(a => a, a => a.AttrId);
ControlUtils.RenewItemsSource(WineAttributeList, _attrList, a => (a as WineAttr)?.AttrId);
ControlUtils.RenewItemsSource(WineAttributeList, _attrList);
WineAttributeList_SelectionChanged(null, null);
}
private async Task WineAttributesFinishEditing(AppDbContext ctx) {
ControlUtils.RenewItemsSource(WineAttributeList, await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync(), a => (a as WineAttr)?.AttrId);
ControlUtils.RenewItemsSource(WineAttributeList, await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync());
_attrList = null;
_attrs = null;
_attrIds = null;