Compare commits

..

3 Commits

Author SHA1 Message Date
b1075d1e69 DeliveryAdminWindow: Ensure that bulk actions are not performed while editing or creating
All checks were successful
Test / Run tests (push) Successful in 2m1s
2026-03-16 22:58:35 +01:00
cc018ded10 ContextWindow: Use EnsureContextRenewed() correctly 2026-03-16 22:58:04 +01:00
0aefab5d63 DeliveryConfirmation: Fix text alignment
All checks were successful
Test / Run tests (push) Successful in 2m3s
2026-03-16 19:47:33 +01:00
8 changed files with 24 additions and 28 deletions

View File

@@ -120,8 +120,8 @@ namespace Elwig.Documents {
}
if (i == p.Buckets.Length - 1) {
sub.AddCell(NewTd($"{p.Weight:N0}"));
sub.AddCell(NewTd(p.IsNetWeight ? "\u2611" : "\u2610", 7, center: true).SetFont(SF).SetPadding(0));
sub.AddCell(NewTd($"{p.Weight:N0}", right: true));
sub.AddCell(NewTd(p.IsNetWeight ? "\u2611" : "\u2610", 7, right: true).SetFont(SF).SetPadding(0));
} else {
sub.AddCell(NewCell(colspan: 2));
}

View File

@@ -297,7 +297,7 @@ namespace Elwig.Documents {
protected Cell NewTh(string? text, float fontSize = 8, int rowspan = 1, int colspan = 1, bool left = false, bool rotated = false) {
var p = new KernedParagraph(text ?? "", fontSize);
if (rotated) p.SetRotationAngle(rotated ? 0.5 * Math.PI : 0);
if (rotated) p.SetRotationAngle(0.5 * Math.PI);
var cell = NewCell(p, rowspan: rowspan, colspan: colspan)
.SetTextAlignment(left ? TextAlignment.LEFT : TextAlignment.CENTER)
.SetVerticalAlignment(VerticalAlignment.MIDDLE)

View File

@@ -287,8 +287,7 @@ namespace Elwig.Windows {
LockInputs();
UnlockSearchInputs();
FinishInputFilling();
await RefreshList();
RefreshInputs();
await EnsureContextRenewed();
Mouse.OverrideCursor = null;
ViewModel.SearchQuery = "";
ControlUtils.SelectItem(AreaCommitmentList, AreaCommitmentList.ItemsSource.Cast<AreaCom>().Where(a => a.FbNr == fbnr).FirstOrDefault());

View File

@@ -13,7 +13,7 @@ namespace Elwig.Windows {
set {
_lockContext = value;
if (!_lockContext && _renewPending) {
Dispatcher.BeginInvoke(async () => await RenewContext());
Dispatcher.BeginInvoke(async () => await EnsureContextRenewed());
}
}
}
@@ -36,7 +36,7 @@ namespace Elwig.Windows {
public async Task HintContextChange() {
_renewPending = true;
if (LockContext) return;
await RenewContext();
await EnsureContextRenewed();
}
protected async void OnLoaded(object? sender, RoutedEventArgs? evt) {
@@ -44,7 +44,7 @@ namespace Elwig.Windows {
await OnRenewContext(ctx);
}
protected async Task RenewContext() {
protected async Task EnsureContextRenewed() {
if (!_renewPending) return;
using var ctx = new AppDbContext();
await OnRenewContext(ctx);

View File

@@ -285,17 +285,17 @@ namespace Elwig.Windows {
await ViewModel.GenerateDeliveryDataList(DeliveryService.ExportSubject.FromFilters, ExportMode.SaveList);
private async void Menu_BulkAction_SetAttribute_Click(object sender, RoutedEventArgs evt) {
if (sender is not MenuItem item) return;
if (IsEditing || IsCreating || sender is not MenuItem item) return;
await ViewModel.BulkSetAttribute(item.Header as string);
}
private async void Menu_BulkAction_AddModifier_Click(object sender, RoutedEventArgs evt) {
if (sender is not MenuItem item || item.Header is not string name) return;
if (IsEditing || IsCreating || sender is not MenuItem item || item.Header is not string name) return;
await ViewModel.BulkAddModifier(name);
}
private async void Menu_BulkAction_RemoveModifier_Click(object sender, RoutedEventArgs evt) {
if (sender is not MenuItem item || item.Header is not string name) return;
if (IsEditing || IsCreating || sender is not MenuItem item || item.Header is not string name) return;
await ViewModel.BulkRemoveModifier(name);
}
@@ -812,13 +812,11 @@ namespace Elwig.Windows {
}
EmptyScale();
await RefreshList();
await RefreshDeliveryParts();
await EnsureContextRenewed();
Mouse.OverrideCursor = null;
ControlUtils.SelectItem(DeliveryList, p?.Delivery);
DeliveryPartList.SelectedItem = null;
DeliveryPartList.ScrollIntoView(DeliveryPartList.ItemsSource.Cast<object>().Last());
RefreshInputs();
InitialInputs();
}
@@ -851,8 +849,7 @@ namespace Elwig.Windows {
}
EmptyScale();
await RefreshList();
await RefreshDeliveryParts();
await EnsureContextRenewed();
if (p?.Delivery != null) {
try {
using var ctx = new AppDbContext();
@@ -870,8 +867,7 @@ namespace Elwig.Windows {
Mouse.OverrideCursor = null;
DeliveryList.SelectedItem = null;
await RenewContext();
RefreshInputs();
await EnsureContextRenewed();
InitInputs();
}
@@ -902,7 +898,7 @@ namespace Elwig.Windows {
DisableWeighingButtons();
HideFinishNewPartDeliveryCancelButtons();
ShowNewEditDeleteButtons();
await RenewContext();
await EnsureContextRenewed();
RefreshInputs();
ClearInputStates();
LockInputs();
@@ -1082,9 +1078,7 @@ namespace Elwig.Windows {
LockInputs();
UnlockSearchInputs();
FinishInputFilling();
await RefreshList();
await RefreshDeliveryParts();
RefreshInputs();
await EnsureContextRenewed();
Mouse.OverrideCursor = null;
DepreciateButton.IsEnabled = true;
@@ -1184,6 +1178,9 @@ namespace Elwig.Windows {
SeasonInput.IsEnabled = false;
TodayOnlyInput.IsEnabled = false;
AllSeasonsInput.IsEnabled = false;
Menu_BulkAction_SetAttribute.IsEnabled = false;
Menu_BulkAction_AddModifier.IsEnabled = false;
Menu_BulkAction_RemoveModifier.IsEnabled = false;
}
private void UnlockSearchInputs() {
@@ -1191,6 +1188,9 @@ namespace Elwig.Windows {
SeasonInput.IsEnabled = true;
TodayOnlyInput.IsEnabled = true;
AllSeasonsInput.IsEnabled = (ViewModel.FilterMember != null);
Menu_BulkAction_SetAttribute.IsEnabled = true;
Menu_BulkAction_AddModifier.IsEnabled = true;
Menu_BulkAction_RemoveModifier.IsEnabled = true;
}
new protected void UnlockInputs() {

View File

@@ -374,8 +374,7 @@ namespace Elwig.Windows {
LockInputs();
ViewModel.EnableSearchInputs = true;
FinishInputFilling();
await RefreshList();
RefreshInputs();
await EnsureContextRenewed();
ViewModel.SearchQuery = "";
ControlUtils.SelectItemWithPk(DeliveryScheduleList, year, dsnr);
if (sortid != null)

View File

@@ -225,8 +225,7 @@ namespace Elwig.Windows {
LockInputs();
ViewModel.EnableSearchInputs = true;
FinishInputFilling();
await RefreshList();
RefreshInputs();
await EnsureContextRenewed();
ViewModel.SearchQuery = "";
}

View File

@@ -436,8 +436,7 @@ namespace Elwig.Windows {
UpdateContactInfoVisibility();
ViewModel.EnableSearchInputs = true;
FinishInputFilling();
await RefreshList();
RefreshInputs();
await EnsureContextRenewed();
ViewModel.SearchQuery = "";
Mouse.OverrideCursor = null;
if (mgnr is int m)