Skip to content

A Swiss Army knife for developers.

Added Rate and Review button in Settings

Etienne Baudoux5133bb9c5a65
diff --git a/src/dev/impl/DevTools.Common/LanguageManager.cs b/src/dev/impl/DevTools.Common/LanguageManager.cs
index fd62e1074..ef1332ac3 100644
--- a/src/dev/impl/DevTools.Common/LanguageManager.cs
+++ b/src/dev/impl/DevTools.Common/LanguageManager.cs
@@ -520,6 +520,11 @@ namespace DevTools.Common
/// </summary>
public string PrivacyPolicy => _resources.GetString("PrivacyPolicy");
+ /// <summary>
+ /// Gets the resource RateAndReview.
+ /// </summary>
+ public string RateAndReview => _resources.GetString("RateAndReview");
+
/// <summary>
/// Gets the resource SmartDetection.
/// </summary>
diff --git a/src/dev/impl/DevTools.Common/Strings/en/Settings.resw b/src/dev/impl/DevTools.Common/Strings/en/Settings.resw
index 4bb51bddc..e752a3c86 100644
--- a/src/dev/impl/DevTools.Common/Strings/en/Settings.resw
+++ b/src/dev/impl/DevTools.Common/Strings/en/Settings.resw
@@ -174,6 +174,9 @@
<data name="PrivacyPolicy" xml:space="preserve">
<value>Privacy policy</value>
</data>
+ <data name="RateAndReview" xml:space="preserve">
+ <value>Rate and review on Microsoft Store</value>
+ </data>
<data name="SmartDetection" xml:space="preserve">
<value>Smart detection</value>
</data>
diff --git a/src/dev/impl/DevTools.Impl/ViewModels/Settings/SettingsToolViewModel.cs b/src/dev/impl/DevTools.Impl/ViewModels/Settings/SettingsToolViewModel.cs
index 14f3468f3..b7d69dc62 100644
--- a/src/dev/impl/DevTools.Impl/ViewModels/Settings/SettingsToolViewModel.cs
+++ b/src/dev/impl/DevTools.Impl/ViewModels/Settings/SettingsToolViewModel.cs
@@ -4,6 +4,7 @@ using DevTools.Common;
using DevTools.Core;
using DevTools.Core.Settings;
using DevTools.Core.Theme;
+using DevTools.Core.Threading;
using DevTools.Impl.Views.Settings;
using DevTools.Providers;
using Microsoft.Toolkit.Mvvm.ComponentModel;
@@ -13,12 +14,14 @@ using System.Collections.Generic;
using System.Composition;
using System.Reflection;
using System.Threading.Tasks;
+using Windows.Services.Store;
namespace DevTools.Impl.ViewModels.Settings
{
[Export(typeof(SettingsToolViewModel))]
public sealed class SettingsToolViewModel : ObservableRecipient, IToolViewModel
{
+ private readonly IThread _thread;
private readonly IWindowManager _windowManager;
private readonly ISettingsProvider _settingsProvider;
@@ -77,15 +80,18 @@ namespace DevTools.Impl.ViewModels.Settings
[ImportingConstructor]
public SettingsToolViewModel(
+ IThread thread,
IWindowManager windowManager,
ISettingsProvider settingsProvider)
{
+ _thread = thread;
_windowManager = windowManager;
_settingsProvider = settingsProvider;
PrivacyPolicyCommand = new AsyncRelayCommand(ExecutePrivacyPolicyCommandAsync);
ThirdPartyNoticesCommand = new AsyncRelayCommand(ExecuteThirdPartyNoticesCommandAsync);
LicenseCommand = new AsyncRelayCommand(ExecuteLicenseCommandAsync);
+ RateAndReviewCommand = new AsyncRelayCommand(ExecuteRateAndReviewCommandAsync);
}
#region PrivacyPolicyCommand
@@ -132,5 +138,21 @@ namespace DevTools.Impl.ViewModels.Settings
}
#endregion
+
+ #region RateAndReviewCommand
+
+ internal IAsyncRelayCommand RateAndReviewCommand { get; }
+
+ private async Task ExecuteRateAndReviewCommandAsync()
+ {
+ StoreContext storeContext = StoreContext.GetDefault();
+
+ StoreRateAndReviewResult result = await _thread.RunOnUIThreadAsync(async () =>
+ {
+ return await storeContext.RequestRateAndReviewAppAsync();
+ }).ConfigureAwait(false);
+ }
+
+ #endregion
}
}
diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml
index b6eb024a3..cbd7db2cf 100644
--- a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml
+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml
@@ -131,7 +131,7 @@
<StackPanel Grid.Column="0">
<HyperlinkButton Content="App website" NavigateUri="http://www.microsoft.com" />
<HyperlinkButton Content="{x:Bind ViewModel.Strings.PrivacyPolicy}" Command="{x:Bind ViewModel.PrivacyPolicyCommand}" />
- <HyperlinkButton Content="Rate and review on Microsoft Store" NavigateUri="http://www.microsoft.com" />
+ <HyperlinkButton Content="{x:Bind ViewModel.Strings.RateAndReview}" Command="{x:Bind ViewModel.RateAndReviewCommand}" />
<HyperlinkButton Content="Donate" NavigateUri="http://www.microsoft.com" />
</StackPanel>
<StackPanel Grid.Column="1">