private async void InitialImageConnectionStateChanged(Windows.Media.PlayTo.PlayToConnection sender,
                                                              Windows.Media.PlayTo.PlayToConnectionStateChangedEventArgs e)
        {
            if (e.CurrentState == Windows.Media.PlayTo.PlayToConnectionState.Connected)
            {
                await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                          async() =>
                {
                    // Clear any existing timeout.
                    if (timer != null)
                    {
                        timer.Stop();
                    }

                    // Clear the slide show panel.
                    SlideShowPanel.Children.Clear();

                    // Set the slide show objects and values to show that we are streaming.
                    streaming = true;
                    DisconnectButton.Visibility  = Visibility.Visible;
                    InstructionsBlock.Visibility = Visibility.Collapsed;

                    // Queue and display the next image.
                    var image = await QueueImage(currentImage, true);
                    initialImage.PlayToSource.Next = image.PlayToSource;
                    initialImage.PlayToSource.PlayNext();
                });
            }
            ;
        }
 private void playToConnectionStageChanged(
     Windows.Media.PlayTo.PlayToConnection connection,
     Windows.Media.PlayTo.PlayToConnectionStateChangedEventArgs e)
 {
     messageBlock.Text += "StateChanged: PreviousState = " + e.PreviousState.ToString() + "\n";
     messageBlock.Text += "StateChanged: CurrentState = " + e.CurrentState.ToString() + "\n";
 }