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:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:local="clr-namespace:Lottery"
|
xmlns:local="clr-namespace:Lottery"
|
||||||
Shell.FlyoutBehavior="Disabled"
|
Shell.FlyoutBehavior="Disabled"
|
||||||
Title="">
|
Title="Lottery Number Generator">
|
||||||
|
|
||||||
<ShellContent
|
<ShellContent
|
||||||
Title="Lottery Number Picker"
|
Title="Lottery Number Generator"
|
||||||
ContentTemplate="{DataTemplate local:MainPage}"
|
ContentTemplate="{DataTemplate local:MainPage}"
|
||||||
Route="MainPage" />
|
Route="MainPage" />
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
namespace Lottery
|
namespace Lottery
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base Exception class for the LottoPicker app
|
/// Base Exception class for the Lottery app
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class LottoPickerException(string message) : Exception(message)
|
internal class LotteryException(string message) : Exception(message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<VerticalStackLayout
|
<VerticalStackLayout
|
||||||
Padding="30,0"
|
Padding="30,0"
|
||||||
Spacing="25">
|
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" />
|
<Label x:Name="NumbersLabel" Text="Click Spin button to generate" HorizontalOptions="Center" FontSize="Medium" />
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
List<string> lottos = ["UK Lotto", "EuroMillions", "Set For Life", "Thunderball"];
|
List<string> lottos = ["UK Lotto", "EuroMillions", "Set For Life", "Thunderball"];
|
||||||
LottoPicker.ItemsSource = lottos;
|
LotteryPicker.ItemsSource = lottos;
|
||||||
LottoPicker.SelectedIndex = (int)DefaultLottery;
|
LotteryPicker.SelectedIndex = (int)DefaultLottery;
|
||||||
|
|
||||||
Lottery = Lotteries[LottoPicker.SelectedIndex];
|
Lottery = Lotteries[LotteryPicker.SelectedIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpinButton_Clicked(object sender, EventArgs e)
|
private void SpinButton_Clicked(object sender, EventArgs e)
|
||||||
@ -43,14 +43,15 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
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