Skip to content

Commit

Permalink
Update Sample.UI null check
Browse files Browse the repository at this point in the history
  • Loading branch information
DubyaDude committed Jan 20, 2024
1 parent 2c1636f commit c758ad2
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Sample.UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,31 +142,31 @@ private void UpdateUI(MediaSession mediaSession)

private async void Back_Click(object sender, RoutedEventArgs e)
{
if(currentSession != null)
{
await currentSession.ControlSession.TrySkipPreviousAsync();
}
if (currentSession == null)
return;

await currentSession.ControlSession.TrySkipPreviousAsync();
}

private async void PlayPause_Click(object sender, RoutedEventArgs e)
{
if (currentSession != null)
{
var controlsInfo = currentSession.ControlSession.GetPlaybackInfo().Controls;
if (currentSession == null)
return;

if (controlsInfo.IsPauseEnabled == true)
await currentSession.ControlSession.TryPauseAsync();
else if (controlsInfo.IsPlayEnabled == true)
await currentSession.ControlSession.TryPlayAsync();
}
var controlsInfo = currentSession.ControlSession.GetPlaybackInfo().Controls;

if (controlsInfo.IsPauseEnabled == true)
await currentSession.ControlSession.TryPauseAsync();
else if (controlsInfo.IsPlayEnabled == true)
await currentSession.ControlSession.TryPlayAsync();
}

private async void Forward_Click(object sender, RoutedEventArgs e)
{
if (currentSession != null)
{
await currentSession.ControlSession.TrySkipNextAsync();
}
if (currentSession == null)
return;

await currentSession.ControlSession.TrySkipNextAsync();
}
}

Expand Down

0 comments on commit c758ad2

Please sign in to comment.