private async void ButtonOnPlayStateChanged( SoundPlayButton activeButton, SoundPlayState newState) { lock (_lockObject) { if (_isLoading) return; _isLoading = true; } if (activeButton == null) return; _activeButton = activeButton; var notification = new SoundPlayStateChangedNotification { NewSound = (Sound)activeButton.DataContext, NewState = newState }; if (newState == SoundPlayState.Playing) { foreach (SoundPlayButton button in _buttons) { if (button != activeButton && button.State == SoundPlayState.Playing) { button.State = SoundPlayState.Stopped; MediaElementSound.Stop(); } } await SetSound(activeButton.Sound); Play(); } else { activeButton.State = SoundPlayState.Paused; Stop(); } //if (Command != null) // Command.Execute(notification); _isLoading = false; }
private void ChangeSoundStateChanged(SoundPlayState newState) { var oldState = _activeButton.State; _activeButton.State = newState; var notification = new SoundPlayStateChangedNotification { OldSound = _sound, OldState = oldState, NewSound = _sound, NewState = newState }; //if (Command != null) // Command.Execute(notification); }