Are there any class in WinRT as MarketPlaceReviewT

2019-08-04 00:57发布

问题:

Are there any class in WinRT as MarketPlaceReview or MarketPlaceSearch Tasks in WP?

Thanks.

回答1:

You can use Windows Store's protocol with specific arguments to launch several tasks related to Store like

If you want to open review page for any app then, you can open with this line.

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:REVIEW?PFN=MY_PACKAGE_FAMILY_NAME"));

If you open the page of particular app in Store app then you can open with this line.

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:PDP?PFN=MY_PACKAGE_FAMILY_NAME"));

MY_PACKAGE_FAMILY_NAME can be found in Package.appxmanifest file.

If you want to search within Store then you can open the Store app with search result with this line.

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:Search?query=YOUR_SEARCH_KEYWORDS"));

The below are the examples which open review page for Nokia Music app, the app page itself & queries Store with text "nokia music" respectively.

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:REVIEW?PFN=NokiaCorporation.NokiaMusic_6d0q6r3z979nw"));

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:PDP?PFN=NokiaCorporation.NokiaMusic_6d0q6r3z979nw"));

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:Search?query=nokia music"));


回答2:

await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:Search?query=YOUR_SEARCH_KEYWORDS"));

In above answer, the line I pasted above here, It is not working in windows phone 8.1. query parameter is wrong, Here we need to use keyword as a parameter.

So, below is the code with right url.

await Windows.System.Launcher.LaunchUriAsync(
    new Uri(string.Format("ms-windows-store:search?{0}={1}", type ,searchTerms)));

Please, check answer here.