Windows 10 - 如何启动率和评论popup/view?

Windows 10 - how to launch rate and review popup/view?

通用 Windows 平台 (UWP) 是否仍然可以启动 'rate and review' 应用程序 windows?

在 Win8 上,下面的行工作正常,但在 Win10 上就不行了

await Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId));

您仍然可以为此目的使用 Launcher class:

public async Task OpenStore()
{
    const string productId = "YOUR PRODUCT ID";
    var uri = new Uri("ms-windows-store://review/?ProductId=" + productId);
    await Launcher.LaunchUriAsync(uri);
}

Windows 商店 的可能启动选项已定义 here (Launch the Windows Store app)

所需的值(例如产品 ID)可以在 每个应用程序的应用程序管理部分的应用程序身份页面上的 Windows 开发中心仪表板中找到。

您可以使用APP的包族名称来启动评分和评论部分。

   await Launcher.LaunchUriAsync(new Uri(string.Format("ms-windows-store:REVIEW?PFN={0}", Windows.ApplicationModel.Package.Current.Id.FamilyName)));

如前所述,您可以启动 Windows 商店应用程序来请求评论:

await Launcher.LaunchUriAsync(new Uri(string.Format("ms-windows-store:REVIEW?PFN={0}", Windows.ApplicationModel.Package.Current.Id.FamilyName)));

但是自从 Windows 10 周年纪念版(10.0;内部版本 14393)以来,可以在您的应用程序中显示评级对话框。我认为这是一个不错的功能,似乎已经引起人们的注意。此代码执行此操作,并且 return 如果用户评论或评价应用程序则为真:

public async Task<bool> ShowRatingReviewDialog()
{
    StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync(
        StoreContext.GetDefault(), 16, String.Empty);

    if (result.ExtendedError == null)
    {
        JObject jsonObject = JObject.Parse(result.Response);
        if (jsonObject.SelectToken("status").ToString() == "success")
        {
            // The customer rated or reviewed the app.
            return true;
        }
    }

    // There was an error with the request, or the customer chose not to
    // rate or review the app.
    return false;
}

代码复制自:https://docs.microsoft.com/en-us/windows/uwp/monetize/request-ratings-and-reviews