ContextWindow: Add HasContextLoaded property
This commit is contained in:
@@ -122,7 +122,8 @@ namespace Elwig.Windows {
|
||||
Menu_Export_UploadSeason.IsEnabled = App.Config.SyncUrl != null;
|
||||
}
|
||||
|
||||
public DeliveryAdminWindow(int mgnr) : this() {
|
||||
public DeliveryAdminWindow(int mgnr) :
|
||||
this() {
|
||||
ViewModel.FilterMember = DeliveryService.GetMember(mgnr) ?? throw new ArgumentException("MgNr argument has invalid value");
|
||||
ViewModel.Title = $"Lieferungen - {ViewModel.FilterMember.AdministrativeName} - Elwig";
|
||||
ViewModel.EnableAllSeasons = true;
|
||||
@@ -132,7 +133,6 @@ namespace Elwig.Windows {
|
||||
await base.OnInit(ctx);
|
||||
OnSecondPassed(null, null);
|
||||
SecondsTimer.Start();
|
||||
LockInputs();
|
||||
if (ViewModel.IsReceipt) {
|
||||
NewDeliveryButton_Click(null, null);
|
||||
if (await ctx.FetchSeasons(Utils.CurrentYear).SingleOrDefaultAsync() == null) {
|
||||
@@ -541,8 +541,6 @@ namespace Elwig.Windows {
|
||||
|
||||
await RefreshList();
|
||||
|
||||
var d = DeliveryList.SelectedItem as Delivery;
|
||||
var y = d?.Year ?? ViewModel.FilterSeason ?? Utils.CurrentYear;
|
||||
ControlUtils.RenewItemsSource(MemberInput, await ctx.FetchMembers(includeNotActive: !IsCreating, includeContactInfo: true).ToListAsync());
|
||||
ControlUtils.RenewItemsSource(BranchInput, await ctx.FetchBranches().ToListAsync());
|
||||
ControlUtils.RenewItemsSource(WineVarietyInput, await ctx.FetchWineVarieties().ToListAsync());
|
||||
@@ -678,17 +676,19 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void SearchInput_TextChanged(object sender, RoutedEventArgs evt) {
|
||||
if (!HasContextLoaded) return;
|
||||
await RefreshList(true);
|
||||
}
|
||||
|
||||
private async void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
if (ViewModel.FilterSeason == null || TodayOnlyInput == null || AllSeasonsInput == null) return;
|
||||
if (!HasContextLoaded || ViewModel.FilterSeason == null || TodayOnlyInput == null || AllSeasonsInput == null) return;
|
||||
TodayOnlyInput.IsChecked = false;
|
||||
AllSeasonsInput.IsChecked = false;
|
||||
await RefreshList();
|
||||
}
|
||||
|
||||
private async void TodayOnlyInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
if (!HasContextLoaded) return;
|
||||
if (TodayOnlyInput.IsChecked == true && AllSeasonsInput.IsChecked == false) {
|
||||
ViewModel.FilterSeason = Utils.Today.Year;
|
||||
ViewModel.FilterTodayOnly = true;
|
||||
@@ -697,6 +697,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void AllSeasonsInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
if (!HasContextLoaded) return;
|
||||
if (AllSeasonsInput.IsChecked == true) {
|
||||
SeasonInput.IsEnabled = false;
|
||||
ViewModel.FilterSeason = null;
|
||||
|
||||
Reference in New Issue
Block a user