private async void MediaManagerOnStateChange(object sender, MediaManagerStateEventArgs e) { Debug.WriteLine("MediaStreamFacadeBase.MediaManagerOnStateChange() to {0}: {1}", (object)e.State, (object)e.Message); if (e.State == MediaManagerState.Closed) { try { await this.StopMediaAsync((IMediaManager)sender, this._closeCancellationTokenSource.Token).ConfigureAwait(false); } catch (OperationCanceledException ex) { } catch (Exception ex) { Debug.WriteLine("MediaStreamFacadeBase.MediaManagerOnStateChange() stop failed: " + ex.Message); } } EventHandler <MediaManagerStateEventArgs> stateChange = this.StateChange; if (null != stateChange) { try { stateChange((object)this, e); } catch (Exception ex) { Debug.WriteLine("MediaStreamFacadeBase.MediaManagerOnStateChange() Exception in StateChange event handler: " + ex.Message); } } }
void TsMediaManagerOnStateChange(object sender, MediaManagerStateEventArgs tsMediaManagerStateEventArgs) { Dispatcher.BeginInvoke(() => { var message = tsMediaManagerStateEventArgs.Message; if (!string.IsNullOrWhiteSpace(message)) { errorBox.Text = message; errorBox.Visibility = Visibility.Visible; } mediaElement1_CurrentStateChanged(null, null); }); }
void TsMediaManagerOnStateChange(object sender, MediaManagerStateEventArgs mediaManagerStateEventArgs) { var awaiter = Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { var message = mediaManagerStateEventArgs.Message; if (!string.IsNullOrWhiteSpace(message)) { errorBox.Text = message; errorBox.Visibility = Visibility.Visible; } mediaElement1_CurrentStateChanged(null, null); }); TaskCollector.Default.Add(awaiter.AsTask(), "MainPage TsMediaManagerOnStateChange"); }
void MediaStreamFacadeOnStateChange(object sender, MediaManagerStateEventArgs args) { Debug.WriteLine("MediaPlayerManager.MediaStreamFacadeOnStateChange(): " + args.State + " message " + args.Message); }