AreaComAdminWindow: Fix crashing when not selecting a reed
This commit is contained in:
@ -24,7 +24,7 @@ namespace Elwig.Windows {
|
|||||||
AreaCommitmentResetButton, AreaCommitmentCancelButton
|
AreaCommitmentResetButton, AreaCommitmentCancelButton
|
||||||
};
|
};
|
||||||
RequiredInputs = new Control[] {
|
RequiredInputs = new Control[] {
|
||||||
FbNrInput, YearFromInput, KgInput,
|
FbNrInput, YearFromInput, KgInput, RdInput,
|
||||||
GstNrInput, AreaInput, AreaComTypeInput, WineCultivationInput
|
GstNrInput, AreaInput, AreaComTypeInput, WineCultivationInput
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -281,10 +281,10 @@ namespace Elwig.Windows {
|
|||||||
if (KgInput.SelectedItem is AT_Kg curr_kg) {
|
if (KgInput.SelectedItem is AT_Kg curr_kg) {
|
||||||
var rdList = await Context.WbRde.Where(r => r.KgNr == curr_kg.KgNr).OrderBy(r => r.Name).Cast<object>().ToListAsync();
|
var rdList = await Context.WbRde.Where(r => r.KgNr == curr_kg.KgNr).OrderBy(r => r.Name).Cast<object>().ToListAsync();
|
||||||
rdList.Insert(0, new NullItem());
|
rdList.Insert(0, new NullItem());
|
||||||
ControlUtils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr);
|
ControlUtils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr, null, ControlUtils.RenewSourceDefault.First);
|
||||||
} else {
|
} else {
|
||||||
var rdList = new object[] { new NullItem() };
|
var rdList = new object[] { new NullItem() };
|
||||||
ControlUtils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr);
|
ControlUtils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr, null, ControlUtils.RenewSourceDefault.First);
|
||||||
}
|
}
|
||||||
ComboBox_SelectionChanged(sender, evt);
|
ComboBox_SelectionChanged(sender, evt);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user