add powerball lottery

This commit is contained in:
2026-07-22 17:43:54 +01:00
parent bee202a14d
commit 99e1aa23ce
4 changed files with 17 additions and 8 deletions

View File

@@ -5,13 +5,11 @@
public App() public App()
{ {
InitializeComponent(); InitializeComponent();
MainPage = new AppShell();
} }
protected override Window CreateWindow(IActivationState? activationState) protected override Window CreateWindow(IActivationState? activationState)
{ {
var window = base.CreateWindow(activationState); var window = new Window(new AppShell());
const int newWidth = 600; const int newWidth = 600;
const int newHeight = 750; const int newHeight = 750;
@@ -19,7 +17,6 @@
window.Width = newWidth; window.Width = newWidth;
window.Height = newHeight; window.Height = newHeight;
// Optional: Set minimum size to prevent window from being too small
window.MinimumWidth = 400; window.MinimumWidth = 400;
window.MinimumHeight = 600; window.MinimumHeight = 600;

View File

@@ -72,4 +72,15 @@
protected override Sample SpecialSample { get; } = new(Lower: 1, Upper: 14, Count: 1); protected override Sample SpecialSample { get; } = new(Lower: 1, Upper: 14, Count: 1);
protected override string SpecialIdentifier => "Thunderball"; protected override string SpecialIdentifier => "Thunderball";
} }
/// <summary>
/// Concrete class for PowerballLottery lottery.
/// Generates five balls from 1 to 69 and one powerball from 1 to 26.
/// </summary>
internal class PowerballLottery : LotteryWithSpecial
{
protected override Sample Sample { get; } = new(Lower: 1, Upper: 69, Count: 5);
protected override Sample SpecialSample { get; } = new(Lower: 1, Upper: 26, Count: 1);
protected override string SpecialIdentifier => "Powerball";
}
} }

View File

@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks> <TargetFrameworks>net9.0-android;net9.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> --> <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

View File

@@ -6,7 +6,8 @@
new LottoLottery(), new LottoLottery(),
new EuroMillionsLottery(), new EuroMillionsLottery(),
new SetForLifeLottery(), new SetForLifeLottery(),
new ThunderballLottery() new ThunderballLottery(),
new PowerballLottery()
]; ];
const KindOfLottery DefaultLottery = KindOfLottery.Lotto; const KindOfLottery DefaultLottery = KindOfLottery.Lotto;
Lottery Lottery; Lottery Lottery;
@@ -15,7 +16,7 @@
{ {
InitializeComponent(); InitializeComponent();
List<string> lottos = ["Lotto", "EuroMillions", "Set For Life", "Thunderball"]; List<string> lottos = ["Lotto", "EuroMillions", "Set For Life", "Thunderball", "Powerball"];
LotteryPicker.ItemsSource = lottos; LotteryPicker.ItemsSource = lottos;
LotteryPicker.SelectedIndex = (int)DefaultLottery; LotteryPicker.SelectedIndex = (int)DefaultLottery;