Weighing: Differentiate between scale and terminal
This commit is contained in:
@@ -85,10 +85,10 @@ namespace Elwig.Windows {
|
||||
if (n < 3) WeighingCButton.Visibility = Visibility.Hidden;
|
||||
if (n < 4) WeighingDButton.Visibility = Visibility.Hidden;
|
||||
if (n == 1) WeighingAButton.Content = "Wiegen";
|
||||
if (n > 1) WeighingAButton.Content = $"Wiegen {App.CommandScales[0].ScaleId}";
|
||||
if (n >= 2) WeighingBButton.Content = $"Wiegen {App.CommandScales[1].ScaleId}";
|
||||
if (n >= 3) WeighingCButton.Content = $"Wiegen {App.CommandScales[2].ScaleId}";
|
||||
if (n >= 4) WeighingDButton.Content = $"Wiegen {App.CommandScales[3].ScaleId}";
|
||||
if (n > 1) WeighingAButton.Content = $"Wiegen {App.CommandScales[0].ScaleTerminalId}";
|
||||
if (n >= 2) WeighingBButton.Content = $"Wiegen {App.CommandScales[1].ScaleTerminalId}";
|
||||
if (n >= 3) WeighingCButton.Content = $"Wiegen {App.CommandScales[2].ScaleTerminalId}";
|
||||
if (n >= 4) WeighingDButton.Content = $"Wiegen {App.CommandScales[3].ScaleTerminalId}";
|
||||
WeighingManualButton.Margin = new Thickness(10, 10 + n * 32, 10, 10);
|
||||
foreach (var s in App.EventScales) {
|
||||
s.WeighingEvent += Scale_Weighing;
|
||||
@@ -366,7 +366,7 @@ namespace Elwig.Windows {
|
||||
private void InitialInputs() {
|
||||
ViewModel.LastScaleError = null;
|
||||
ViewModel.WeighingData = null;
|
||||
ViewModel.ScaleId = null;
|
||||
ViewModel.ScaleTerminalId = null;
|
||||
ViewModel.ManualWeighingReason = null;
|
||||
|
||||
ClearOriginalValues();
|
||||
@@ -651,13 +651,13 @@ namespace Elwig.Windows {
|
||||
private void OnWeighingResult(IScale scale, WeighingResult res) {
|
||||
if ((res.NetWeight ?? 0) > 0 && res.FullWeighingId != null) {
|
||||
ViewModel.Weight = res.NetWeight;
|
||||
ViewModel.ScaleId = scale.ScaleId;
|
||||
ViewModel.ScaleTerminalId = scale.ScaleTerminalId;
|
||||
ViewModel.WeighingData = res.ToJson().ToJsonString();
|
||||
ViewModel.ManualWeighingReason = null;
|
||||
ManualWeighingInput.IsChecked = false;
|
||||
} else {
|
||||
ViewModel.Weight = null;
|
||||
ViewModel.ScaleId = null;
|
||||
ViewModel.ScaleTerminalId = null;
|
||||
ViewModel.WeighingData = null;
|
||||
}
|
||||
ViewModel.LastScaleError = null;
|
||||
@@ -771,7 +771,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void EmptyScale() {
|
||||
var scale = App.Scales.Where(s => s.ScaleId == ViewModel.ScaleId).FirstOrDefault();
|
||||
var scale = App.Scales.Where(s => s.ScaleTerminalId == ViewModel.ScaleTerminalId).FirstOrDefault();
|
||||
if (scale is not ICommandScale cs) return;
|
||||
cs.Empty();
|
||||
}
|
||||
@@ -953,7 +953,7 @@ namespace Elwig.Windows {
|
||||
ViewModel.Weight = res?.Item1;
|
||||
ManualWeighingInput.IsChecked = true;
|
||||
ViewModel.ManualWeighingReason = res?.Item2;
|
||||
ViewModel.ScaleId = null;
|
||||
ViewModel.ScaleTerminalId = null;
|
||||
ViewModel.WeighingData = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user