I have a button with 3 States Start/Resume/Pause.
1 Is this a good pattern to solve this or maybe there is some toggle button mode that I am not aware of?
private void cmdStart_Click(object sender, RoutedEventArgs e)
{
if (m_end)
{
// Reset the game.
m_end = false;
cmdStart.Content = "Pause Game";
// Update the display.
}
else
{
if (m_pause)
{
m_bombTimer.Start();
foreach (var storyboard in m_storyboards)
{
// resume all animations
}
status.Visibility = System.Windows.Visibility.Collapsed;
m_pause = false;
cmdStart.Content = "Pause Game";
}
else
{
m_bombTimer.Stop();
foreach (var storyboard in m_storyboards)
{
// pause all animations
}
status.Visibility = System.Windows.Visibility.Visible;
cmdStart.Content = "Resume Game";
m_pause = true;
}
}
2 How to get rid off focus of button in Silverlight? I do not want to user to click button pressing enter.