Skip to content

Commit ffc2a33

Browse files
authored
Merge branch 'main' into 92-animations-and-infomessages
2 parents 53b2692 + 27d9cc4 commit ffc2a33

3 files changed

Lines changed: 20 additions & 35 deletions

File tree

src/Codebreaker.ViewModels/Components/InfoMessageViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public partial class InfoMessageViewModel(Action closeAction) : ObservableObject
3131
[NotifyPropertyChangedFor(nameof(HasAction))]
3232
private string? _actionText = "OK";
3333

34-
public bool HasAction => ExecuteActionCommand is not null && ActionText is not null;
34+
public bool HasAction => Action is not null && ActionText is not null;
3535

3636
[ObservableProperty]
3737
[NotifyCanExecuteChangedFor(nameof(CloseCommand))]

src/Codebreaker.WinUI/Converters/ColornameToBrushConverter.cs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.UI;
1+
using Microsoft.Extensions.Logging;
2+
using Microsoft.UI;
23
using Microsoft.UI.Xaml.Data;
34
using Microsoft.UI.Xaml.Media;
45
using Windows.UI;
@@ -11,18 +12,12 @@ public class ColornameToBrushConverter : IValueConverter
1112
private readonly static Brush s_whiteBrush = new SolidColorBrush(Colors.White);
1213
private readonly static Brush s_redBrush = new SolidColorBrush(Color.FromArgb(255, 209, 52, 56));
1314
private readonly static Brush s_greenBrush = new SolidColorBrush(Color.FromArgb(255, 0, 173, 86));
14-
private readonly static Brush s_blueBrush = new SolidColorBrush(Color.FromArgb(255, 79, 107, 237));
15+
private readonly static Brush s_blueBrush = new SolidColorBrush(Color.FromArgb(255, 0, 128, 212));
1516
private readonly static Brush s_yellowBrush = new SolidColorBrush(Color.FromArgb(255, 252, 225, 0));
17+
private readonly static Brush s_orangeBrush = new SolidColorBrush(Color.FromArgb(255, 234, 74, 33));
18+
private readonly static Brush s_purpleBrush = new SolidColorBrush(Color.FromArgb(255, 91, 95, 199));
1619
private readonly static Brush s_emptyBrush = new SolidColorBrush(Color.FromArgb(255, 160, 174, 178));
1720

18-
public Brush BlackBrush { get; set; } = s_blackBrush;
19-
public Brush WhiteBrush { get; set; } = s_whiteBrush;
20-
public Brush RedBrush { get; set; } = s_redBrush;
21-
public Brush GreenBrush { get; set; } = s_greenBrush;
22-
public Brush BlueBrush { get; set; } = s_blueBrush;
23-
public Brush YellowBrush { get; set; } = s_yellowBrush;
24-
private Brush EmptyBrush { get; set; } = s_emptyBrush;
25-
2621
public object Convert(object value, Type targetType, object parameter, string language)
2722
{
2823
if (value is null)
@@ -33,13 +28,15 @@ public object Convert(object value, Type targetType, object parameter, string la
3328

3429
return colorname switch
3530
{
36-
"Black" => BlackBrush,
37-
"White" => WhiteBrush,
38-
"Red" => RedBrush,
39-
"Green" => GreenBrush,
40-
"Blue" => BlueBrush,
41-
"Yellow" => YellowBrush,
42-
_ => EmptyBrush
31+
"Black" => s_blackBrush,
32+
"White" => s_whiteBrush,
33+
"Red" => s_redBrush,
34+
"Green" => s_greenBrush,
35+
"Blue" => s_blueBrush,
36+
"Yellow" => s_yellowBrush,
37+
"Orange" => s_orangeBrush,
38+
"Purple" => s_purpleBrush,
39+
_ => s_emptyBrush
4340
};
4441
}
4542

src/Codebreaker.WinUI/Views/Templates/CodeBreakerTemplates.xaml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<ColumnDefinition Width="auto" />
1818
<ColumnDefinition Width="auto" />
1919
</Grid.ColumnDefinitions>
20-
<TextBlock Grid.Column="0" Text="{Binding Path=MoveNumber}" FontSize="{ThemeResource LargeFontSize}" Margin="48,0,10,0" VerticalAlignment="Center" />
20+
<TextBlock Grid.Column="0" Text="{Binding Path=MoveNumber, Mode=OneTime}" FontSize="{ThemeResource LargeFontSize}" Margin="48,0,10,0" VerticalAlignment="Center" />
2121
<Border Grid.Column="1" Margin="20,0,0,0" Padding="7" x:Name="ShadowTarget">
22-
<ItemsControl ItemsSource="{Binding Path=GuessPegs}">
22+
<ItemsControl ItemsSource="{Binding Path=GuessPegs, Mode=OneTime}">
2323
<ItemsControl.ItemsPanel>
2424
<ItemsPanelTemplate>
2525
<StackPanel Orientation="Horizontal" Spacing="27" />
@@ -28,7 +28,7 @@
2828
<ItemsControl.ItemTemplate>
2929
<DataTemplate>
3030
<Grid>
31-
<Ellipse Width="68" Height="68" Margin="12,4" Fill="{Binding Converter={StaticResource ColorConverter}}" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
31+
<Ellipse Width="68" Height="68" Margin="12,4" Fill="{Binding Mode=OneTime, Converter={StaticResource ColorConverter}}" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
3232
</Grid>
3333
</DataTemplate>
3434
</ItemsControl.ItemTemplate>
@@ -41,27 +41,15 @@
4141
<RowDefinition />
4242
<RowDefinition />
4343
</Grid.RowDefinitions>
44-
<ItemsControl Grid.Row="0" ItemsSource="{Binding Path=KeyPegs.White, Converter={StaticResource IntToEnumerableConverter}}">
44+
<ItemsControl Grid.Row="0" ItemsSource="{Binding Path=KeyPegs, Mode=OneTime}">
4545
<ItemsControl.ItemsPanel>
4646
<ItemsPanelTemplate>
4747
<StackPanel Orientation="Horizontal" Spacing="20" />
4848
</ItemsPanelTemplate>
4949
</ItemsControl.ItemsPanel>
5050
<ItemsControl.ItemTemplate>
5151
<DataTemplate>
52-
<Ellipse Width="25" Height="25" Fill="White" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
53-
</DataTemplate>
54-
</ItemsControl.ItemTemplate>
55-
</ItemsControl>
56-
<ItemsControl Grid.Row="1" ItemsSource="{Binding Path=KeyPegs.Black, Converter={StaticResource IntToEnumerableConverter}}">
57-
<ItemsControl.ItemsPanel>
58-
<ItemsPanelTemplate>
59-
<StackPanel Orientation="Horizontal" Spacing="20" />
60-
</ItemsPanelTemplate>
61-
</ItemsControl.ItemsPanel>
62-
<ItemsControl.ItemTemplate>
63-
<DataTemplate>
64-
<Ellipse Width="25" Height="25" Fill="Black" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
52+
<Ellipse Width="25" Height="25" Fill="{Binding Mode=OneTime, Converter={StaticResource ColorConverter}}" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
6553
</DataTemplate>
6654
</ItemsControl.ItemTemplate>
6755
</ItemsControl>

0 commit comments

Comments
 (0)