Add AbwertenDialog

This commit is contained in:
2023-08-26 20:54:25 +02:00
parent c0a6f16374
commit 6dda9e09cf
7 changed files with 213 additions and 58 deletions

View File

@ -0,0 +1,40 @@
using Elwig.Helpers;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
namespace Elwig.Dialogs {
public partial class AbwertenDialog : Window {
public int Weight;
public AbwertenDialog(string lsnr, string name, int weight) {
Weight = weight;
InitializeComponent();
Text.Inlines.Clear();
Text.Inlines.Add("Welche Menge der Teillieferung ");
Text.Inlines.Add(new Run(lsnr) { FontWeight = FontWeights.Bold });
Text.Inlines.Add("\nvon ");
Text.Inlines.Add(new Run(name) { FontWeight = FontWeights.Bold });
Text.Inlines.Add("\nmit ");
Text.Inlines.Add(new Run($"{weight:N0}\u202fkg") { FontWeight = FontWeights.Bold });
Text.Inlines.Add(" soll abgewertet werden?");
}
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();
}
}
}