public void Execute(object parameter) { MediaStreamSource source = null; var app = (App)App.Current; var media = app.MediaElement; if (parameter is ServerMediaItem) { var mediaItem = (ServerMediaItem)parameter; } else if (parameter is AudioMediaItem) { var mediaItem = (AudioMediaItem)parameter; source = new InMemoryAudioPlayer(mediaItem.Data); } media.Stop(); media.SetSource(source); media.Play(); }