Extract ControlUtils from Utils

This commit is contained in:
2023-07-21 18:31:57 +02:00
parent 5cee928978
commit fd7a15bc5a
7 changed files with 272 additions and 263 deletions

View File

@ -41,7 +41,7 @@ namespace Elwig.Windows {
private async Task RefreshAreaCommitmentListQuery() {
List<AreaCom> areaComs = await Context.AreaCommitments.Where(a => a.MgNr == Member.MgNr).OrderBy(a => a.FbNr).ToListAsync();
Utils.RenewItemsSource(AreaCommitmentList, areaComs, i => (i as AreaCom)?.FbNr);
ControlUtils.RenewItemsSource(AreaCommitmentList, areaComs, i => (i as AreaCom)?.FbNr);
if (areaComs.Count == 1)
AreaCommitmentList.SelectedIndex = 0;
@ -102,10 +102,10 @@ namespace Elwig.Windows {
protected override async Task RenewContext() {
await base.RenewContext();
Utils.RenewItemsSource(KgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
Utils.RenewItemsSource(WineVarietyInput, await Context.WineVarieties.OrderBy(v => v.Name).ToListAsync(), i => (i as WineVar)?.SortId);
Utils.RenewItemsSource(AttributesInput, await Context.WineAttributes.OrderBy(a => a.Name).ToListAsync(), i => (i as WineAttr)?.AttrId);
Utils.RenewItemsSource(WineCultivationInput, await Context.WineCultivations.OrderBy(c => c.Name).ToListAsync(), i => (i as WineCult)?.CultId);
ControlUtils.RenewItemsSource(KgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
ControlUtils.RenewItemsSource(WineVarietyInput, await Context.WineVarieties.OrderBy(v => v.Name).ToListAsync(), i => (i as WineVar)?.SortId);
ControlUtils.RenewItemsSource(AttributesInput, await Context.WineAttributes.OrderBy(a => a.Name).ToListAsync(), i => (i as WineAttr)?.AttrId);
ControlUtils.RenewItemsSource(WineCultivationInput, await Context.WineCultivations.OrderBy(c => c.Name).ToListAsync(), i => (i as WineCult)?.CultId);
await RefreshAreaCommitmentList();
}
@ -301,7 +301,7 @@ namespace Elwig.Windows {
if (curr_kg != null) {
var rdList = await Context.WbRde.Where(r => r.KgNr == curr_kg.KgNr).OrderBy(r => r.Name).Cast<object>().ToListAsync();
rdList.Insert(0, new NullItem());
Utils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr);
ControlUtils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr);
}
ComboBox_SelectionChanged(sender, evt);
}