> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XStoreShowRateAndReviewUIAsync

> XStoreShowRateAndReviewUIAsync

# XStoreShowRateAndReviewUIAsync

显示一个系统对话框弹窗，允许用户为当前游戏提供评论或选择拒绝。

## 语法

```cpp theme={null}
HRESULT XStoreShowRateAndReviewUIAsync(  
         const XStoreContextHandle storeContextHandle,  
         XAsyncBlock* async  
)  
```

### 参数

*storeContextHandle*   \_In\_\
类型：XStoreContextHandle

[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext) 为用户返回的商店上下文句柄。

*async*   \_Inout\_\
类型：[XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

定义正在完成的异步工作的 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)。[XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 可用于轮询调用的状态并检索调用结果。有关详细信息，请参阅 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)。

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。

## 备注

要检索此函数调用的执行结果，请在调用此函数之后调用 [XStoreShowRateAndReviewUIResult](/reference/system/xstore/functions/xstoreshowrateandreviewuiresult)。

如果系统检测到游戏过度调用此函数，它将隐藏对话框并自动返回 **CanceledByUser**。

以下代码片段展示了显示评论对话框的示例。

```cpp theme={null}
void CALLBACK ShowRateAndReviewUICallback(XAsyncBlock* asyncBlock)
{
    XStoreRateAndReviewResult result{};
    HRESULT hr = XStoreShowRateAndReviewUIResult(
        asyncBlock,
        &result);

    if (FAILED(hr))
    {
        printf("Failed to rate and review: 0x%x\r\n", hr);
        return;
    }

    printf("result.wasUpdated: %s\r\n", result.wasUpdated ? "true" : "false");
}

void ShowRateAndReviewUI(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = ShowRateAndReviewUICallback;

    HRESULT hr = XStoreShowRateAndReviewUIAsync(
        storeContextHandle,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed rate and review: 0x%x\r\n", hr);
        return;
    }
}

```

## 要求

**头文件：** XStore.h（包含在 XGameRuntime.h 中）

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[XStore](/reference/system/xstore/xstore_members)\
[XStoreShowRateAndReviewUIResult](/reference/system/xstore/functions/xstoreshowrateandreviewuiresult)


## Related topics

- [XStoreShowRateAndReviewUIResult](/zh-CN/reference/system/xstore/functions/xstoreshowrateandreviewuiresult.md)
- [XStoreRateAndReviewResult](/zh-CN/reference/system/xstore/structs/xstorerateandreviewresult.md)
- [XStore](/zh-CN/reference/system/xstore/xstore_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XStoreShowPurchaseUIAsync](/zh-CN/reference/system/xstore/functions/xstoreshowpurchaseuiasync.md)
