private void OnGameStatusChanged(GameStateMessage message) { TriggerPropertyChanged("IsPaused"); TriggerPropertyChanged("RemainedMines"); TriggerPropertyChanged("Flags"); TriggerPropertyChanged("State"); if (game.GameState == GameState.Failed) { IsMousePressed = false; Application.Current.Dispatcher.BeginInvoke(new Action(() => { game.UpdateStatistics(); ShowLostWindow(); })); } else if (game.GameState == GameState.Success) { IsMousePressed = false; Application.Current.Dispatcher.BeginInvoke(new Action(() => { game.UpdateStatistics(); ShowWonWindow(); }), DispatcherPriority.Input); } }
private void OnGameStateChanged(GameStateMessage message) { var game = message.Source as IClearMine; if (IsEnabled && game != null) { if (game.GameState == GameState.Failed) { Player.Play(this["Lost"].Value as string); } else if (game.GameState == GameState.Success) { Player.Play(this["Won"].Value as string); } else if (game.GameState == GameState.Initialized) { Player.Play(this["New"].Value as string); } else { // Play nothing. } } }