static void Connection_StateChanged(Windows.Media.PlayTo.PlayToConnection sender, Windows.Media.PlayTo.PlayToConnectionStateChangedEventArgs args) { IsConnectedViaPlayTo = args.CurrentState != Windows.Media.PlayTo.PlayToConnectionState.Disconnected; if (PlayToConnectionStateChanged != null) PlayToConnectionStateChanged(); if (!IsConnectedViaPlayTo) CurrentConnectionDetails = null; }
static void ptm_SourceSelected(Windows.Media.PlayTo.PlayToManager sender, Windows.Media.PlayTo.PlayToSourceSelectedEventArgs args) { CurrentConnectionDetails = args; Crystal.Dispatcher.DispatcherService.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { globalMediaElement.PlayToSource.Connection.StateChanged += Connection_StateChanged; globalMediaElement.PlayToSource.Connection.Transferred += Connection_Transferred; globalMediaElement.PlayToSource.Connection.Error += Connection_Error; }); }
void playToManager_SourceSelected(PlayToManager sender, PlayToSourceSelectedEventArgs args) { var handler = _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { SetControlerState(false, true); }); }