int started = 0;
if (Windows.Storage.ApplicationData.Current.RoamingSettings.Values.ContainsKey("started"))
{
started = (int)Windows.Storage.ApplicationData.Current.RoamingSettings.Values["started"];
}
started++;
Windows.Storage.ApplicationData.Current.RoamingSettings.Values["started"] = started;
if (started == 2)
{
var md = new Windows.UI.Popups.MessageDialog("Thank you for using Rubber Duck for a while now, would you like to review this app?", "Please review my app");
bool? reviewresult = null;
md.Commands.Add(new Windows.UI.Popups.UICommand("OK", new Windows.UI.Popups.UICommandInvokedHandler((cmd) => reviewresult = true)));
md.Commands.Add(new Windows.UI.Popups.UICommand("Cancel", new Windows.UI.Popups.UICommandInvokedHandler((cmd) => reviewresult = false)));
await md.ShowAsync();
if (reviewresult == true)
{
string familyName = Package.Current.Id.FamilyName;
await Windows.System.Launcher.LaunchUriAsync(new Uri(string.Format("ms-windows-store:REVIEW?PFN={0}", familyName)));
}
}
One change I did is I put the keyword async in front of the OnLaunched event so it looks like this:
async protected override void OnLaunched(LaunchActivatedEventArgs args)
Hope this helps you get more and better reviews of your app.