Add DeliveryExtractionDialog
This commit is contained in:
37
Elwig/Dialogs/DeliveryExtractionDialog.xaml.cs
Normal file
37
Elwig/Dialogs/DeliveryExtractionDialog.xaml.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace Elwig.Dialogs {
|
||||
public partial class DeliveryExtractionDialog : Window {
|
||||
|
||||
public string? AddTo;
|
||||
|
||||
public DeliveryExtractionDialog(string lsnr, string name, bool single, IEnumerable<string> lsnrs) {
|
||||
InitializeComponent();
|
||||
TextLsNr.Text = lsnr;
|
||||
TextMember.Text = name;
|
||||
NewDeliveryButton.IsEnabled = !single;
|
||||
DeliveryList.IsEnabled = false;
|
||||
DeliveryList.ItemsSource = lsnrs;
|
||||
}
|
||||
|
||||
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||
DialogResult = true;
|
||||
AddTo = NewDeliveryButton.IsChecked == true ? "new" : DeliveryList.SelectedItem as string;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void UpdateButtons() {
|
||||
ConfirmButton.IsEnabled = NewDeliveryButton.IsChecked == true || (AddToDeliveryButton.IsChecked == true && DeliveryList.SelectedItem != null);
|
||||
DeliveryList.IsEnabled = AddToDeliveryButton.IsChecked == true;
|
||||
}
|
||||
|
||||
private void Selection_Changed(object sender, RoutedEventArgs evt) {
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private void DeliveryList_SelectionChanged(object sender, RoutedEventArgs evt) {
|
||||
UpdateButtons();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user