PlayToSource.Next Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém ou define o próximo elemento de origem Reproduzir para.
public:
property PlayToSource ^ Next { PlayToSource ^ get(); void set(PlayToSource ^ value); };
/// [get: Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [set: Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
PlayToSource Next();
void Next(PlayToSource value);
/// [get: Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
/// [set: Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
PlayToSource Next();
void Next(PlayToSource value);
public PlayToSource Next { [Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))] get; [Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))] set; }
public PlayToSource Next { [Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")] get; [Windows.Foundation.Metadata.Deprecated("PlayToSource may be altered or unavailable for releases after Windows 10. Instead, use CastingSource.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")] set; }
var playToSource = playToSource.next;
playToSource.next = playToSource;
Public Property Next As PlayToSource
Valor da propriedade
O próximo elemento de origem Reproduzir para.
- Atributos
Exemplos
// Set up the Play To contract.
// Used to pass an image to Play To that will not be removed/destroyed
// by the slide show logic. For example, if the user opens the Devices
// charm and the sourcerequested event fires, but the image display timeout
// completes before the user selects a target device, then the image that
// was being displayed is removed and destroyed. initialImage is never
// destroyed so Play To will always have a valid source to stream.
Image initialImage = null;
private async void SourceRequested(Windows.Media.PlayTo.PlayToManager sender,
Windows.Media.PlayTo.PlayToSourceRequestedEventArgs e)
{
var deferral = e.SourceRequest.GetDeferral();
await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
() =>
{
initialImage = new Image();
// Use the statechanged event of the image passed to Play To to determine when
// the image is finally connected to the Play To Receiver.
initialImage.PlayToSource.Connection.StateChanged += InitialImageConnectionStateChanged;
// Provide Play To with the first image to stream.
e.SourceRequest.SetSource(initialImage.PlayToSource);
deferral.Complete();
});
}
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();
});
};
}
// Update the once the user has selected a device to stream to.
private async void SourceSelected(Windows.Media.PlayTo.PlayToManager sender,
Windows.Media.PlayTo.PlayToSourceSelectedEventArgs e)
{
await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
() =>
{
DisconnectButton.Click += DisconnectButtonClick;
MessageBlock.Text = "Streaming to " + e.FriendlyName + "...";
DeviceBlock.Text = e.FriendlyName + ".\nClick here to disconnect.";
var imageBitmap = new Windows.UI.Xaml.Media.Imaging.BitmapImage();
imageBitmap.SetSource(e.Icon);
IconImage.Source = imageBitmap;
});
}
private void DisconnectButtonClick(object sender, RoutedEventArgs e)
{
Windows.Media.PlayTo.PlayToManager.ShowPlayToUI();
}
' Set up the Play To contract.
' Used to pass an image to Play To that will not be removed/destroyed
' by the slide show logic. For example, if the user opens the Devices
' charm and the sourcerequested event fires, but the image display timeout
' completes before the user selects a target device, then the image that
' was being displayed is removed and destroyed. initialImage is never
' destroyed so Play To will always have a valid source to stream.
Private initialImage As Image = Nothing
Private Async Sub SourceRequested(sender As Windows.Media.PlayTo.PlayToManager,
e As Windows.Media.PlayTo.PlayToSourceRequestedEventArgs)
Dim deferral = e.SourceRequest.GetDeferral()
Await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
Sub()
initialImage = New Image()
' Use the statechanged event of the image passed to Play To to determine when
' the image is finally connected to the Play To Receiver.
AddHandler initialImage.PlayToSource.Connection.StateChanged, AddressOf InitialImageConnectionStateChanged
' Provide Play To with the first image to stream.
e.SourceRequest.SetSource(initialImage.PlayToSource)
deferral.Complete()
End Sub)
End Sub
Private Async Sub InitialImageConnectionStateChanged(sender As Windows.Media.PlayTo.PlayToConnection,
e As Windows.Media.PlayTo.PlayToConnectionStateChangedEventArgs)
If e.CurrentState = Windows.Media.PlayTo.PlayToConnectionState.Connected Then
Await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
Async Sub()
' Clear any existing timeout.
If timer IsNot Nothing Then 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.
Dim image = Await QueueImage(currentImage, True)
initialImage.PlayToSource.Next = image.PlayToSource
initialImage.PlayToSource.PlayNext()
End Sub)
End If
End Sub
' Update the once the user has selected a device to stream to.
Private Async Sub SourceSelected(sender As Windows.Media.PlayTo.PlayToManager,
e As Windows.Media.PlayTo.PlayToSourceSelectedEventArgs)
Await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
Sub()
AddHandler DisconnectButton.Click, AddressOf DisconnectButtonClick
MessageBlock.Text = "Streaming to " & e.FriendlyName & "..."
DeviceBlock.Text = e.FriendlyName & "." & vbCr & "Click here to disconnect."
Dim imageBitmap = New Windows.UI.Xaml.Media.Imaging.BitmapImage()
imageBitmap.SetSource(e.Icon)
IconImage.Source = imageBitmap
End Sub)
End Sub
Private Sub DisconnectButtonClick()
Windows.Media.PlayTo.PlayToManager.ShowPlayToUI()
End Sub
Comentários
Para obter um exemplo de como usar a propriedade Next, consulte Conversão de mídia.