Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

refactor: rename setting after apllied to after completion

fatDuckce755992b170
diff --git a/optimizerDuck/Core/Models/Config/AppSettings.cs b/optimizerDuck/Core/Models/Config/AppSettings.cs
index 8cf161f..dd81d06 100644
--- a/optimizerDuck/Core/Models/Config/AppSettings.cs
+++ b/optimizerDuck/Core/Models/Config/AppSettings.cs
@@ -49,7 +49,7 @@ public sealed class AppSettings
/// <summary>
/// Whether to show the success snackbar after applying an optimization.
/// </summary>
- public bool ShowSnackbarNotificationAfterAppliedSuccessfully { get; set; } = false;
+ public bool ShowCompletionNotification { get; set; } = false;
}
/// <summary>
diff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resx
index 4941031..1724aa1 100644
--- a/optimizerDuck/Resources/Languages/Translations.resx
+++ b/optimizerDuck/Resources/Languages/Translations.resx
@@ -1390,11 +1390,11 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="Revert.Shell.Description.Run" xml:space="preserve">
<value>Run {0} command: {1}</value>
</data>
- <data name="Settings.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully.Title" xml:space="preserve">
+ <data name="Settings.Optimize.ShowCompletionNotification.Title" xml:space="preserve">
<value>Show completion notification</value>
</data>
- <data name="Settings.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully.Description" xml:space="preserve">
- <value>Displays a notification when optimizations have been successfully applied.</value>
+ <data name="Settings.Optimize.ShowCompletionNotification.Description" xml:space="preserve">
+ <value>Displays a notification when optimizations have been successfully applied or reverted.</value>
</data>
<data name="Optimizations.Loading" xml:space="preserve">
<value>Loading optimizations...</value>
diff --git a/optimizerDuck/Resources/Languages/Translations.vi-VN.resx b/optimizerDuck/Resources/Languages/Translations.vi-VN.resx
index c9fc80b..acc3324 100644
--- a/optimizerDuck/Resources/Languages/Translations.vi-VN.resx
+++ b/optimizerDuck/Resources/Languages/Translations.vi-VN.resx
@@ -1382,11 +1382,11 @@ Cập nhật ngay để trải nghiệm các tính năng mới, cải tiến và
<data name="Revert.Shell.Description.Run" xml:space="preserve">
<value>Chạy lệnh {0}: {1}</value>
</data>
- <data name="Settings.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully.Title" xml:space="preserve">
+ <data name="Settings.Optimize.ShowCompletionNotification.Title" xml:space="preserve">
<value>Hiển thị thông báo hoàn tất</value>
</data>
- <data name="Settings.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully.Description" xml:space="preserve">
- <value>Hiển thị thông báo sau khi quá trình áp dụng tối ưu hóa hoàn tất thành công.</value>
+ <data name="Settings.Optimize.ShowCompletionNotification.Description" xml:space="preserve">
+ <value>Hiển thị thông báo sau khi quá trình áp dụng hoặc hoàn tác tối ưu hóa hoàn tất thành công.</value>
</data>
<data name="Optimizations.Loading" xml:space="preserve">
<value>Đang tải danh sách tối ưu hóa...</value>
diff --git a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
index c28c80e..122e892 100644
--- a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
@@ -49,7 +49,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
[ObservableProperty] private int _selectedRiskFilterIndex; // 0=All, 1=Safe, 2=Moderate, 3=Risky
[ObservableProperty] private int _selectedSortByIndex; // 0=Risk & Status, 1=Name, 2=Risk
- [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ToggleOptimizationCommand))]
+ [ObservableProperty]
+ [NotifyCanExecuteChangedFor(nameof(ToggleOptimizationCommand))]
private bool _isProcessing;
[ObservableProperty] private bool _isLoading;
@@ -139,7 +140,6 @@ public partial class OptimizationCategoryViewModel : ViewModel
optimization,
progress => _optimizationService.ApplyAsync(optimization, progress));
-
// If result status is Failed, we can't retry it
if (applyResult.Status == OptimizationSuccessResult.Failed)
{
@@ -196,7 +196,6 @@ public partial class OptimizationCategoryViewModel : ViewModel
optimization,
progress => _optimizationService.RevertAsync(optimization, progress));
-
var retryOutcome = await HandleFailedStepsAsync(
optimization,
revertResult.FailedStepDetails,
@@ -334,7 +333,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
return !IsProcessing;
}
- #endregion
+ #endregion CanExecutes
#region Helpers
@@ -534,7 +533,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
private void ShowOutcomeSnackbar(bool succeeded, bool partial, bool failed, string operationType,
string message, bool restorePointCreated = false)
{
- var showSuccess = _appOptionsMonitor.CurrentValue.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully;
+ var showSuccess = _appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification;
var finalMessage = message;
if (restorePointCreated && showSuccess)
@@ -606,7 +605,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
case RestorePointResult.Success:
// if setting show snackbar after applied successfully was off, so show it and applied snackbar wont conflict this
- if (!_appOptionsMonitor.CurrentValue.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully)
+ if (!_appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification)
{
_snackbarService.Show(
Translations.RestorePoint_Snackbar_Success_Title,
@@ -678,5 +677,5 @@ public partial class OptimizationCategoryViewModel : ViewModel
Skipped
}
- #endregion
+ #endregion Helpers
}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
index fac44da..2019121 100644
--- a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
@@ -38,6 +38,7 @@ public partial class SettingsViewModel(
//Learn more links
public string Website { get; } = Shared.WebsiteURL;
+
public string Documentation { get; } = Shared.WebsiteURL + "docs/guides/getting-started";
public string Community { get; } = Shared.CommunityURL;
public string Contribute { get; } = Shared.ContributeURL;
@@ -59,7 +60,7 @@ public partial class SettingsViewModel(
{
SelectedCultureName = appOptionsMonitor.CurrentValue.App.Language;
ShellTimeoutMs = appOptionsMonitor.CurrentValue.Optimize.ShellTimeoutMs;
- ShowSnackbarNotificationAfterAppliedSuccessfully = appOptionsMonitor.CurrentValue.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully;
+ ShowSnackbarNotificationAfterAppliedSuccessfully = appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification;
RemoveProvisioned = appOptionsMonitor.CurrentValue.Bloatware.RemoveProvisioned;
CurrentApplicationTheme = ApplicationThemeManager.GetAppTheme();
@@ -184,6 +185,7 @@ public partial class SettingsViewModel(
UseShellExecute = true
});
break;
+
case "Help":
logger.LogInformation("Opening page: {Url}", Shared.CommunityURL);
Process.Start(new ProcessStartInfo
@@ -207,7 +209,6 @@ public partial class SettingsViewModel(
}
}
-
[RelayCommand]
private void ToggleRemoveProvisioned()
{
@@ -217,11 +218,11 @@ public partial class SettingsViewModel(
}
[RelayCommand]
- private void ToggleShowSnackbarNotificationAfterAppliedSuccessfully()
+ private void ToggleShowCompletionNotification()
{
if (!_isInitialized) return;
- _ = configManager.SetAsync("optimize:showSnackbarNotificationAfterAppliedSuccessfully",
- (!appOptionsMonitor.CurrentValue.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully).ToString());
+ _ = configManager.SetAsync("optimize:showCompletionNotification",
+ (!appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification).ToString());
}
[RelayCommand]
diff --git a/optimizerDuck/UI/Views/Pages/SettingsPage.xaml b/optimizerDuck/UI/Views/Pages/SettingsPage.xaml
index 28b6517..efa6788 100644
--- a/optimizerDuck/UI/Views/Pages/SettingsPage.xaml
+++ b/optimizerDuck/UI/Views/Pages/SettingsPage.xaml
@@ -1,22 +1,22 @@
<Page
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- Margin="0,32,0,0"
- Title="SettingsPage"
- d:DataContext="{d:DesignInstance pages:SettingsPage}"
- d:DesignHeight="1200"
- d:DesignWidth="800"
- mc:Ignorable="d"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
x:Class="optimizerDuck.UI.Views.Pages.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:optimizerDuck.UI.Views.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ Title="SettingsPage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance pages:SettingsPage}"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ mc:Ignorable="d">
<Page.Resources>
<converters:ThemeToIndexConverter x:Key="ThemeToIndexConverter" />
@@ -37,9 +37,9 @@
<ui:CardControl.Header>
<StackPanel>
<ui:TextBlock
+ Margin="0"
FontTypography="BodyStrong"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- Margin="0"
Text="{ext:Loc Settings.Appearance.LanguageSelector.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -59,9 +59,9 @@
<ui:CardControl.Header>
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
Text="{ext:Loc Settings.Appearance.ThemeSelector.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -90,9 +90,9 @@
<ui:CardControl.Header>
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
Text="{ext:Loc Settings.Optimize.ShellTimeout.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -116,19 +116,19 @@
<ui:CardControl.Header>
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
- Text="{ext:Loc Settings.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully.Title}"
+ Text="{ext:Loc Settings.Optimize.ShowCompletionNotification.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
Appearance="Secondary"
- Text="{ext:Loc Settings.Optimize.ShowSnackbarNotificationAfterAppliedSuccessfully.Description}"
+ Text="{ext:Loc Settings.Optimize.ShowCompletionNotification.Description}"
TextWrapping="Wrap" />
</StackPanel>
</ui:CardControl.Header>
- <ui:ToggleSwitch Command="{Binding ViewModel.ToggleShowSnackbarNotificationAfterAppliedSuccessfullyCommand}" IsChecked="{Binding ViewModel.ShowSnackbarNotificationAfterAppliedSuccessfully, Mode=TwoWay}" />
+ <ui:ToggleSwitch Command="{Binding ViewModel.ToggleShowCompletionNotificationCommand}" IsChecked="{Binding ViewModel.ShowSnackbarNotificationAfterAppliedSuccessfully, Mode=TwoWay}" />
</ui:CardControl>
</StackPanel>
@@ -142,9 +142,9 @@
<ui:CardControl.Header>
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
Text="{ext:Loc Settings.Bloatware.RemoveProvisioned.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -170,9 +170,9 @@
</ui:CardAction.Icon>
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
Text="{ext:Loc Settings.Advanced.ClearResources.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -188,9 +188,9 @@
</ui:CardAction.Icon>
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -203,9 +203,9 @@
<ui:CardAction Command="{Binding ViewModel.OpenRootDirCommand}" Icon="{ui:SymbolIcon Folder24}">
<StackPanel>
<ui:TextBlock
+ Margin="0"
Appearance="Primary"
FontTypography="BodyStrong"
- Margin="0"
Text="{ext:Loc Settings.Advanced.OpenRootDir.Title}"
TextWrapping="Wrap" />
<ui:TextBlock
@@ -247,8 +247,8 @@
Icon="{ui:SymbolIcon ChatBubblesQuestion24}">
<StackPanel>
<ui:TextBlock
- FontTypography="BodyStrong"
Padding="0"
+ FontTypography="BodyStrong"
Text="{ext:Loc Settings.About.NeedHelp.Title}" />
<ui:TextBlock
Appearance="Secondary"
@@ -257,7 +257,7 @@
</StackPanel>
</ui:CardAction>
- <ui:CardAction Command="{Binding ViewModel.OpenAcknowledgementsCommand}" VerticalAlignment="Stretch">
+ <ui:CardAction VerticalAlignment="Stretch" Command="{Binding ViewModel.OpenAcknowledgementsCommand}">
<ui:CardAction.Icon>
<ui:SymbolIcon Symbol="DocumentHeart24" />
</ui:CardAction.Icon>
@@ -275,8 +275,8 @@
</ui:CardAction>
<ui:TextBlock
- FontTypography="Subtitle"
Margin="0,15,0,0"
+ FontTypography="Subtitle"
Text="{ext:Loc Settings.About.LearnMore}"
TextTrimming="WordEllipsis"
TextWrapping="Wrap" />