예제 #1
0
        private void OnSourceRequsted(PlayToManager sender, PlayToSourceRequestedEventArgs args)
        {
            var deferral = args.SourceRequest.GetDeferral();

            Execute.OnUIThread(async() =>
            {
                if (CurrentFile != null)
                {
                    var source = await CreateSourceAsync();

                    if (source == null)
                    {
                        args.SourceRequest.DisplayErrorString(Strings.PlayToInvalidMediaType);
                    }
                    else
                    {
                        args.SourceRequest.SetSource(source);

                        CurrentConnection = source.Connection;
                    }
                }
                else
                {
                    args.SourceRequest.DisplayErrorString(Strings.PlayToNoFile);
                }

                deferral.Complete();
            });
        }
예제 #2
0
 private void playToManager_SourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs args)
 {
     var deferral = args.SourceRequest.GetDeferral();
     var handler  = dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         args.SourceRequest.SetSource(ImageSource.PlayToSource);
         deferral.Complete();
     });
 }
예제 #3
0
        private async void PlayToManagerOnSourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs args)
        {
            var deferral = args.SourceRequest.GetDeferral();
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                args.SourceRequest.SetSource(this.mpTrailer.PlayToSource);

                deferral.Complete();
            });
        }
예제 #4
0
        private async void OnSourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs args)
        {
            var deferral = args.SourceRequest.GetDeferral();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                args.SourceRequest.SetSource(MediaDetails.PlayToSource);

                deferral.Complete();
            });
        }
예제 #5
0
 private async void OnPlayToSourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs e)
 {
     await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                               () =>
     {
         PlayToSourceDeferral deferral = e.SourceRequest.GetDeferral();
         PlayToSourceRequest sr        = e.SourceRequest;
         sr.SetSource(videoMediaElement.PlayToSource);
         deferral.Complete();
     });
 }
예제 #6
0
 void manager_SourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs args)
 {
     var deferral = args.SourceRequest.GetDeferral();
     var handler  = dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (MusicBox.Visibility == Visibility.Visible)
         {
             args.SourceRequest.SetSource(MusicSource.PlayToSource);
         }
         else if (VideoBox.Visibility == Visibility.Visible)
         {
             args.SourceRequest.SetSource(VideoSource.PlayToSource);
         }
         else if (PhotoSource.Visibility == Visibility.Visible)
         {
             args.SourceRequest.SetSource(PhotoSource.PlayToSource);
         }
         deferral.Complete();
     });
 }
예제 #7
0
        private void OnPlayToSourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs args)
        {
            //args.SourceRequest.DisplayErrorString("Test error string");
            var deferral = args.SourceRequest.GetDeferral();

            // This request will come in on a non-UI thread, so it will need to be marshalled over.
            // Since doing that is an an async operation, a deferral will be required.
            Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                () =>
            {
                _currentPlayToImage = (Image)SelectedImageContainer.Content;
                if (_currentPlayToImage == null)
                {
                    args.SourceRequest.DisplayErrorString("There is no image selected to be streamed.");
                }
                else
                {
                    args.SourceRequest.SetSource(_currentPlayToImage.PlayToSource);
                }
                deferral.Complete();
            });
        }
예제 #8
0
        private void OnPlayToSourceRequested(PlayToManager sender,
                                             PlayToSourceRequestedEventArgs args)
        {
            // This request will come in on a non-UI thread,
            // so it will need to be marshalled over.
            // Since doing that is an async operation,
            // a deferral will be required.
            var deferral = args.SourceRequest.GetDeferral();

            Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (MediaElement.PlayToSource == null)
                {
                    var errorMessage = "There is no video selected to be streamed.";
                    args.SourceRequest.DisplayErrorString(errorMessage);
                }
                else
                {
                    args.SourceRequest.SetSource(MediaElement.PlayToSource);
                }

                deferral.Complete();
            });
        }