This commit is contained in:
@@ -117,7 +117,7 @@ namespace Elwig.ViewModels {
|
|||||||
public partial string? WeightString { get; set; }
|
public partial string? WeightString { get; set; }
|
||||||
public int? Weight {
|
public int? Weight {
|
||||||
get => int.TryParse(WeightString?.Replace(Utils.GroupSeparator, ""), out var w) ? w : null;
|
get => int.TryParse(WeightString?.Replace(Utils.GroupSeparator, ""), out var w) ? w : null;
|
||||||
set => WeightString = $"{value:N0}";
|
set => WeightString = value > 0 ? $"{value:N0}" : null;
|
||||||
}
|
}
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string? TareString { get; set; } = "-";
|
public partial string? TareString { get; set; } = "-";
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ namespace Elwig.Windows {
|
|||||||
var correction = Utils.ShowTareCorrectionDialog(ViewModel.ActualTare, ViewModel.TargetTare);
|
var correction = Utils.ShowTareCorrectionDialog(ViewModel.ActualTare, ViewModel.TargetTare);
|
||||||
if (correction == null) return;
|
if (correction == null) return;
|
||||||
ViewModel.Weight += lastCorrection - correction;
|
ViewModel.Weight += lastCorrection - correction;
|
||||||
if (ViewModel.WeighingData is string s) {
|
if (ViewModel.Weight != null && ViewModel.WeighingData is string s) {
|
||||||
ViewModel.TargetTare = correction == 0 ? null : (ViewModel.ActualTare ?? 0) + correction;
|
ViewModel.TargetTare = correction == 0 ? null : (ViewModel.ActualTare ?? 0) + correction;
|
||||||
ViewModel.Tare = ViewModel.TargetTare ?? ViewModel.ActualTare;
|
ViewModel.Tare = ViewModel.TargetTare ?? ViewModel.ActualTare;
|
||||||
var obj = JsonNode.Parse(s)!.AsObject();
|
var obj = JsonNode.Parse(s)!.AsObject();
|
||||||
@@ -1514,7 +1514,7 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void WeightInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
private void WeightInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
InputTextChanged((TextBox)sender);
|
InputTextChanged((TextBox)sender, new ValidationResult(ViewModel.Weight > 0, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TemperatureAcidInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
private void TemperatureAcidInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user