public void Invoke(AsyncResult asyncResultRef) { if (disposed) { return; } try { var ev = _session.EndGetEvent(asyncResultRef); if (disposed) { return; } if (ev.TypeInfo == MediaEventTypes.SessionTopologySet) { _player.Begin(); } if (ev.TypeInfo == MediaEventTypes.SessionEnded) { _player.Playing = false; } _session.BeginGetEvent(this, null); } catch (Exception) { } }
public override void Invoke(AsyncResult asyncResult) { // EndGetEvent mandatory var evt = session.EndGetEvent(asyncResult); var typeInfo = evt.TypeInfo; if (typeInfo != MediaEventTypes.SessionClosed) { // If not closed, continnue to subscribe to next events session.BeginGetEvent(this, null); } // Call the callback eventCallback(evt); }