Skip to content

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

feat: rework ui, add EmptyBadge control, and refactor fallback

fatDuck9210869fd835
diff --git a/optimizerDuck/App.xaml.cs b/optimizerDuck/App.xaml.cs
index 4042945..9bc547d 100644
--- a/optimizerDuck/App.xaml.cs
+++ b/optimizerDuck/App.xaml.cs
@@ -436,8 +436,6 @@ public partial class App : Application
_logger.LogInformation("Preloading customize settings...");
var customizeRegistry = _host.Services.GetRequiredService<CustomizeRegistry>();
await customizeRegistry.PreloadCategoriesAsync().ConfigureAwait(false);
-
- _logger.LogInformation("Preloading completed.");
}
protected override async void OnExit(ExitEventArgs e)
diff --git a/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs b/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs
index c6d8f40..baf485e 100644
--- a/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs
@@ -1,4 +1,4 @@
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
@@ -164,4 +164,12 @@ public partial class ScheduledTaskModel : ObservableObject
OnPropertyChanged(nameof(IsReady));
OnPropertyChanged(nameof(IsDisabledState));
}
+
+ public bool IsDescriptionEmpty => string.IsNullOrWhiteSpace(Description);
+ public bool IsAuthorEmpty => string.IsNullOrWhiteSpace(Author);
+ public bool IsTriggersEmpty => string.IsNullOrWhiteSpace(TriggerSummary);
+ public bool IsActionEmpty => string.IsNullOrWhiteSpace(ActionSummary);
+ public bool IsLastRunEmpty => LastRunTime is null;
+ public bool IsNextRunEmpty => NextRunTime is null;
+ public bool IsLastResultEmpty => LastRunResult is null;
}
diff --git a/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs b/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs
index 23724ff..91fd9e0 100644
--- a/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs
@@ -1,4 +1,4 @@
-using System.Windows.Media;
+using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
namespace optimizerDuck.Domain.Optimizations.Models.StartupManager;
@@ -55,4 +55,8 @@ public partial class StartupTask : ObservableObject
/// </summary>
public bool IsMicrosoftTask =>
TaskPath.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);
+
+ public bool IsDescriptionEmpty => string.IsNullOrWhiteSpace(Description);
+ public bool IsTriggersEmpty => string.IsNullOrWhiteSpace(TriggerSummary);
+ public bool IsActionEmpty => string.IsNullOrWhiteSpace(ActionSummary);
}
diff --git a/optimizerDuck/Resources/Languages/Translations.Designer.cs b/optimizerDuck/Resources/Languages/Translations.Designer.cs
index bb96082..19788cb 100644
--- a/optimizerDuck/Resources/Languages/Translations.Designer.cs
+++ b/optimizerDuck/Resources/Languages/Translations.Designer.cs
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@@ -375,6 +375,15 @@ namespace optimizerDuck.Resources.Languages {
}
}
+ /// <summary>
+ /// Looks up a localized string similar to Empty.
+ /// </summary>
+ internal static string Common_Empty {
+ get {
+ return ResourceManager.GetString("Common.Empty", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Filter.
/// </summary>
@@ -2023,6 +2032,51 @@ namespace optimizerDuck.Resources.Languages {
}
}
+ /// <summary>
+ /// Looks up a localized string similar to You are about to delete {0} ({1}). Please confirm..
+ /// </summary>
+ internal static string DiskCleanup_Dialog_Confirmation_SingleItem {
+ get {
+ return ResourceManager.GetString("DiskCleanup.Dialog.Confirmation.SingleItem", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clean Item.
+ /// </summary>
+ internal static string DiskCleanup_Dialog_Confirmation_SingleTitle {
+ get {
+ return ResourceManager.GetString("DiskCleanup.Dialog.Confirmation.SingleTitle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You are about to delete {0} from {1} item(s) ({2} file(s)). Please review the items below..
+ /// </summary>
+ internal static string DiskCleanup_Dialog_Confirmation_Summary {
+ get {
+ return ResourceManager.GetString("DiskCleanup.Dialog.Confirmation.Summary", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clean {0} Selected Items.
+ /// </summary>
+ internal static string DiskCleanup_Dialog_Confirmation_Title {
+ get {
+ return ResourceManager.GetString("DiskCleanup.Dialog.Confirmation.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Files will be permanently deleted. This action cannot be undone..
+ /// </summary>
+ internal static string DiskCleanup_Dialog_Confirmation_Warning {
+ get {
+ return ResourceManager.GetString("DiskCleanup.Dialog.Confirmation.Warning", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Empty size.
/// </summary>
@@ -4133,6 +4187,15 @@ namespace optimizerDuck.Resources.Languages {
}
}
+ /// <summary>
+ /// Looks up a localized string similar to Deleting a scheduled task is permanent. The task will no longer run automatically..
+ /// </summary>
+ internal static string ScheduledTasks_Dialog_DeleteWarning {
+ get {
+ return ResourceManager.GetString("ScheduledTasks.Dialog.DeleteWarning", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Task not found: {0}.
/// </summary>
diff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resx
index e8f5efe..e14907e 100644
--- a/optimizerDuck/Resources/Languages/Translations.resx
+++ b/optimizerDuck/Resources/Languages/Translations.resx
@@ -1330,6 +1330,21 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="DiskCleanup.ItemsAndFilesSelected" xml:space="preserve">
<value>{0} selected • {1} items • {2} files</value>
</data>
+ <data name="DiskCleanup.Dialog.Confirmation.Warning" xml:space="preserve">
+ <value>Files will be permanently deleted. This action cannot be undone.</value>
+ </data>
+ <data name="DiskCleanup.Dialog.Confirmation.Title" xml:space="preserve">
+ <value>Clean {0} Selected Items</value>
+ </data>
+ <data name="DiskCleanup.Dialog.Confirmation.Summary" xml:space="preserve">
+ <value>You are about to delete {0} from {1} item(s) ({2} file(s)). Please review the items below.</value>
+ </data>
+ <data name="DiskCleanup.Dialog.Confirmation.SingleTitle" xml:space="preserve">
+ <value>Clean Item</value>
+ </data>
+ <data name="DiskCleanup.Dialog.Confirmation.SingleItem" xml:space="preserve">
+ <value>You are about to delete {0} ({1}). Please confirm.</value>
+ </data>
<data name="Settings.About.NeedHelp.Title" xml:space="preserve">
<value>Need help?</value>
</data>
@@ -1461,6 +1476,9 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="ScheduledTasks.Dialog.DeleteMessage" xml:space="preserve">
<value>Are you sure you want to delete the task "{0}"? This action cannot be undone.</value>
</data>
+ <data name="ScheduledTasks.Dialog.DeleteWarning" xml:space="preserve">
+ <value>Deleting a scheduled task is permanent. The task will no longer run automatically.</value>
+ </data>
<!-- Scheduled Tasks Details -->
<data name="ScheduledTasks.Details.Path" xml:space="preserve">
<value>Path</value>
@@ -1496,6 +1514,9 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="Common.Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
+ <data name="Common.Empty" xml:space="preserve">
+ <value>Empty</value>
+ </data>
<data name="Common.SortBy.State" xml:space="preserve">
<value>State</value>
</data>
diff --git a/optimizerDuck/UI/Controls/EmptyBadge.xaml b/optimizerDuck/UI/Controls/EmptyBadge.xaml
new file mode 100644
index 0000000..cb086d0
--- /dev/null
+++ b/optimizerDuck/UI/Controls/EmptyBadge.xaml
@@ -0,0 +1,28 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Controls.EmptyBadge"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DesignHeight="30"
+ d:DesignWidth="80"
+ mc:Ignorable="d">
+ <Border
+ Width="Auto"
+ Margin="0,2,0,0"
+ Padding="6,4"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4">
+ <Grid ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,4,0" Symbol="QuestionCircle24" />
+ <ui:TextBlock
+ Grid.Column="1"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{ext:Loc Common.Empty}" />
+ </Grid>
+ </Border>
+</UserControl>
diff --git a/optimizerDuck/UI/Controls/EmptyBadge.xaml.cs b/optimizerDuck/UI/Controls/EmptyBadge.xaml.cs
new file mode 100644
index 0000000..71fa06d
--- /dev/null
+++ b/optimizerDuck/UI/Controls/EmptyBadge.xaml.cs
@@ -0,0 +1,11 @@
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Controls;
+
+public partial class EmptyBadge : UserControl
+{
+ public EmptyBadge()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml b/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
index def3b53..3a240e5 100644
--- a/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
@@ -1,4 +1,4 @@
-<UserControl
+<UserControl
x:Class="optimizerDuck.UI.Dialogs.BloatwareConfirmationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,6 +8,7 @@
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=dialogVm:BloatwareConfirmationDialogViewModel}"
d:DesignHeight="520"
d:DesignWidth="900"
mc:Ignorable="d">
diff --git a/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml b/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml
new file mode 100644
index 0000000..a52c173
--- /dev/null
+++ b/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml
@@ -0,0 +1,136 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Dialogs.DiskCleanupConfirmationDialog"
+ 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:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=dialogVm:DiskCleanupConfirmationDialogViewModel}"
+ d:DesignHeight="500"
+ d:DesignWidth="700"
+ mc:Ignorable="d">
+ <UserControl.Resources>
+ <converters:NumericComparisonToVisibilityConverter
+ x:Key="GreaterThanZeroToVisibilityConverter"
+ ComparisonType="GreaterThan"
+ Threshold="0" />
+ <converters:SizeToBrushConverter x:Key="SizeToBrushConverter" />
+ </UserControl.Resources>
+
+ <Grid MinWidth="560">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <!-- Warning banner -->
+ <ui:InfoBar
+ Grid.Row="0"
+ Margin="0,0,0,12"
+ IsClosable="False"
+ IsOpen="True"
+ Message="{ext:Loc DiskCleanup.Dialog.Confirmation.Warning}"
+ Severity="Warning" />
+
+ <!-- Summary -->
+ <ui:TextBlock
+ Grid.Row="1"
+ Margin="0,0,0,8"
+ FontTypography="BodyStrong"
+ Text="{Binding SummaryText}"
+ TextWrapping="Wrap" />
+
+ <!-- Item list -->
+ <ScrollViewer
+ Grid.Row="2"
+ MaxHeight="380"
+ VerticalScrollBarVisibility="Auto">
+ <ItemsControl ItemsSource="{Binding Items}" Visibility="{Binding Items.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <VirtualizingStackPanel />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border Style="{StaticResource ListRowStyle}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Index -->
+ <Border
+ Grid.Column="0"
+ MinWidth="34"
+ Margin="0,0,12,0"
+ Padding="6,2"
+ VerticalAlignment="Top"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="{StaticResource CornerRadiusSmall}">
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding Index, StringFormat=#{0}}" />
+ </Border>
+
+ <!-- Info -->
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding Description}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorDisabledBrush}"
+ Text="{Binding Path}"
+ TextTrimming="CharacterEllipsis" />
+ </StackPanel>
+
+ <!-- Size badge -->
+ <Border
+ Grid.Column="2"
+ Margin="8,0,0,0"
+ Padding="8,4"
+ VerticalAlignment="Center"
+ Background="{Binding SizeBytes, Converter={StaticResource SizeToBrushConverter}}"
+ CornerRadius="{StaticResource CornerRadiusSmall}">
+ <StackPanel Orientation="Horizontal">
+ <ui:TextBlock
+ FontTypography="Caption"
+ FontWeight="SemiBold"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding FormattedSize}" />
+ <ui:TextBlock
+ Margin="6,0"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Opacity="0.7"
+ Text="•" />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{ext:Loc DiskCleanup.FilesCount, {Binding FileCount}}" />
+ </StackPanel>
+ </Border>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml.cs b/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml.cs
new file mode 100644
index 0000000..36ebb6b
--- /dev/null
+++ b/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml.cs
@@ -0,0 +1,11 @@
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Dialogs;
+
+public partial class DiskCleanupConfirmationDialog : UserControl
+{
+ public DiskCleanupConfirmationDialog()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
index 79f2780..8be5baa 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
@@ -4,9 +4,11 @@
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:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=dialogVm:OptimizationDetailsViewModel}"
d:DesignHeight="760"
d:DesignWidth="760"
mc:Ignorable="d">
diff --git a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
index be1358d..7143ca8 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
@@ -1,12 +1,14 @@
-<UserControl
+<UserControl
x:Class="optimizerDuck.UI.Dialogs.OptimizationResultDialog"
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:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=dialogVm:OptimizationResultDialogViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
diff --git a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
index f1a472d..f5a1de6 100644
--- a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
@@ -1,12 +1,14 @@
-<UserControl
+<UserControl
x:Class="optimizerDuck.UI.Dialogs.ProcessingDialog"
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:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=dialogVm:ProcessingViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml
new file mode 100644
index 0000000..14e564c
--- /dev/null
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml
@@ -0,0 +1,233 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Dialogs.ScheduledTaskDeleteDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:dialogs="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=dialogs:ScheduledTaskDeleteDialogViewModel}"
+ d:DesignHeight="400"
+ d:DesignWidth="600"
+ mc:Ignorable="d">
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
+ <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
+ </UserControl.Resources>
+ <Grid MinWidth="480">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <!-- Warning banner -->
+ <ui:InfoBar
+ Grid.Row="0"
+ Margin="0,0,0,12"
+ IsClosable="False"
+ IsOpen="True"
+ Message="{ext:Loc ScheduledTasks.Dialog.DeleteWarning}"
+ Severity="Warning" />
+
+ <!-- Task card -->
+ <Border
+ Grid.Row="1"
+ Margin="0,0,0,12"
+ Padding="16"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
+ BorderThickness="1"
+ CornerRadius="{StaticResource CornerRadiusMedium}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <Image
+ Grid.Column="0"
+ Width="40"
+ Height="40"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ Source="{Binding Task.LogoImage}"
+ Stretch="UniformToFill" />
+
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Task.Name}" />
+ <Border
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ CornerRadius="4">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Task.IsReady}" Value="True">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Task.IsRunning}" Value="True">
+ <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Task.IsDisabledState}" Value="True">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ x:Name="StateIcon"
+ Margin="0,0,4,0"
+ FontSize="10">
+ <ui:SymbolIcon.Style>
+ <Style TargetType="ui:SymbolIcon">
+ <Setter Property="Symbol" Value="Circle24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Task.IsReady}" Value="True">
+ <Setter Property="Symbol" Value="CheckmarkCircle24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Task.IsRunning}" Value="True">
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ <Setter Property="Symbol" Value="Play24" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Task.IsDisabledState}" Value="True">
+ <Setter Property="Symbol" Value="Dismiss24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:SymbolIcon.Style>
+ </ui:SymbolIcon>
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
+ Text="{Binding Task.State}" />
+ </StackPanel>
+ </Border>
+ </DockPanel>
+
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding Task.Description}"
+ TextWrapping="Wrap" />
+
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorDisabledBrush}"
+ Text="{Binding Task.FullPath}"
+ TextTrimming="CharacterEllipsis" />
+ </StackPanel>
+ </Grid>
+ </Border>
+
+ <!-- Details grid -->
+ <Border
+ Grid.Row="2"
+ Padding="16"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
+ BorderThickness="1"
+ CornerRadius="{StaticResource CornerRadiusMedium}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+
+ <!-- Author -->
+ <ui:SymbolIcon
+ Grid.Row="0"
+ Grid.Column="0"
+ Margin="0,0,8,0"
+ VerticalAlignment="Top"
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="Person24" />
+ <StackPanel
+ Grid.Row="0"
+ Grid.Column="1"
+ Margin="0,0,16,0">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Author}" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ FontTypography="Body"
+ Text="{Binding Task.Author}"
+ Visibility="{Binding Task.IsAuthorEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge Margin="0,2,0,0" Visibility="{Binding Task.IsAuthorEmpty, Converter={StaticResource BoolToVis}}" />
+ </StackPanel>
+
+ <!-- Triggers -->
+ <ui:SymbolIcon
+ Grid.Row="0"
+ Grid.Column="2"
+ Margin="0,0,8,0"
+ VerticalAlignment="Top"
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="Timer24" />
+ <StackPanel Grid.Row="0" Grid.Column="3">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ FontTypography="Body"
+ Text="{Binding Task.TriggerSummary}"
+ TextWrapping="Wrap"
+ Visibility="{Binding Task.IsTriggersEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge Margin="0,2,0,0" Visibility="{Binding Task.IsTriggersEmpty, Converter={StaticResource BoolToVis}}" />
+ </StackPanel>
+
+ <!-- Action -->
+ <ui:SymbolIcon
+ Grid.Row="1"
+ Grid.Column="0"
+ Margin="0,8,8,0"
+ VerticalAlignment="Top"
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="Play24" />
+ <StackPanel
+ Grid.Row="1"
+ Grid.Column="1"
+ Grid.ColumnSpan="4"
+ Margin="0,8,16,0">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Action}" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ FontFamily="Consolas"
+ FontTypography="Body"
+ Text="{Binding Task.ActionSummary}"
+ TextWrapping="Wrap"
+ Visibility="{Binding Task.IsActionEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge Margin="0,2,0,0" Visibility="{Binding Task.IsActionEmpty, Converter={StaticResource BoolToVis}}" />
+ </StackPanel>
+ </Grid>
+ </Border>
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml.cs
new file mode 100644
index 0000000..37cd38f
--- /dev/null
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml.cs
@@ -0,0 +1,11 @@
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Dialogs;
+
+public partial class ScheduledTaskDeleteDialog : UserControl
+{
+ public ScheduledTaskDeleteDialog()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
index 51a0936..1cb1e46 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
@@ -2,14 +2,22 @@
x:Class="optimizerDuck.UI.Dialogs.ScheduledTaskDetailsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
+ 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:models="clr-namespace:optimizerDuck.Domain.Optimizations.Models.ScheduledTask"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=models:ScheduledTaskModel}"
d:DesignHeight="700"
d:DesignWidth="760"
mc:Ignorable="d">
- <StackPanel >
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
+ <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
+ </UserControl.Resources>
+ <StackPanel>
<Border
Margin="0,0,0,12"
Padding="{StaticResource CardPadding}"
@@ -24,20 +32,19 @@
</Grid.ColumnDefinitions>
<Image
- x:Name="TaskLogoImage"
Grid.Column="0"
Width="40"
Height="40"
Margin="0,0,12,0"
VerticalAlignment="Center"
+ Source="{Binding LogoImage}"
Stretch="UniformToFill" />
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<DockPanel LastChildFill="False">
<ui:TextBlock
- x:Name="TaskNameText"
FontTypography="BodyStrong"
- Text=""
+ Text="{Binding Name}"
TextWrapping="Wrap" />
<Border
Margin="8,0,0,0"
@@ -64,31 +71,32 @@
FontSize="10"
Symbol="Circle24" />
<ui:TextBlock
- x:Name="StateText"
VerticalAlignment="Center"
FontTypography="Caption"
Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
- Text="" />
+ Text="{Binding State}" />
</StackPanel>
</Border>
</DockPanel>
<ui:TextBlock
- x:Name="DescriptionText"
Margin="0,4,0,0"
Appearance="Secondary"
FontTypography="Caption"
- Text=""
- TextWrapping="Wrap" />
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ Visibility="{Binding IsDescriptionEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsDescriptionEmpty, Converter={StaticResource BoolToVis}}" />
<ui:TextBlock
- x:Name="PathText"
Margin="0,2,0,0"
Appearance="Disabled"
FontTypography="Caption"
- Text=""
+ Text="{Binding FullPath}"
TextTrimming="CharacterEllipsis" />
- <ItemsControl x:Name="TriggerBadgesItems" Margin="0,6,0,0">
+ <ItemsControl ItemsSource="{Binding TriggerTypes}" Margin="0,6,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
@@ -145,10 +153,13 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Author}" />
<ui:TextBlock
- x:Name="AuthorText"
Margin="0,2,0,0"
FontTypography="Body"
- Text="" />
+ Text="{Binding Author}"
+ Visibility="{Binding IsAuthorEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsAuthorEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
<Separator Margin="14,0" />
@@ -170,11 +181,14 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
<ui:TextBlock
- x:Name="TriggersText"
Margin="0,2,0,0"
FontTypography="Body"
- Text=""
- TextWrapping="Wrap" />
+ Text="{Binding TriggerSummary}"
+ TextWrapping="Wrap"
+ Visibility="{Binding IsTriggersEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsTriggersEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
<Separator Margin="14,0" />
@@ -196,12 +210,15 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Action}" />
<ui:TextBlock
- x:Name="ActionText"
Margin="0,2,0,0"
FontFamily="Consolas"
FontTypography="Body"
- Text=""
- TextWrapping="Wrap" />
+ Text="{Binding ActionSummary}"
+ TextWrapping="Wrap"
+ Visibility="{Binding IsActionEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsActionEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
</StackPanel>
@@ -233,10 +250,13 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.LastRun}" />
<ui:TextBlock
- x:Name="LastRunText"
Margin="0,2,0,0"
FontTypography="Body"
- Text="" />
+ Text="{Binding LastRunTime, StringFormat=g}"
+ Visibility="{Binding IsLastRunEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsLastRunEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
<ui:SymbolIcon
Grid.Column="2"
@@ -251,10 +271,13 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.NextRun}" />
<ui:TextBlock
- x:Name="NextRunText"
Margin="0,2,0,0"
FontTypography="Body"
- Text="" />
+ Text="{Binding NextRunTime, StringFormat=g}"
+ Visibility="{Binding IsNextRunEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsNextRunEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
<Separator Margin="14,0" />
@@ -275,10 +298,13 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.LastResult}" />
<ui:TextBlock
- x:Name="LastResultText"
Margin="0,2,0,0"
FontTypography="Body"
- Text="" />
+ Text="{Binding LastRunResult}"
+ Visibility="{Binding IsLastResultEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsLastResultEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
</StackPanel>
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
index 1a3fe25..fbb59ee 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
@@ -1,11 +1,10 @@
-using System.Windows.Controls;
using System.Windows.Media;
using Wpf.Ui.Controls;
using ScheduledTaskModel = optimizerDuck.Domain.Optimizations.Models.ScheduledTask.ScheduledTaskModel;
namespace optimizerDuck.UI.Dialogs;
-public partial class ScheduledTaskDetailsDialog : UserControl
+public partial class ScheduledTaskDetailsDialog : System.Windows.Controls.UserControl
{
private ScheduledTaskModel? _taskModel;
@@ -23,22 +22,7 @@ public partial class ScheduledTaskDetailsDialog : UserControl
if (value == null)
return;
- TaskLogoImage.Source = value.LogoImage;
- TaskNameText.Text = value.Name;
- PathText.Text = value.FullPath;
- DescriptionText.Text = value.Description ?? "—";
- AuthorText.Text = value.Author ?? "—";
- StateText.Text = value.State;
- TriggersText.Text = string.IsNullOrWhiteSpace(value.TriggerSummary)
- ? "—"
- : value.TriggerSummary;
- ActionText.Text = string.IsNullOrWhiteSpace(value.ActionSummary)
- ? "—"
- : value.ActionSummary;
- LastRunText.Text = value.LastRunTime?.ToString("g") ?? "—";
- NextRunText.Text = value.NextRunTime?.ToString("g") ?? "—";
- LastResultText.Text = value.LastRunResult?.ToString() ?? "—";
- TriggerBadgesItems.ItemsSource = value.TriggerTypes;
+ DataContext = value;
var backgroundBrushKey = value.State switch
{
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
index 7d00db6..d3c5cfd 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
@@ -2,13 +2,21 @@
x:Class="optimizerDuck.UI.Dialogs.StartupTaskDetailsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
+ 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:models="clr-namespace:optimizerDuck.Domain.Optimizations.Models.StartupManager"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DataContext="{d:DesignInstance Type=models:StartupTask}"
d:DesignHeight="520"
d:DesignWidth="620"
mc:Ignorable="d">
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
+ <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
+ </UserControl.Resources>
<StackPanel MinWidth="540">
<Border
Margin="0,0,0,12"
@@ -24,23 +32,21 @@
</Grid.ColumnDefinitions>
<Image
- x:Name="LogoImageControl"
Grid.Column="0"
Width="40"
Height="40"
Margin="0,0,12,0"
VerticalAlignment="Center"
- Source="{x:Null}"
+ Source="{Binding LogoImage}"
Stretch="UniformToFill" />
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<DockPanel LastChildFill="False">
<ui:TextBlock
FontTypography="BodyStrong"
- Text="{Binding Text, ElementName=NameText}"
+ Text="{Binding TaskName}"
TextWrapping="Wrap" />
<Border
- x:Name="TaskKindBadge"
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
@@ -71,17 +77,21 @@
Margin="0,4,0,0"
Appearance="Secondary"
FontTypography="Caption"
- Text="{Binding Text, ElementName=DescriptionText}"
+ Text="{Binding Description}"
TextTrimming="CharacterEllipsis"
- TextWrapping="Wrap" />
+ TextWrapping="Wrap"
+ Visibility="{Binding IsDescriptionEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsDescriptionEmpty, Converter={StaticResource BoolToVis}}" />
<ui:TextBlock
Margin="0,2,0,0"
Appearance="Disabled"
FontTypography="Caption"
- Text="{Binding Text, ElementName=PathText}"
+ Text="{Binding TaskPath}"
TextTrimming="CharacterEllipsis" />
- <ItemsControl x:Name="TriggerBadgesItems" Margin="0,6,0,0">
+ <ItemsControl ItemsSource="{Binding TriggerTypes}" Margin="0,6,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
@@ -138,10 +148,9 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Name}" />
<ui:TextBlock
- x:Name="NameText"
Margin="0,2,0,0"
FontTypography="Body"
- Text=""
+ Text="{Binding TaskName}"
TextWrapping="Wrap" />
</StackPanel>
</Grid>
@@ -164,11 +173,14 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Description}" />
<ui:TextBlock
- x:Name="DescriptionText"
Margin="0,2,0,0"
FontTypography="Body"
- Text=""
- TextWrapping="Wrap" />
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ Visibility="{Binding IsDescriptionEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsDescriptionEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
<Separator Margin="14,0" />
@@ -190,11 +202,10 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Path}" />
<ui:TextBlock
- x:Name="PathText"
Margin="0,2,0,0"
FontFamily="Consolas"
FontTypography="Body"
- Text=""
+ Text="{Binding TaskPath}"
TextWrapping="Wrap" />
</StackPanel>
</Grid>
@@ -217,11 +228,14 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
<ui:TextBlock
- x:Name="TriggersText"
Margin="0,2,0,0"
FontTypography="Body"
- Text=""
- TextWrapping="Wrap" />
+ Text="{Binding TriggerSummary}"
+ TextWrapping="Wrap"
+ Visibility="{Binding IsTriggersEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsTriggersEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
<Separator Margin="14,0" />
@@ -243,12 +257,15 @@
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Action}" />
<ui:TextBlock
- x:Name="ActionText"
Margin="0,2,0,0"
FontFamily="Consolas"
FontTypography="Body"
- Text=""
- TextWrapping="Wrap" />
+ Text="{Binding ActionSummary}"
+ TextWrapping="Wrap"
+ Visibility="{Binding IsActionEmpty, Converter={StaticResource InverseBoolToVis}}" />
+ <controls:EmptyBadge
+ Margin="0,2,0,0"
+ Visibility="{Binding IsActionEmpty, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</Grid>
</StackPanel>
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
index e65ab11..0166711 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
@@ -1,23 +1,17 @@
-using System.Windows.Controls;
using System.Windows.Media;
using optimizerDuck.Resources.Languages;
+using Wpf.Ui.Controls;
using StartupTask = optimizerDuck.Domain.Optimizations.Models.StartupManager.StartupTask;
namespace optimizerDuck.UI.Dialogs;
-public partial class StartupTaskDetailsPanel : UserControl
+public partial class StartupTaskDetailsPanel : System.Windows.Controls.UserControl
{
public StartupTaskDetailsPanel(StartupTask task)
{
InitializeComponent();
- NameText.Text = task.TaskName;
- DescriptionText.Text = task.Description ?? "—";
- PathText.Text = task.TaskPath;
- TriggersText.Text = task.TriggerSummary ?? "—";
- ActionText.Text = task.ActionSummary ?? "—";
- LogoImageControl.Source = task.LogoImage;
- TriggerBadgesItems.ItemsSource = task.TriggerTypes;
+ DataContext = task;
TaskStateText.Text = task.IsEnabled
? Translations.Common_Toggle_On
diff --git a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
index 3c98e91..dc8f5c0 100644
--- a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
+++ b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
@@ -1,4 +1,4 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.DiskCleanupPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -103,6 +103,36 @@
Grid.Column="2"
VerticalAlignment="Center"
Orientation="Horizontal">
+ <!-- Select All / Deselect All -->
+ <ui:Button
+ Cursor="Hand"
+ Command="{Binding ViewModel.ToggleSelectAllCommand}">
+ <ui:Button.Style>
+ <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
+ <Setter Property="Appearance" Value="Success" />
+ <Setter Property="Content" Value="{ext:Loc DiskCleanup.Button.SelectAll}" />
+ <Setter Property="Icon">
+ <Setter.Value>
+ <ui:SymbolIcon FontSize="16" Symbol="Checkmark24" />
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ViewModel.IsAllSelected}" Value="True">
+ <Setter Property="Appearance" Value="Danger" />
+ <Setter Property="Content" Value="{ext:Loc DiskCleanup.Button.DeselectAll}" />
+ <Setter Property="Icon">
+ <Setter.Value>
+ <ui:SymbolIcon FontSize="16" Symbol="CheckboxUnchecked24" />
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:Button.Style>
+ </ui:Button>
+
+ <Separator Margin="4,0,4,0" />
+
<!-- Sort Dropdown -->
<ComboBox
Cursor="Hand"
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs
new file mode 100644
index 0000000..c24cc98
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs
@@ -0,0 +1,31 @@
+using optimizerDuck.Domain.Optimizations.Models.Cleanup;
+
+namespace optimizerDuck.UI.ViewModels.Dialogs;
+
+public sealed class DiskCleanupConfirmationDialogViewModel
+{
+ public DiskCleanupConfirmationDialogViewModel(
+ IEnumerable<CleanupItem> selectedItems,
+ string summaryText
+ )
+ {
+ SummaryText = summaryText;
+ Items = selectedItems
+ .Select((item, index) => new DiskCleanupConfirmationItemViewModel(index + 1, item))
+ .ToList();
+ }
+
+ public string SummaryText { get; }
+ public IReadOnlyList<DiskCleanupConfirmationItemViewModel> Items { get; }
+}
+
+public sealed class DiskCleanupConfirmationItemViewModel(int index, CleanupItem item)
+{
+ public int Index { get; } = index;
+ public string Name { get; } = item.Name;
+ public string Description { get; } = item.Description;
+ public string Path { get; } = item.Path;
+ public long SizeBytes { get; } = item.SizeBytes;
+ public string FormattedSize { get; } = CleanupItem.FormatBytes(item.SizeBytes);
+ public long FileCount { get; } = item.FileCount;
+}
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/ScheduledTaskDeleteDialogViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/ScheduledTaskDeleteDialogViewModel.cs
new file mode 100644
index 0000000..444d219
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Dialogs/ScheduledTaskDeleteDialogViewModel.cs
@@ -0,0 +1,8 @@
+using optimizerDuck.Domain.Optimizations.Models.ScheduledTask;
+
+namespace optimizerDuck.UI.ViewModels.Dialogs;
+
+public sealed class ScheduledTaskDeleteDialogViewModel(ScheduledTaskModel task)
+{
+ public ScheduledTaskModel Task { get; } = task;
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
index 6cd06c8..bf642b2 100644
--- a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
@@ -5,6 +5,8 @@ using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services.UI;
+using optimizerDuck.UI.Dialogs;
+using optimizerDuck.UI.ViewModels.Dialogs;
using Wpf.Ui;
using Wpf.Ui.Controls;
using CleanupItem = optimizerDuck.Domain.Optimizations.Models.Cleanup.CleanupItem;
@@ -14,6 +16,7 @@ namespace optimizerDuck.UI.ViewModels.Pages;
public partial class DiskCleanupViewModel(
DiskCleanupService diskCleanupService,
ISnackbarService snackbarService,
+ IContentDialogService contentDialogService,
ILogger<DiskCleanupViewModel> logger
) : ViewModel
{
@@ -48,6 +51,8 @@ public partial class DiskCleanupViewModel(
public long TotalFileCount => CleanupItems.Sum(i => i.FileCount);
public bool CanClean =>
SelectedCount > 0 && TotalSelectedSizeBytes > 0 && !IsCleaning && !IsScanning;
+ public bool IsAllSelected =>
+ CleanupItems.Count > 0 && CleanupItems.All(i => !i.IsScanned || i.SizeBytes == 0 || i.IsSelected);
partial void OnSelectedSortByIndexChanged(int value)
{
@@ -184,6 +189,30 @@ public partial class DiskCleanupViewModel(
if (!CanClean)
return;
+ var selectedItems = CleanupItems.Where(i => i.IsSelected && i.SizeBytes > 0).ToList();
+ if (selectedItems.Count == 0)
+ return;
+
+ var summaryText = string.Format(
+ Translations.DiskCleanup_Dialog_Confirmation_Summary,
+ TotalSelectedSizeFormatted,
+ SelectedCount,
+ TotalSelectedFileCount
+ );
+
+ var dialogViewModel = new DiskCleanupConfirmationDialogViewModel(selectedItems, summaryText);
+ var dialog = new ContentDialog
+ {
+ Title = string.Format(Translations.DiskCleanup_Dialog_Confirmation_Title, SelectedCount),
+ Content = new DiskCleanupConfirmationDialog { DataContext = dialogViewModel },
+ PrimaryButtonText = string.Format(Translations.DiskCleanup_Button_CleanSelected, TotalSelectedSizeFormatted),
+ CloseButtonText = Translations.Common_Cancel,
+ };
+
+ var result = await contentDialogService.ShowAsync(dialog, CancellationToken.None);
+ if (result != ContentDialogResult.Primary)
+ return;
+
IsCleaning = true;
try
{
@@ -248,6 +277,34 @@ public partial class DiskCleanupViewModel(
ApplySort();
}
+ [RelayCommand]
+ private void ToggleSelectAll()
+ {
+ if (IsAllSelected)
+ DeselectAll();
+ else
+ SelectAll();
+ }
+
+ [RelayCommand]
+ private void SelectAll()
+ {
+ foreach (var item in CleanupItems)
+ if (item.IsScanned && item.SizeBytes > 0)
+ item.IsSelected = true;
+
+ UpdateProperties();
+ }
+
+ [RelayCommand]
+ private void DeselectAll()
+ {
+ foreach (var item in CleanupItems)
+ item.IsSelected = false;
+
+ UpdateProperties();
+ }
+
[RelayCommand]
private void OpenFolder(CleanupItem item)
{
@@ -302,5 +359,6 @@ public partial class DiskCleanupViewModel(
OnPropertyChanged(nameof(TotalSizeFormatted));
OnPropertyChanged(nameof(TotalFileCount));
OnPropertyChanged(nameof(CanClean));
+ OnPropertyChanged(nameof(IsAllSelected));
}
}
diff --git a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
index cd5cc2d..10077e0 100644
--- a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
@@ -8,6 +8,7 @@ using optimizerDuck.Resources.Languages;
using optimizerDuck.Services.Optimization.Providers;
using optimizerDuck.Services.System;
using optimizerDuck.UI.Dialogs;
+using optimizerDuck.UI.ViewModels.Dialogs;
using Wpf.Ui;
using Wpf.Ui.Controls;
using ScheduledTaskModel = optimizerDuck.Domain.Optimizations.Models.ScheduledTask.ScheduledTaskModel;
@@ -278,10 +279,11 @@ public partial class ScheduledTasksViewModel : ViewModel
if (task == null)
return;
+ var dialogViewModel = new ScheduledTaskDeleteDialogViewModel(task);
var dialog = new ContentDialog
{
Title = Translations.ScheduledTasks_Dialog_DeleteTitle,
- Content = string.Format(Translations.ScheduledTasks_Dialog_DeleteMessage, task.Name),
+ Content = new ScheduledTaskDeleteDialog { DataContext = dialogViewModel },
PrimaryButtonText = Translations.Common_Delete,
CloseButtonText = Translations.Common_Cancel,
};