void Events_StateChanged(object sender, MediaStateChange e) { UISync.Execute(() => label1.Text = e.NewState.ToString()); }
void EventsStateChanged(object sender, MediaStateChange e) { UISync.Execute(() => label1.Text = e.NewState.ToString()); switch (e.NewState) { case MediaState.Playing: UISync.Execute(() => btnPlayPause.Text = LocRm.GetString("Pause")); break; default: UISync.Execute(() => btnPlayPause.Text = LocRm.GetString("Play")); break; } }
void EventsStateChanged(object sender, MediaStateChange e) { UISync.Execute(() => label1.Text = e.NewState.ToString()); switch (e.NewState) { case MediaState.Playing: UISync.Execute(() => btnPlayPause.Text = "||"); break; case MediaState.Ended: if (chkRepeatAll.Checked) Go(1); UISync.Execute(() => btnPlayPause.Text = ">"); break; default: UISync.Execute(() => btnPlayPause.Text = ">"); break; } }
void Events_StateChanged(object sender, MediaStateChange e) { this.Dispatcher.BeginInvoke(new Action(delegate { })); }
void EventsStateChanged(object sender, MediaStateChange e) { switch (e.NewState) { case MediaState.Ended: case MediaState.Stopped: case MediaState.Error: if (_stopEvent != null && !_stopping) { _stopping = true; try { _stopEvent.Set(); } catch { // ignored } } break; } }
void EventsStateChanged(object sender, MediaStateChange e) { lock (_lock) { switch (e.NewState) { case MediaState.Ended: case MediaState.Stopped: case MediaState.Error: if (_isrunning || _starting) { DisposePlayer(); Duration = Time = 0; _starting = false; _isrunning = false; Thread.Sleep(1000); //lets buffered frames stop before raising finished event //if file source then dont reconnect if (!Seekable && !_stoprequested) { if (PlayingFinished != null) PlayingFinished(sender, ReasonToFinishPlaying.DeviceLost); if (AudioFinished != null) AudioFinished(sender, ReasonToFinishPlaying.DeviceLost); } else { if (PlayingFinished != null) PlayingFinished(sender, ReasonToFinishPlaying.StoppedByUser); if (AudioFinished != null) AudioFinished(sender, ReasonToFinishPlaying.StoppedByUser); } } _stoprequested = false; break; } } }