[#37] Controls: Implement IntegerUpDown
All checks were successful
Test / Run tests (push) Successful in 2m28s

This commit is contained in:
2024-06-03 16:59:45 +02:00
parent ff375e3caf
commit cc4ec6c5db
7 changed files with 170 additions and 10 deletions

View File

@ -175,9 +175,9 @@
</TextBlock>
</TextBox.ToolTip>
</TextBox>
<xctk:IntegerUpDown x:Name="SeasonInput" Grid.ColumnSpan="3" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Right"
ValueChanged="SeasonInput_ValueChanged"/>
<ctrl:IntegerUpDown x:Name="SeasonInput" Grid.ColumnSpan="3" Height="25" Width="56" FontSize="14" Minimum="1900" Maximum="9999"
Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Right" Text="2020"
TextChanged="SeasonInput_TextChanged"/>
<CheckBox x:Name="TodayOnlyInput" Content="Nur heute"
HorizontalAlignment="Right" Margin="0,7,18,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"
Checked="TodayOnlyInput_Changed" Unchecked="TodayOnlyInput_Changed"/>

View File

@ -1344,8 +1344,8 @@ namespace Elwig.Windows {
await RefreshDeliveryListQuery(true);
}
private async void SeasonInput_ValueChanged(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value == null) return;
private async void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
if (SeasonInput.Value == null || TodayOnlyInput == null || AllSeasonsInput == null) return;
TodayOnlyInput.IsChecked = false;
AllSeasonsInput.IsChecked = false;
await RefreshDeliveryListQuery();

View File

@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:ctrl="clr-namespace:Elwig.Controls"
Title="Elwig" Height="390" Width="520" ResizeMode="CanMinimize"
Loaded="Window_Loaded" Closing="Window_Closing">
<Window.Resources>
@ -71,9 +71,9 @@
<Grid>
<Border BorderBrush="LightGray" BorderThickness="1"/>
<Label Content="Saison:" Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
<xctk:IntegerUpDown Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
<ctrl:IntegerUpDown x:Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1900" Maximum="9999"
Margin="0,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
ValueChanged="SeasonInput_ValueChanged"/>
TextChanged="SeasonInput_TextChanged"/>
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
Click="DeliveryConfirmationButton_Click"

View File

@ -14,6 +14,7 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Elwig.Windows {
@ -147,7 +148,7 @@ namespace Elwig.Windows {
}
protected override Task OnRenewContext(AppDbContext ctx) {
SeasonInput_ValueChanged(null, null);
SeasonInput_TextChanged(null, null);
return Task.CompletedTask;
}
@ -159,7 +160,7 @@ namespace Elwig.Windows {
Height = 390;
}
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
private async void SeasonInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
using var ctx = new AppDbContext();
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
var valid = (s0 != null);