using Elwig.Helpers; using System.Windows; using System.Windows.Controls; namespace Elwig.Dialogs { public partial class AbwertenDialog : Window { public int Weight; public AbwertenDialog(string lsnr, string name, int weight) { Weight = weight; InitializeComponent(); TextLsNr.Text = lsnr; TextMember.Text = name; TextWeight.Text = $"{weight:N0}\u202fkg"; } private void ConfirmButton_Click(object sender, RoutedEventArgs evt) { DialogResult = true; Weight = int.Parse(WeightInput.Text); Close(); } private void UpdateButtons() { ConfirmButton.IsEnabled = int.TryParse(WeightInput.Text, out var w) && w > 0 && w <= Weight; } private void WeightInput_TextChanged(object sender, TextChangedEventArgs evt) { Validator.CheckInteger(WeightInput, true, 5); UpdateButtons(); } } }