[#64] AreaComAdminWindow: Add dialog for modifying/deleting
Some checks failed
Test / Run tests (push) Has been cancelled
Some checks failed
Test / Run tests (push) Has been cancelled
This commit is contained in:
71
Elwig/Dialogs/AreaComModifyDialog.xaml
Normal file
71
Elwig/Dialogs/AreaComModifyDialog.xaml
Normal file
@@ -0,0 +1,71 @@
|
||||
<Window x:Class="Elwig.Dialogs.AreaComModifyDialog"
|
||||
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"
|
||||
xmlns:ctrl="clr-namespace:Elwig.Controls"
|
||||
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Title="Flächenbindungen bearbeiten" Height="220" Width="450">
|
||||
<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>
|
||||
<TextBlock x:Name="QuestionBlock1" TextAlignment="Center" Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
Soll die Flächenbindung (<Run Text="{Binding Area}"/> m², <Run Text="{Binding OrigYearFrom}"/>–<Run Text="{Binding OrigYearTo}"/>) rückwirkend bearbeitet werden,<LineBreak/>
|
||||
oder erst ab der angegebenen Saison?
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="QuestionBlock2" TextAlignment="Center" Margin="0,10,0,0" Visibility="Hidden"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
Soll die Flächenbindung (<Run Text="{Binding Area}"/> m², <Run Text="{Binding OrigYearFrom}"/>–<Run Text="{Binding OrigYearTo}"/>) rückwirkend gelöscht werden,<LineBreak/>
|
||||
oder erst ab der angegebenen Saison?
|
||||
</TextBlock>
|
||||
|
||||
<Label x:Name="SeasonLabel" Content="Saison:" Margin="0,50,100,0"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<ctrl:IntegerUpDown x:Name="SeasonInput" Width="56" Height="25" Margin="0,50,0,0" FontSize="14"
|
||||
Minimum="1900" Maximum="9999"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||
TextChanged="SeasonInput_TextChanged"/>
|
||||
<CheckBox x:Name="RetroactiveInput" Content="Rückwirkend bearbeiten" Margin="0,80,0,0"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||
Checked="RetroactiveInput_Changed" Unchecked="RetroactiveInput_Changed"
|
||||
IsChecked="{Binding ModifyRetroactively}"/>
|
||||
|
||||
<TextBlock x:Name="DescBlock1" Margin="0,105,0,0" TextAlignment="Center"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
Die Flächenbindung bleibt bis inkl. Saison <Bold><Run x:Name="CancelSeason1"/></Bold> unverändert,<LineBreak/>
|
||||
und wird ab inkl. Saison <Bold><Run x:Name="NewSeason1"/></Bold> in geänderter Form übernommen.
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="DescBlock2" Margin="0,105,0,0" TextAlignment="Center" Visibility="Hidden"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
Die Flächenbindung bleibt bis inklusive Saison <Bold><Run x:Name="CancelSeason2"/></Bold> gültig.
|
||||
</TextBlock>
|
||||
|
||||
<Button x:Name="ConfirmButton" Content="Bestätigen" Margin="10,10,115,10" Grid.Column="1"
|
||||
Click="ConfirmButton_Click"/>
|
||||
<Button x:Name="CancelButton" Content="Abbrechen" Margin="10,10,10,10" Grid.Column="1" IsCancel="True"/>
|
||||
</Grid>
|
||||
</Window>
|
62
Elwig/Dialogs/AreaComModifyDialog.xaml.cs
Normal file
62
Elwig/Dialogs/AreaComModifyDialog.xaml.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Elwig.Helpers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Elwig.Dialogs {
|
||||
public partial class AreaComModifyDialog : Window {
|
||||
|
||||
public int? YearTo { get; set; }
|
||||
public bool ModifyRetroactively { get; set; }
|
||||
|
||||
public string OrigYearFrom { get; set; }
|
||||
public string OrigYearTo { get; set; }
|
||||
public string Area { get; set; }
|
||||
|
||||
public AreaComModifyDialog(int? yearFrom, int? yearTo, int area, bool delete) {
|
||||
Area = $"{area:N0}";
|
||||
OrigYearFrom = $"{yearFrom}";
|
||||
OrigYearTo = $"{yearTo}";
|
||||
InitializeComponent();
|
||||
Title = delete ? "Flächenbindung löschen" : "Flächenbindung bearbeiten";
|
||||
RetroactiveInput.Content = delete ? "Rückwirkend löschen" : "Rückwirkend bearbeiten";
|
||||
if (delete) {
|
||||
QuestionBlock1.Visibility = Visibility.Hidden;
|
||||
QuestionBlock2.Visibility = Visibility.Visible;
|
||||
DescBlock1.Visibility = Visibility.Hidden;
|
||||
DescBlock2.Visibility = Visibility.Visible;
|
||||
}
|
||||
if ((yearTo.HasValue && yearTo < Utils.CurrentNextSeason) || (yearFrom.HasValue && yearFrom >= Utils.CurrentNextSeason)) {
|
||||
RetroactiveInput.IsChecked = true;
|
||||
} else {
|
||||
SeasonInput.Text = $"{Utils.CurrentNextSeason}";
|
||||
}
|
||||
}
|
||||
|
||||
private void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
YearTo = SeasonInput.Value! - 1;
|
||||
CancelSeason1.Text = $"{YearTo}";
|
||||
CancelSeason2.Text = $"{YearTo}";
|
||||
NewSeason1.Text = $"{YearTo + 1}";
|
||||
}
|
||||
|
||||
private void RetroactiveInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
if (ModifyRetroactively) {
|
||||
SeasonInput.IsEnabled = false;
|
||||
SeasonInput.Text = "";
|
||||
YearTo = null;
|
||||
DescBlock1.Visibility = Visibility.Hidden;
|
||||
DescBlock2.Visibility = Visibility.Hidden;
|
||||
} else {
|
||||
SeasonInput.IsEnabled = true;
|
||||
SeasonInput.Text = $"{Utils.CurrentNextSeason}";
|
||||
DescBlock1.Visibility = QuestionBlock1.Visibility;
|
||||
DescBlock2.Visibility = QuestionBlock2.Visibility;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user