private void ShowImageStream(IRandomAccessStreamWithContentType newStream) { // The incoming stream has image data. Hide video controls/show image controls and set the image source _imageSource = new BitmapImage(); //Callback to notify the receiver and then detach when the image has completed its loading RoutedEventHandler handler = null; handler = (o, eventArgs) => { _receiver.NotifyLoadedMetadata(); _imageSource.ImageOpened -= handler; }; _imageSource.ImageOpened += handler; _imageSource.SetSource(newStream); // Toggle the visibility of the video/image controls if necessary if (_currentPlaybackType != PlaybackType.Image) { if (_currentPlaybackType == PlaybackType.Video) { VideoPlayer.Stop(); } ImagePlayer.Opacity = 1; VideoPlayer.Opacity = 0; } // Track the current playback type _currentPlaybackType = PlaybackType.Image; }
void imagerevd_ImageOpened(object sender, RoutedEventArgs e) { receiver.NotifyLoadedMetadata(); }