之前写过一篇文章  UWP 五星好评

 代码如下
var pfn = Package.Current.Id.FamilyName;
await Launcher.LaunchUriAsync(new Uri("ms-windows-store://review/?PFN=" + pfn));

这样做有一个弊端,大家也都知道,商店App做的简直是辣鸡到极致,圆圈不断加载,要是等上面的方法加载,估计黄花菜都要凉了。

这里介绍一种新的评价方法,无需跳转商店,直接在App内评价。

public async Task<bool> ShowRatingReviewDialog()
{
StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync(
StoreContext.GetDefault(), , 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;
}
然后再需要的地方调用 ShowRatingReviewDialog() 即可。
 
 
UWP 五星评价(不跳转到龟速商店)-LMLPHP

 
 
05-08 15:07