Weighing: Add ICommandScale and IEventScale

This commit is contained in:
2024-02-10 18:43:45 +01:00
parent 68f1a2c091
commit 9ecad6aa79
8 changed files with 58 additions and 82 deletions

View File

@ -1,6 +1,7 @@
using Elwig.Documents;
using Elwig.Helpers;
using Elwig.Helpers.Export;
using Elwig.Helpers.Weighing;
using Elwig.Models.Entities;
using LinqKit;
using Microsoft.EntityFrameworkCore;
@ -968,7 +969,8 @@ namespace Elwig.Windows {
CancelCreatingButton.IsEnabled = false;
try {
var s = App.Scales[index];
var res = await s.Weigh();
if (s is not ICommandScale cs) return;
var res = await cs.Weigh();
if ((res.Weight ?? 0) > 0 && res.FullWeighingId != null) {
WeightInput.Text = $"{res.Weight:N0}";
ScaleId = s.ScaleId;
@ -1080,8 +1082,8 @@ namespace Elwig.Windows {
private void EmptyScale() {
var scale = App.Scales.Where(s => s.ScaleId == ScaleId).FirstOrDefault();
if (scale == null) return;
scale.Empty();
if (scale is not ICommandScale cs) return;
cs.Empty();
}
private async void NewDeliveryPartButton_Click(object sender, RoutedEventArgs evt) {