mirror of
https://github.com/onyx-and-iris/Lottery.git
synced 2024-11-21 21:50:48 +00:00
rename LottoPickerException to LotteryException
add SemanticScreenReader Announcement on button clicked. It reads the text from the NumbersLabel
This commit is contained in:
parent
900fd940cf
commit
e1ab2087a2
@ -5,10 +5,10 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:Lottery"
|
||||
Shell.FlyoutBehavior="Disabled"
|
||||
Title="">
|
||||
Title="Lottery Number Generator">
|
||||
|
||||
<ShellContent
|
||||
Title="Lottery Number Picker"
|
||||
Title="Lottery Number Generator"
|
||||
ContentTemplate="{DataTemplate local:MainPage}"
|
||||
Route="MainPage" />
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Lottery
|
||||
{
|
||||
/// <summary>
|
||||
/// Base Exception class for the LottoPicker app
|
||||
/// Base Exception class for the Lottery app
|
||||
/// </summary>
|
||||
internal class LottoPickerException(string message) : Exception(message)
|
||||
internal class LotteryException(string message) : Exception(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<VerticalStackLayout
|
||||
Padding="30,0"
|
||||
Spacing="25">
|
||||
<Picker x:Name="LottoPicker" Title="Kind of Lottery" SelectedIndexChanged="LottoPicker_SelectedIndexChanged" />
|
||||
<Picker x:Name="LotteryPicker" Title="Kind of Lottery" SelectedIndexChanged="LotteryPicker_SelectedIndexChanged" />
|
||||
|
||||
<Label x:Name="NumbersLabel" Text="Click Spin button to generate" HorizontalOptions="Center" FontSize="Medium" />
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
InitializeComponent();
|
||||
|
||||
List<string> lottos = ["UK Lotto", "EuroMillions", "Set For Life", "Thunderball"];
|
||||
LottoPicker.ItemsSource = lottos;
|
||||
LottoPicker.SelectedIndex = (int)DefaultLottery;
|
||||
LotteryPicker.ItemsSource = lottos;
|
||||
LotteryPicker.SelectedIndex = (int)DefaultLottery;
|
||||
|
||||
Lottery = Lotteries[LottoPicker.SelectedIndex];
|
||||
Lottery = Lotteries[LotteryPicker.SelectedIndex];
|
||||
}
|
||||
|
||||
private void SpinButton_Clicked(object sender, EventArgs e)
|
||||
@ -43,14 +43,15 @@
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new LottoPickerException($"no NumbersLabel output defined for {numbers.Kind}");
|
||||
throw new LotteryException($"no NumbersLabel output defined for {numbers.Kind}");
|
||||
};
|
||||
NumbersLabel.Text = string.Join("\t", output);
|
||||
SemanticScreenReader.Announce(NumbersLabel.Text);
|
||||
}
|
||||
|
||||
private void LottoPicker_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void LotteryPicker_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Lottery = Lotteries[LottoPicker.SelectedIndex];
|
||||
Lottery = Lotteries[LotteryPicker.SelectedIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user