Freigeben über


WidgetResourceResponse Class

Definition

Represents a response to a resource request received through an implementation of IWidgetResourceProvider.OnResourceRequested.

public ref class WidgetResourceResponse sealed
/// [Windows.Foundation.Metadata.Activatable(Microsoft.Windows.Widgets.Providers.IWidgetResourceResponseFactory, 393216, "Microsoft.Windows.Widgets.WidgetContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.Widgets.WidgetContract, 393216)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WidgetResourceResponse final
[Windows.Foundation.Metadata.Activatable(typeof(Microsoft.Windows.Widgets.Providers.IWidgetResourceResponseFactory), 393216, "Microsoft.Windows.Widgets.WidgetContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.Widgets.WidgetContract), 393216)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class WidgetResourceResponse
function WidgetResourceResponse(content, reasonPhrase, statusCode)
Public NotInheritable Class WidgetResourceResponse
Inheritance
Object Platform::Object IInspectable WidgetResourceResponse
Attributes

Remarks

Widget providers can access the resource request through the WidgetResourceRequestedArgs.Request property and set the WidgetResourceRequestedArgs.Response property to a WidgetResourceResponse that contains a stream to the resource and then return. If the evaluation or the resource is not immediately available, the provider should request a deferral by calling WidgetResourceRequestedArgs.GetDeferral, initiate a background task, and complete the deferral when the resource is available.

If the evaluation or the resource is not immediately available, the provider should request a deferral by calling WidgetResourceRequestedArgs.GetDeferral, initiate a background task, and complete the deferral when the resource is available.

If the provider returns the OnResourceRequested call without setting a WidgetResourceResponse in the WidgetResourceRequestedArgs, a web fetch will be made. When returning without a WidgetResourceResponse, the provider may modify the Headers collection which will then be used by the web fetch.

Constructors

WidgetResourceResponse(IRandomAccessStreamReference, String, Int32)

Initializes a new instance of the WidgetResourceResponse class.

Properties

Content

Gets the stream of content that contains the requested resource.

Headers

Gets or sets an optional dictionary of header values that may have been returned from a web request by the widget provider.

ReasonPhrase

Gets a text description of the result that is not user facing.

StatusCode

Gets the HTTP status code of the response.

Applies to