RatedContentRestrictions.RequestContentAccessAsync Method

Determines whether the child is allowed to consume a piece of content. If the content is blocked, this method will display a “content blocked by Family Safety” dialog with options to request a parental override. Applications are expected to take no action if this method returns false.

Syntax

public:
IAsyncOperation<bool>^ RequestContentAccessAsync(
         RatedContentDescription^ ratedContentDescription
)  

Parameters

ratedContentDescription
Type: RatedContentDescription 

Describes the content for which access is being requested.

Return value

Type: IAsyncOperation<Boolean

Returns an IAsyncOperation<TResult> object that represents the state of the asynchronous operation. Completion of the asynchronous operation is signaled by using a handler that is passed to the IAsyncOperation<TResult>.Completed property. When the asynchronous operation is complete, the result of the operation can be retrieved by using the IAsyncOperation<TResult>.GetResults method.
The result is true if the app can display the content, and false if the app should take no action.

Example

public async Task PlayMovie(RatedContentInfo content)
{
    if (await RatedContentRestrictions.Default.RequestContentAccessAsync(content))
    {
        // Play the content
    }
}  

Requirements

Namespace: Windows.Media.ContentRestrictions

Metadata: windows.winmd

See also

Reference

RatedContentRestrictions Class

RatedContentRestrictions Members

Windows.Media.ContentRestrictions Namespace