Weighing: Add ICommandScale and IEventScale
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user