Click or drag to resize

IMediaReceiversRetrieveAsync Method (PredicateIMediaReceiver, TimeSpan)

Waiting till the first receiver matching the predicate is discovered.

Namespace:  DotNetBrowser.Cast
Assembly:  DotNetBrowser (in DotNetBrowser.dll) Version: 2.27.4
Syntax
C#
Task<IMediaReceiver> RetrieveAsync(
	Predicate<IMediaReceiver> predicate,
	TimeSpan timeout
)

Parameters

predicate
Type: SystemPredicateIMediaReceiver
The predicated media receiver.
timeout
Type: SystemTimeSpan
The predefined timeout.

Return Value

Type: TaskIMediaReceiver
The task that can be used to wait for completion and obtain the result with the first discovered receiver matching the predicate.
Exceptions
ExceptionCondition
ReceiverNotDiscoveredException When the receiver has not been discovered within timeout.
Remarks

If a matching receiver has already been discovered, returns it immediately.

Example of usage:

browser.Cast.StartPresentationHandler =
    new AsyncHandler<StartPresentationParameters, StartPresentationResponse>(async p =>
    {
        IMediaReceiver mediaReceiver
            = await p.MediaReceivers
                     .RetrieveAsync(receiver => receiver.Name.Contains("Samsung TV"), timeout);
        return StartPresentationResponse.Start(mediaReceiver);
    });
See Also