Add DeliveryExtractionDialog
This commit is contained in:
60
Elwig/Dialogs/DeliveryExtractionDialog.xaml
Normal file
60
Elwig/Dialogs/DeliveryExtractionDialog.xaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<Window x:Class="Elwig.Dialogs.DeliveryExtractionDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Elwig.Dialogs"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
ShowInTaskbar="False"
|
||||||
|
Topmost="True"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
||||||
|
Title="Teillieferung extrahieren" Height="210" Width="380">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="Padding" Value="2,4,2,4"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="TextBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Padding" Value="2"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
|
<Setter Property="Width" Value="100"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Margin="10,10,0,10" TextWrapping="Wrap">
|
||||||
|
Was soll mit der Teillieferung <Run x:Name="TextLsNr" FontWeight="Bold" Text="20201010A000/1"/><LineBreak/>
|
||||||
|
von <Run x:Name="TextMember" FontWeight="Bold" Text="Max Mustermann"/> geschehen?
|
||||||
|
</TextBlock>
|
||||||
|
<RadioButton x:Name="NewDeliveryButton" Content="Neue Lieferung erstellen"
|
||||||
|
Margin="10,80,0,10" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Checked="Selection_Changed" Unchecked="Selection_Changed"/>
|
||||||
|
<RadioButton x:Name="AddToDeliveryButton" Content="Zu Lieferung hinzufügen"
|
||||||
|
Margin="10,100,0,10" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Checked="Selection_Changed" Unchecked="Selection_Changed"/>
|
||||||
|
|
||||||
|
<ListBox x:Name="DeliveryList" Grid.Column="1" Margin="10,10,10,45"
|
||||||
|
SelectionChanged="DeliveryList_SelectionChanged"/>
|
||||||
|
|
||||||
|
<Button x:Name="ConfirmButton" Content="Bestätigen" Margin="10,10,115,10" Grid.ColumnSpan="2" IsEnabled="False" IsDefault="True"
|
||||||
|
Click="ConfirmButton_Click"/>
|
||||||
|
<Button x:Name="CancelButton" Content="Abbrechen" Margin="10,10,10,10" Grid.ColumnSpan="2" IsCancel="True"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -223,6 +223,11 @@ namespace Elwig.Helpers {
|
|||||||
return d.ShowDialog() == true ? d.Weight : null;
|
return d.ShowDialog() == true ? d.Weight : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string? ShowDeliveryExtractionDialog(string lsnr, string name, bool single, IEnumerable<string> lsnrs) {
|
||||||
|
var d = new DeliveryExtractionDialog(lsnr, name, single, lsnrs);
|
||||||
|
return d.ShowDialog() == true ? d.AddTo : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static Footer GenerateFooter(string lineBreak, string seperator) {
|
public static Footer GenerateFooter(string lineBreak, string seperator) {
|
||||||
return new Footer(lineBreak, seperator);
|
return new Footer(lineBreak, seperator);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user