Person inmatning ändrad

This commit is contained in:
2025-09-26 10:07:59 +02:00
parent e9a8678244
commit f2403d5cf3
5 changed files with 146 additions and 97 deletions

View File

@ -4,6 +4,26 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Style TargetType="StackLayout" x:Key="ResponsiveStackStyle">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="WidthStates">
<VisualState x:Name="Wide">
<VisualState.Setters>
<Setter TargetName="ResponsiveStack" Property="StackLayout.Orientation" Value="Horizontal" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Narrow">
<VisualState.Setters>
<Setter TargetName="ResponsiveStack" Property="StackLayout.Orientation" Value="Vertical" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style x:Key="StatusLabelStyle" TargetType="Label" > <Style x:Key="StatusLabelStyle" TargetType="Label" >
<Style.Triggers> <Style.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding Status}" Value="New"> <DataTrigger TargetType="Label" Binding="{Binding Status}" Value="New">
@ -20,7 +40,7 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="StatusBorderStyle" TargetType="Border"> <Style x:Key="StatusBorderStyle" TargetType="Border">
<Style.Triggers> <Style.Triggers>
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="New"> <DataTrigger TargetType="Border" Binding="{Binding Status}" Value="New">
@ -85,11 +105,11 @@
<Style TargetType="Label"> <Style TargetType="Label">
<Setter Property="VerticalTextAlignment" Value="Center" /> <Setter Property="VerticalTextAlignment" Value="Center" />
</Style> </Style>
<Style TargetType="HorizontalStackLayout"> <Style TargetType="HorizontalStackLayout">
<Setter Property="Spacing" Value="5" /> <Setter Property="Spacing" Value="5" />
</Style> </Style>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="WidthRequest" Value="150"/> <Setter Property="WidthRequest" Value="150"/>
<Setter Property="BackgroundColor" Value="Goldenrod"/> <Setter Property="BackgroundColor" Value="Goldenrod"/>
@ -173,5 +193,5 @@
</VisualStateGroup> </VisualStateGroup>
</VisualStateGroupList> </VisualStateGroupList>
</Setter> </Setter>
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>

View File

@ -21,37 +21,42 @@
ViewTitle="Deltagare" ViewTitle="Deltagare"
ViewDescription="Lägg till deltagare här" /> ViewDescription="Lägg till deltagare här" />
<Border Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" Grid.Row="1"> <Border Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" Grid.Row="1">
<StackLayout Spacing="4" > <VerticalStackLayout Spacing="4" >
<FlexLayout Wrap="Wrap" > <Label Style="{StaticResource Label}"
<Label Style="{StaticResource Label}" Text="Deltagare "
Text="Deltagare Förnamn:" FontAttributes="Bold" FontSize="Large"/>
FontAttributes="Bold"/> <Grid ColumnDefinitions="Auto,Auto,*" RowDefinitions="Auto,auto,auto,auto"
<Entry Padding="10" RowSpacing="8">
x:Name="ParticipantFirstNameEntry" <Label Grid.Row="0" Grid.Column="0" Style="{StaticResource Label}"
Placeholder="Förnamn" Text="Förnamn:"
Text="{Binding ParticipantObject.FirstName}" /> FontAttributes="Bold"/>
<Entry Grid.Row="0" Grid.Column="1"
<Label Style="{StaticResource Label}" x:Name="ParticipantFirstNameEntry"
Text="Deltagare Efternamn:" Placeholder="Förnamn"
FontAttributes="Bold"/> FontSize="15"
<Entry Text="{Binding ParticipantObject.FirstName}" TextColor="Black"/>
x:Name="ParticipantLastNameEntry" <Label Grid.Row="1" Grid.Column="0" Style="{StaticResource Label}"
Placeholder="Efternamn" Text="Efternamn:"
Text="{Binding ParticipantObject.LastName}" /> FontAttributes="Bold"/>
<Entry Grid.Row="1" Grid.Column="1"
<Label Style="{StaticResource Label}" x:Name="ParticipantLastNameEntry"
Text="Deltagare Email:" Placeholder="Efternamn"
FontAttributes="Bold"/> FontSize="15"
<Entry Text="{Binding ParticipantObject.LastName}" TextColor="Black"/>
x:Name="ParticipantEmailEntry" <Label Grid.Row="2" Grid.Column="0" Style="{StaticResource Label}"
Placeholder="Mail adress" Text="Email"
Text="{Binding ParticipantObject.Email}" /> FontAttributes="Bold"/>
<Button Style="{StaticResource HoverButtonBlueStyle}" <Entry Grid.Row="2" Grid.Column="1"
x:Name="ParticipantEmailEntry"
Placeholder="Mail adress"
FontSize="15"
Text="{Binding ParticipantObject.Email}" TextColor="Black"/>
<Button Grid.Row="3" Grid.Column="1" Style="{StaticResource HoverButtonBlueStyle}"
Text="Lägg till" Text="Lägg till"
HorizontalOptions="End" HorizontalOptions="End"
Command="{Binding SaveCommand}" /> Command="{Binding SaveCommand}" />
</FlexLayout> </Grid>
</StackLayout> </VerticalStackLayout>
</Border> </Border>
<Border Grid.Row="2" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5"> <Border Grid.Row="2" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5">
<CollectionView <CollectionView

View File

@ -87,7 +87,7 @@
Command="{Binding StoreAndHandlePointsCommand}"/> Command="{Binding StoreAndHandlePointsCommand}"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</Border> </Border>
<ScrollView Grid.Row="4"> <ScrollView Grid.Row="4" Orientation="Horizontal">
<Grid <Grid
x:Name="ScoreGrid" x:Name="ScoreGrid"
ColumnSpacing="5" ColumnSpacing="5"

View File

@ -9,6 +9,9 @@
x:DataType="vm:RoundStartingViewModelCommands" x:DataType="vm:RoundStartingViewModelCommands"
x:Name="GameRoundStartingPage" x:Name="GameRoundStartingPage"
Title="Starta ny Runda"> Title="Starta ny Runda">
<Border Style="{StaticResource Border.Page}" StrokeThickness="4"> <Border Style="{StaticResource Border.Page}" StrokeThickness="4">
<Grid Style="{StaticResource Grid.Page}"> <Grid Style="{StaticResource Grid.Page}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -21,30 +24,34 @@
ViewTitle="Starta en Spelrunda" ViewTitle="Starta en Spelrunda"
ViewDescription="Välj deltagare och initiera spel" /> ViewDescription="Välj deltagare och initiera spel" />
<Border Grid.Row="1" Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" > <Border Grid.Row="1" Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" >
<HorizontalStackLayout> <ScrollView Orientation="Horizontal">
<Border Stroke="Gray" <StackLayout x:Name="ResponsiveStack" Spacing="5" Style="{StaticResource ResponsiveStackStyle}" >
<Border Stroke="Gray"
StrokeThickness="2" StrokeThickness="2"
BackgroundColor="LightGray" BackgroundColor="LightGray"
Padding="10" Padding="10"
Margin="2" Margin="2"
HorizontalOptions="Center" HorizontalOptions="Start"
VerticalOptions="Center" VerticalOptions="Center"
WidthRequest="250"> WidthRequest="250">
<Picker ItemsSource="{Binding ParticipantList}" <Picker ItemsSource="{Binding ParticipantList}"
ItemDisplayBinding="{Binding LastNameFirstName}" ItemDisplayBinding="{Binding LastNameFirstName}"
SelectedItem="{Binding SelectedItem}" SelectedItem="{Binding SelectedItem}"
TextColor="Black" TextColor="Black"
Title="Välj deltagare"/> Title="Välj deltagare"/>
</Border> </Border>
<Border Stroke="Gold" StrokeThickness="2" BackgroundColor="LightCyan" > <Border Stroke="Gold"
<CollectionView StrokeThickness="2"
BackgroundColor="LightCyan" >
<!--WidthRequest="100">-->
<CollectionView
ItemsSource="{Binding RoundElements}" ItemsSource="{Binding RoundElements}"
ItemsLayout="HorizontalList" ItemsLayout="HorizontalList"
x:Name="ParticipantList" x:Name="ParticipantList"
SelectionMode="None"> SelectionMode="None">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:RoundBuilderElement"> <DataTemplate x:DataType="model:RoundBuilderElement">
<Border <Border
Padding="2" Padding="2"
Margin="5" Margin="5"
WidthRequest="150" WidthRequest="150"
@ -55,25 +62,25 @@
StrokeShape="RoundRectangle 10" StrokeShape="RoundRectangle 10"
Style="{StaticResource StatusBorderStyle}" Style="{StaticResource StatusBorderStyle}"
> >
<Border.GestureRecognizers> <Border.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer
Command="{Binding BindingContext.ParticipantTappedCommand, Source={x:Reference Name=ParticipantList}}" Command="{Binding BindingContext.ParticipantTappedCommand, Source={x:Reference Name=ParticipantList}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Border.GestureRecognizers> </Border.GestureRecognizers>
<Border Margin="1" Padding="2" StrokeThickness="3" > <Border Margin="1" Padding="2" StrokeThickness="3" >
<VerticalStackLayout> <VerticalStackLayout>
<Label Text="{Binding ParticipantName}" FontAttributes="Bold" FontSize="14" Style="{StaticResource StatusLabelStyle}"/> <Label Text="{Binding ParticipantName}" FontAttributes="Bold" FontSize="14" Style="{StaticResource StatusLabelStyle}"/>
<Label Text="{Binding GameRoundStartDateString}" FontAttributes="Bold" FontSize="14" Style="{StaticResource StatusLabelStyle}"/> <Label Text="{Binding GameRoundStartDateString}" FontAttributes="Bold" FontSize="14" Style="{StaticResource StatusLabelStyle}"/>
<Label Text="{Binding StatusString}" FontSize="14" Style="{StaticResource StatusLabelStyle}" /> <Label Text="{Binding StatusString}" FontSize="14" Style="{StaticResource StatusLabelStyle}" />
</VerticalStackLayout> </VerticalStackLayout>
</Border>
</Border> </Border>
</Border> </DataTemplate>
</DataTemplate> </CollectionView.ItemTemplate>
</CollectionView.ItemTemplate> </CollectionView>
</CollectionView> </Border>
</Border> <Border
<Border HorizontalOptions="Start"
HorizontalOptions="End"
Padding="2" Padding="2"
Margin="5" Margin="5"
WidthRequest="150" WidthRequest="150"
@ -83,62 +90,64 @@
x:Name="RoundElementBorder" x:Name="RoundElementBorder"
BackgroundColor="BlanchedAlmond" BackgroundColor="BlanchedAlmond"
StrokeShape="RoundRectangle 10"> StrokeShape="RoundRectangle 10">
<VerticalStackLayout Spacing="5" Padding="4"> <VerticalStackLayout Spacing="5" Padding="4">
<Button Text="Spara omgång" WidthRequest="130" <Button Text="Spara omgång" WidthRequest="130"
Style="{StaticResource HoverButtonBlueStyle}" Style="{StaticResource HoverButtonBlueStyle}"
Command="{Binding SaveCommand}" /> Command="{Binding SaveCommand}" />
<Button Text="Rensa" WidthRequest="130" <Button Text="Rensa" WidthRequest="130"
Style="{StaticResource HoverButtonRedStyle}" Style="{StaticResource HoverButtonRedStyle}"
Command="{Binding RensaCommand}" /> Command="{Binding RensaCommand}" />
</VerticalStackLayout> </VerticalStackLayout>
</Border> </Border>
</HorizontalStackLayout> </StackLayout>
</ScrollView>
</Border> </Border>
<Border Grid.Row="2" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5"> <Border Grid.Row="2" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5">
<CollectionView ItemsSource="{Binding GameRoundList}" x:Name="OuterList"> <ScrollView Orientation="Horizontal">
<CollectionView.ItemTemplate> <CollectionView ItemsSource="{Binding GameRoundList}" x:Name="OuterList">
<DataTemplate x:DataType="model:RoundBuilderGroup"> <CollectionView.ItemTemplate>
<VerticalStackLayout Padding="10"> <DataTemplate x:DataType="model:RoundBuilderGroup">
<!-- Gruppens rubrik --> <VerticalStackLayout Padding="10">
<HorizontalStackLayout> <!-- Gruppens rubrik -->
<Label Text="{Binding GameRoundId, StringFormat='Runda: {0}'}" FontAttributes="Bold" FontSize="18" /> <HorizontalStackLayout>
<Label Text="{Binding GameRoundStartDate, StringFormat='Startdatum: {0}'}" FontAttributes="Bold" FontSize="18"/> <Label Text="{Binding GameRoundId, StringFormat='Runda: {0}'}" FontAttributes="Bold" FontSize="18" />
<Label Text="{Binding Status, StringFormat='Status: {0}'}" FontAttributes="Bold" FontSize="18" /> <Label Text="{Binding GameRoundStartDate, StringFormat='Startdatum: {0}'}" FontAttributes="Bold" FontSize="18"/>
</HorizontalStackLayout> <Label Text="{Binding Status, StringFormat='Status: {0}'}" FontAttributes="Bold" FontSize="18" />
<!-- Horisontell lista med deltagare --> </HorizontalStackLayout>
<CollectionView ItemsSource="{Binding Elements}" <!-- Horisontell lista med deltagare -->
<CollectionView ItemsSource="{Binding Elements}"
ItemsLayout="HorizontalList" ItemsLayout="HorizontalList"
x:Name="InnerList" x:Name="InnerList"
Margin="0,10,0,10" Margin="0,10,0,10"
ItemSizingStrategy="MeasureAllItems"> ItemSizingStrategy="MeasureAllItems">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:RoundBuilderElement"> <DataTemplate x:DataType="model:RoundBuilderElement">
<Border <Border
Stroke="Gray" Stroke="Gray"
Padding="5" Padding="5"
Margin="5,0" Margin="5,0"
Style="{StaticResource StatusBorderStyle}" > Style="{StaticResource StatusBorderStyle}" >
<Border.GestureRecognizers> <Border.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer
Command="{Binding Path=BindingContext.ElementTappedCommand,Source={x:Reference OuterList}}" Command="{Binding Path=BindingContext.ElementTappedCommand,Source={x:Reference OuterList}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Border.GestureRecognizers> </Border.GestureRecognizers>
<VerticalStackLayout>
<Label Text="{Binding ParticipantName}" FontAttributes="Bold" Style="{StaticResource StatusLabelStyle}" />
<Label Text="{Binding GameRegPoints, StringFormat='Poäng: {0}'}" Style="{StaticResource StatusLabelStyle}"/>
<Label Text="{Binding GameRoundRegNr, StringFormat='RegNr: {0}'}" Style="{StaticResource StatusLabelStyle}"/>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<VerticalStackLayout>
<Label Text="{Binding ParticipantName}" FontAttributes="Bold" Style="{StaticResource StatusLabelStyle}" />
<Label Text="{Binding GameRegPoints, StringFormat='Poäng: {0}'}" Style="{StaticResource StatusLabelStyle}"/>
<Label Text="{Binding GameRoundRegNr, StringFormat='RegNr: {0}'}" Style="{StaticResource StatusLabelStyle}"/>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</Border> </Border>
</Grid> </Grid>
</Border> </Border>

View File

@ -23,6 +23,21 @@ public partial class RoundStartingView : ContentPage
ViewModel.GetParticipants(); ViewModel.GetParticipants();
} }
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if (width < 500)
{
VisualStateManager.GoToState(ResponsiveStack, "Narrow");
System.Diagnostics.Debug.WriteLine($"width={width} ResponsiveStack=Narrow ");
}
else
{
VisualStateManager.GoToState(ResponsiveStack, "Wide");
System.Diagnostics.Debug.WriteLine($"width={width} ResponsiveStack=Wide ");
}
}
} }