|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<Page |
| 3 | + x:Class="CodeBreaker.WinUI.Views.Pages.GamePage" |
| 4 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 5 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 6 | + xmlns:local="using:CodeBreaker.WinUI.Views.Pages" |
| 7 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 8 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 9 | + xmlns:components="using:CodeBreaker.WinUI.Views.Components" |
| 10 | + xmlns:conv="using:CodeBreaker.WinUI.Converters" |
| 11 | + xmlns:toolkitConverters="using:CommunityToolkit.WinUI.UI.Converters" |
| 12 | + xmlns:ca="using:CodeBreaker.WinUI.CustomAttachedProperties" |
| 13 | + xmlns:cme="using:CodeBreaker.WinUI.CustomMarkupExtensions" |
| 14 | + mc:Ignorable="d"> |
| 15 | + <Page.Resources> |
| 16 | + <conv:GameStatusToVisibilityConverter x:Key="GameStatusVisibility" /> |
| 17 | + <toolkitConverters:BoolToVisibilityConverter x:Key="BoolToVisibility" /> |
| 18 | + <Style TargetType="InfoBar"> |
| 19 | + <Setter Property="Margin" Value="0,0,0,30" /> |
| 20 | + </Style> |
| 21 | + </Page.Resources> |
| 22 | + <Grid x:Name="ContentArea"> |
| 23 | + <Grid.RowDefinitions> |
| 24 | + <RowDefinition Height="auto" /> |
| 25 | + <RowDefinition Height="auto" /> |
| 26 | + <RowDefinition Height="auto" /> |
| 27 | + <RowDefinition Height="*" /> |
| 28 | + </Grid.RowDefinitions> |
| 29 | + <!--Startgame section--> |
| 30 | + <Grid |
| 31 | + Grid.Row="1" |
| 32 | + ColumnSpacing="25" |
| 33 | + Visibility="{x:Bind ViewModel.GameStatus, Mode=OneWay, Converter={StaticResource GameStatusVisibility}, ConverterParameter=Start}"> |
| 34 | + <Grid.ColumnDefinitions> |
| 35 | + <ColumnDefinition /> |
| 36 | + <ColumnDefinition Width="Auto" /> |
| 37 | + </Grid.ColumnDefinitions> |
| 38 | + <Grid Grid.Column="0"> |
| 39 | + <!-- The extra grid and the empy (enabled) TextBlock are necessary for showing the tooltip over the (disabled) TextBox. --> |
| 40 | + <TextBlock /> |
| 41 | + <TextBox |
| 42 | + IsEnabled="{x:Bind ViewModel.IsNameEnterable, Mode=OneWay}" |
| 43 | + Header="{cme:ResourceString Name=GamePage_NameInputHeader}" |
| 44 | + PlaceholderText="{cme:ResourceString Name=GamePage_NameInputPlaceholder}" |
| 45 | + VerticalAlignment="Center" |
| 46 | + Text="{x:Bind ViewModel.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> |
| 47 | + <ToolTipService.ToolTip> |
| 48 | + <ToolTip |
| 49 | + Content="{cme:ResourceString Name=GamePage_NameAlreadyProvidedTooltip}" |
| 50 | + IsEnabled="{x:Bind Path=ViewModel.IsNamePredefined, Mode=OneWay}" |
| 51 | + Placement="Bottom" /> |
| 52 | + </ToolTipService.ToolTip> |
| 53 | + </Grid> |
| 54 | + <Button |
| 55 | + Grid.Column="1" |
| 56 | + VerticalAlignment="Bottom" |
| 57 | + HorizontalAlignment="Stretch" |
| 58 | + Padding="35,8" |
| 59 | + Command="{x:Bind Path=ViewModel.StartGameCommand, Mode=OneTime}"> |
| 60 | + <StackPanel Orientation="Vertical" Spacing="5"> |
| 61 | + <SymbolIcon Symbol="Play" Visibility="{x:Bind Path=ViewModel.StartGameCommand.IsRunning, Mode=OneWay, Converter={StaticResource BoolToVisibility}, ConverterParameter=True}" /> |
| 62 | + <ProgressRing Visibility="{x:Bind Path=ViewModel.StartGameCommand.IsRunning, Mode=OneWay}" Width="20" Height="20" /> |
| 63 | + <TextBlock Text="{cme:ResourceString Name=GamePage_StartButtonText}" /> |
| 64 | + </StackPanel> |
| 65 | + </Button> |
| 66 | + </Grid> |
| 67 | + <!--Gamebar section--> |
| 68 | + <StackPanel |
| 69 | + Orientation="Horizontal" |
| 70 | + Grid.Row="1" |
| 71 | + Visibility="{x:Bind ViewModel.GameStatus, Mode=OneWay, Converter={StaticResource GameStatusVisibility}, ConverterParameter=Cancelable}"> |
| 72 | + <!-- |
| 73 | + Cancelling the game is not yet implemented in the VM |
| 74 | + <Button |
| 75 | + Height="92" Margin="0,-6,4,0" Width="100" |
| 76 | + ca:Confirm.Enabled="True" |
| 77 | + ca:Confirm.Title="{cme:ResourceString Name=GamePage_CancelConfirmTitle}" |
| 78 | + ca:Confirm.Content="{cme:ResourceString Name=GamePage_CancelConfirmContent}" |
| 79 | + ca:Confirm.PrimaryCommand="{x:Bind ViewModel.CancelGameCommand, Mode=OneTime}" |
| 80 | + ca:Confirm.PrimaryText="{cme:ResourceString Name=Yes}" |
| 81 | + ca:Confirm.CloseText="{cme:ResourceString Name=No}"> |
| 82 | + <StackPanel Orientation="Vertical" Spacing="05"> |
| 83 | + <SymbolIcon Symbol="Cancel" Visibility="{x:Bind ViewModel.CancelGameCommand.IsRunning, Mode=OneWay,Converter={StaticResource BoolToVisibility},ConverterParameter=True}" /> |
| 84 | + <ProgressRing Visibility="{x:Bind ViewModel.CancelGameCommand.IsRunning, Mode=OneWay}" /> |
| 85 | + <TextBlock Text="{cme:ResourceString Name=GamePage_CancelButtonText}" /> |
| 86 | + </StackPanel> |
| 87 | + </Button>--> |
| 88 | + <components:PegSelectionComponent |
| 89 | + Grid.Row="2" |
| 90 | + ViewModel="{x:Bind ViewModel, Mode=OneWay}" /> |
| 91 | + </StackPanel> |
| 92 | + <!--Move section--> |
| 93 | + <ListBox |
| 94 | + x:Name="listGameMoves" |
| 95 | + Grid.Row="3" |
| 96 | + Background="Transparent" |
| 97 | + Visibility="{x:Bind ViewModel.GameStatus, Mode=OneWay, Converter={StaticResource GameStatusVisibility}, ConverterParameter=Running}" |
| 98 | + ItemsSource="{x:Bind ViewModel.GameMoves, Mode=OneWay}" |
| 99 | + ItemTemplate="{StaticResource PegsTemplate}" /> |
| 100 | + </Grid> |
| 101 | +</Page> |
0 commit comments