ContextWindow: Use EnsureContextRenewed() correctly
This commit is contained in:
@@ -287,8 +287,7 @@ namespace Elwig.Windows {
|
|||||||
LockInputs();
|
LockInputs();
|
||||||
UnlockSearchInputs();
|
UnlockSearchInputs();
|
||||||
FinishInputFilling();
|
FinishInputFilling();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
RefreshInputs();
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
ViewModel.SearchQuery = "";
|
ViewModel.SearchQuery = "";
|
||||||
ControlUtils.SelectItem(AreaCommitmentList, AreaCommitmentList.ItemsSource.Cast<AreaCom>().Where(a => a.FbNr == fbnr).FirstOrDefault());
|
ControlUtils.SelectItem(AreaCommitmentList, AreaCommitmentList.ItemsSource.Cast<AreaCom>().Where(a => a.FbNr == fbnr).FirstOrDefault());
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Elwig.Windows {
|
|||||||
set {
|
set {
|
||||||
_lockContext = value;
|
_lockContext = value;
|
||||||
if (!_lockContext && _renewPending) {
|
if (!_lockContext && _renewPending) {
|
||||||
Dispatcher.BeginInvoke(async () => await RenewContext());
|
Dispatcher.BeginInvoke(async () => await EnsureContextRenewed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ namespace Elwig.Windows {
|
|||||||
public async Task HintContextChange() {
|
public async Task HintContextChange() {
|
||||||
_renewPending = true;
|
_renewPending = true;
|
||||||
if (LockContext) return;
|
if (LockContext) return;
|
||||||
await RenewContext();
|
await EnsureContextRenewed();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async void OnLoaded(object? sender, RoutedEventArgs? evt) {
|
protected async void OnLoaded(object? sender, RoutedEventArgs? evt) {
|
||||||
@@ -44,7 +44,7 @@ namespace Elwig.Windows {
|
|||||||
await OnRenewContext(ctx);
|
await OnRenewContext(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task RenewContext() {
|
protected async Task EnsureContextRenewed() {
|
||||||
if (!_renewPending) return;
|
if (!_renewPending) return;
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
await OnRenewContext(ctx);
|
await OnRenewContext(ctx);
|
||||||
|
|||||||
@@ -812,13 +812,11 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmptyScale();
|
EmptyScale();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
await RefreshDeliveryParts();
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
ControlUtils.SelectItem(DeliveryList, p?.Delivery);
|
ControlUtils.SelectItem(DeliveryList, p?.Delivery);
|
||||||
DeliveryPartList.SelectedItem = null;
|
DeliveryPartList.SelectedItem = null;
|
||||||
DeliveryPartList.ScrollIntoView(DeliveryPartList.ItemsSource.Cast<object>().Last());
|
DeliveryPartList.ScrollIntoView(DeliveryPartList.ItemsSource.Cast<object>().Last());
|
||||||
RefreshInputs();
|
|
||||||
InitialInputs();
|
InitialInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -851,8 +849,7 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmptyScale();
|
EmptyScale();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
await RefreshDeliveryParts();
|
|
||||||
if (p?.Delivery != null) {
|
if (p?.Delivery != null) {
|
||||||
try {
|
try {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
@@ -870,8 +867,7 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
DeliveryList.SelectedItem = null;
|
DeliveryList.SelectedItem = null;
|
||||||
await RenewContext();
|
await EnsureContextRenewed();
|
||||||
RefreshInputs();
|
|
||||||
InitInputs();
|
InitInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -902,7 +898,7 @@ namespace Elwig.Windows {
|
|||||||
DisableWeighingButtons();
|
DisableWeighingButtons();
|
||||||
HideFinishNewPartDeliveryCancelButtons();
|
HideFinishNewPartDeliveryCancelButtons();
|
||||||
ShowNewEditDeleteButtons();
|
ShowNewEditDeleteButtons();
|
||||||
await RenewContext();
|
await EnsureContextRenewed();
|
||||||
RefreshInputs();
|
RefreshInputs();
|
||||||
ClearInputStates();
|
ClearInputStates();
|
||||||
LockInputs();
|
LockInputs();
|
||||||
@@ -1082,9 +1078,7 @@ namespace Elwig.Windows {
|
|||||||
LockInputs();
|
LockInputs();
|
||||||
UnlockSearchInputs();
|
UnlockSearchInputs();
|
||||||
FinishInputFilling();
|
FinishInputFilling();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
await RefreshDeliveryParts();
|
|
||||||
RefreshInputs();
|
|
||||||
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
DepreciateButton.IsEnabled = true;
|
DepreciateButton.IsEnabled = true;
|
||||||
|
|||||||
@@ -374,8 +374,7 @@ namespace Elwig.Windows {
|
|||||||
LockInputs();
|
LockInputs();
|
||||||
ViewModel.EnableSearchInputs = true;
|
ViewModel.EnableSearchInputs = true;
|
||||||
FinishInputFilling();
|
FinishInputFilling();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
RefreshInputs();
|
|
||||||
ViewModel.SearchQuery = "";
|
ViewModel.SearchQuery = "";
|
||||||
ControlUtils.SelectItemWithPk(DeliveryScheduleList, year, dsnr);
|
ControlUtils.SelectItemWithPk(DeliveryScheduleList, year, dsnr);
|
||||||
if (sortid != null)
|
if (sortid != null)
|
||||||
|
|||||||
@@ -225,8 +225,7 @@ namespace Elwig.Windows {
|
|||||||
LockInputs();
|
LockInputs();
|
||||||
ViewModel.EnableSearchInputs = true;
|
ViewModel.EnableSearchInputs = true;
|
||||||
FinishInputFilling();
|
FinishInputFilling();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
RefreshInputs();
|
|
||||||
ViewModel.SearchQuery = "";
|
ViewModel.SearchQuery = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -436,8 +436,7 @@ namespace Elwig.Windows {
|
|||||||
UpdateContactInfoVisibility();
|
UpdateContactInfoVisibility();
|
||||||
ViewModel.EnableSearchInputs = true;
|
ViewModel.EnableSearchInputs = true;
|
||||||
FinishInputFilling();
|
FinishInputFilling();
|
||||||
await RefreshList();
|
await EnsureContextRenewed();
|
||||||
RefreshInputs();
|
|
||||||
ViewModel.SearchQuery = "";
|
ViewModel.SearchQuery = "";
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
if (mgnr is int m)
|
if (mgnr is int m)
|
||||||
|
|||||||
Reference in New Issue
Block a user