Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
feat: add new Scheduled Task page feature
itsfatducka4fe4f598fab
diff --git a/optimizerDuck/App.xaml.cs b/optimizerDuck/App.xaml.csindex 4b94ba8..c8d54da 100644--- a/optimizerDuck/App.xaml.cs+++ b/optimizerDuck/App.xaml.cs@@ -164,6 +164,9 @@ public partial class App : Applicationservices.AddSingleton<StartupManagerViewModel>();services.AddSingleton<StartupManagerPage>();+ services.AddSingleton<ScheduledTasksViewModel>();+ services.AddSingleton<ScheduledTasksPage>();+// Optimizationsservices.AddAllOptimizationPages();@@ -177,6 +180,7 @@ public partial class App : Applicationservices.AddSingleton<BloatwareService>();services.AddSingleton<DiskCleanupService>();services.AddSingleton<StartupManagerService>();+ services.AddSingleton<ScheduledTaskService>();services.AddSingleton<SystemInfoService>();services.AddSingleton<StreamService>();services.AddSingleton<UpdaterService>();diff --git a/optimizerDuck/Core/Models/ScheduledTask/ScheduledTaskModel.cs b/optimizerDuck/Core/Models/ScheduledTask/ScheduledTaskModel.csnew file mode 100644index 0000000..e409417--- /dev/null+++ b/optimizerDuck/Core/Models/ScheduledTask/ScheduledTaskModel.cs@@ -0,0 +1,45 @@+using System.Collections.ObjectModel;+using System.Windows.Media;+using CommunityToolkit.Mvvm.ComponentModel;++namespace optimizerDuck.Core.Models.ScheduledTask;++public partial class ScheduledTaskModel : ObservableObject+{+ [ObservableProperty] private bool _isEnabled;+ [ObservableProperty] private string _state = string.Empty;+ [ObservableProperty] private ImageSource? _logoImage;++ public required string Name { get; init; }+ public required string Path { get; init; }+ public required string FullPath { get; init; }+ public string? Description { get; init; }+ public string? Author { get; init; }++ public string TriggerSummary { get; init; } = string.Empty;+ public string ActionSummary { get; init; } = string.Empty;++ /// <summary>Individual trigger type strings for badge display (e.g. "At log on", "At startup", "Daily at 09:00").</summary>+ public ObservableCollection<string> TriggerTypes { get; init; } = [];++ public DateTime? LastRunTime { get; init; }+ public DateTime? NextRunTime { get; init; }+ public int? LastRunResult { get; init; }++ public bool IsMicrosoftTask => Path.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);+ public bool HasLogonTrigger { get; init; }+ public bool HasBootTrigger { get; init; }++ // Computed state helpers for UI binding+ public bool IsRunning => State.Equals("Running", StringComparison.OrdinalIgnoreCase);+ public bool IsReady => State.Equals("Ready", StringComparison.OrdinalIgnoreCase);+ public bool IsDisabledState => State.Equals("Disabled", StringComparison.OrdinalIgnoreCase);++ /// <summary>Notifies UI that computed state properties have changed.</summary>+ public void NotifyStateChanged()+ {+ OnPropertyChanged(nameof(IsRunning));+ OnPropertyChanged(nameof(IsReady));+ OnPropertyChanged(nameof(IsDisabledState));+ }+}diff --git a/optimizerDuck/Core/Models/StartupManager/StartupTask.cs b/optimizerDuck/Core/Models/StartupManager/StartupTask.csindex 392a048..1968d4e 100644--- a/optimizerDuck/Core/Models/StartupManager/StartupTask.cs+++ b/optimizerDuck/Core/Models/StartupManager/StartupTask.cs@@ -1,3 +1,4 @@+using System.Windows.Media;using CommunityToolkit.Mvvm.ComponentModel;namespace optimizerDuck.Core.Models.StartupManager;@@ -5,8 +6,12 @@ namespace optimizerDuck.Core.Models.StartupManager;public partial class StartupTask : ObservableObject{[ObservableProperty] private bool _isEnabled;+ [ObservableProperty] private ImageSource? _logoImage;public required string TaskName { get; init; }public required string TaskPath { get; init; }public string? Description { get; init; }+ public string? TriggerSummary { get; init; }+ public string? ActionSummary { get; init; }+ public bool IsMicrosoftTask => TaskPath.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);}\ No newline at end of filediff --git a/optimizerDuck/Core/Optimizers/SecurityAndPrivacy.cs b/optimizerDuck/Core/Optimizers/SecurityAndPrivacy.csindex e5efc23..e0968c9 100644--- a/optimizerDuck/Core/Optimizers/SecurityAndPrivacy.cs+++ b/optimizerDuck/Core/Optimizers/SecurityAndPrivacy.cs@@ -145,63 +145,20 @@ public class SecurityAndPrivacy : IOptimizationCategoryforeach (var task in tasksToDelete){- var psQuery = $@"- $path = Split-Path '{task}' -Parent- if ($path -ne '\') {{ $path += '\' }}- $name = Split-Path '{task}' -Leaf-- try {{- $taskObj = Get-ScheduledTask -TaskPath $path -TaskName $name -ErrorAction Stop- $taskObj.Settings.Enabled- }}- catch {{- $null- }}- ";-- var queryResult = ShellService.PowerShell(psQuery);-- if (queryResult.ExitCode != 0 || string.IsNullOrWhiteSpace(queryResult.Stdout))- {- context.Logger.LogDebug("Task {Task} not found, skipping", task);- continue;- }-- if (!bool.TryParse(queryResult.Stdout.Trim(), out var wasEnabled))- {- context.Logger.LogDebug("Task {Task} not found or cannot read state", task);- continue;- }-- if (!wasEnabled)+ try{- context.Logger.LogDebug("Task {Task} already disabled", task);- continue;- }-- var disableCommand = $@"- $path = Split-Path '{task}' -Parent- if ($path -ne '\') {{ $path += '\' }}- $name = Split-Path '{task}' -Leaf- Disable-ScheduledTask -TaskPath $path -TaskName $name- ";-- var revertCommand = $@"- $path = Split-Path '{task}' -Parent- if ($path -ne '\') {{ $path += '\' }}- $name = Split-Path '{task}' -Leaf- Enable-ScheduledTask -TaskPath $path -TaskName $name- ";+ if (!ScheduledTaskService.IsTaskEnabled(task))+ {+ context.Logger.LogDebug("Task {Task} not found or already disabled", task);+ continue;+ }- var result = ShellService.PowerShell(disableCommand, revertCommand);-- if (result.ExitCode != 0)- {- context.Logger.LogWarning("Failed to disable task {Task}", task);+ ScheduledTaskService.DisableTask(task);+ context.Logger.LogInformation("Disabled task {Task}", task);}- else+ catch (Exception ex){- context.Logger.LogInformation("Disabled task {Task}", task);+ context.Logger.LogWarning(ex, "Failed to disable task {Task}", task);}}diff --git a/optimizerDuck/Resources/Languages/Translations.Designer.cs b/optimizerDuck/Resources/Languages/Translations.Designer.csindex 3e21541..5de1900 100644--- a/optimizerDuck/Resources/Languages/Translations.Designer.cs+++ b/optimizerDuck/Resources/Languages/Translations.Designer.cs@@ -3277,5 +3277,143 @@ namespace optimizerDuck.Resources.Languages {return ResourceManager.GetString("StartupManager.Tasks.Title", resourceCulture);}}++ /// <summary>+ /// Looks up a localized string similar to Hide Microsoft tasks.+ /// </summary>+ public static string StartupManager_Tasks_HideMicrosoft {+ get {+ return ResourceManager.GetString("StartupManager.Tasks.HideMicrosoft", resourceCulture);+ }+ }++ /// <summary>+ /// Looks up a localized string similar to Delete Scheduled Task.+ /// </summary>+ public static string ScheduledTasks_Dialog_DeleteTitle {+ get {+ return ResourceManager.GetString("ScheduledTasks.Dialog.DeleteTitle", resourceCulture);+ }+ }++ /// <summary>+ /// Looks up a localized string similar to Are you sure you want to delete the task "{0}"? This action cannot be undone..+ /// </summary>+ public static string ScheduledTasks_Dialog_DeleteMessage {+ get {+ return ResourceManager.GetString("ScheduledTasks.Dialog.DeleteMessage", resourceCulture);+ }+ }++ /// <summary>+ /// Looks up a localized string similar to Create New Task.+ /// </summary>+ public static string ScheduledTasks_Dialog_CreateTitle {+ get {+ return ResourceManager.GetString("ScheduledTasks.Dialog.CreateTitle", resourceCulture);+ }+ }++ /// <summary>+ /// Looks up a localized string similar to Delete.+ /// </summary>+ public static string Common_Delete {+ get {+ return ResourceManager.GetString("Common.Delete", resourceCulture);+ }+ }++ /// <summary>+ /// Looks up a localized string similar to Cancel.+ /// </summary>+ public static string Common_Cancel {+ get {+ return ResourceManager.GetString("Common.Cancel", resourceCulture);+ }+ }++ public static string ScheduledTasks_Menu_OpenSettings {+ get {+ return ResourceManager.GetString("ScheduledTasks.Menu.OpenSettings", resourceCulture);+ }+ }++ public static string ScheduledTasks_Details_Name {+ get {+ return ResourceManager.GetString("ScheduledTasks.Details.Name", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Enabled_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Enabled_Title", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Disabled_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Disabled_Title", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Toggle_Message {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Toggle_Message", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Run_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Run_Title", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Run_Message {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Run_Message", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Stop_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Stop_Title", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Stop_Message {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Stop_Message", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Delete_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Delete_Title", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Delete_Message {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Delete_Message", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Create_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Create_Title", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Create_Message {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Create_Message", resourceCulture);+ }+ }++ public static string ScheduledTasks_Snackbar_Error_Title {+ get {+ return ResourceManager.GetString("ScheduledTasks_Snackbar_Error_Title", resourceCulture);+ }+ }}}diff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resxindex fe0d9e7..5910891 100644--- a/optimizerDuck/Resources/Languages/Translations.resx+++ b/optimizerDuck/Resources/Languages/Translations.resx@@ -1198,4 +1198,168 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value><data name="Settings.About.LearnMore.Website" xml:space="preserve"><value>Official Website</value></data>++ <!-- Scheduled Tasks (Startup Manager) -->+ <data name="StartupManager.Tasks.HideMicrosoft" xml:space="preserve">+ <value>Hide Microsoft tasks</value>+ </data>++ <!-- Sidebar -->+ <data name="Sidebar.ScheduledTasks" xml:space="preserve">+ <value>Scheduled Tasks</value>+ </data>++ <!-- Scheduled Tasks Page -->+ <data name="ScheduledTasks.Header.Title" xml:space="preserve">+ <value>Scheduled Tasks</value>+ </data>+ <data name="ScheduledTasks.Header.Description" xml:space="preserve">+ <value>View, manage, and create Windows scheduled tasks.</value>+ </data>+ <data name="ScheduledTasks.Loading" xml:space="preserve">+ <value>Loading scheduled tasks...</value>+ </data>+ <data name="ScheduledTasks.HideMicrosoft" xml:space="preserve">+ <value>Hide Microsoft tasks</value>+ </data>+ <data name="ScheduledTasks.Menu.CreateTask" xml:space="preserve">+ <value>Create Task</value>+ </data>++ <!-- Scheduled Tasks Actions -->+ <data name="ScheduledTasks.Action.Details" xml:space="preserve">+ <value>View Details</value>+ </data>+ <data name="ScheduledTasks.Action.Run" xml:space="preserve">+ <value>Run</value>+ </data>+ <data name="ScheduledTasks.Action.Stop" xml:space="preserve">+ <value>Stop</value>+ </data>+ <data name="ScheduledTasks.Action.Delete" xml:space="preserve">+ <value>Delete</value>+ </data>++ <!-- Scheduled Tasks Dialogs -->+ <data name="ScheduledTasks.Dialog.DeleteTitle" xml:space="preserve">+ <value>Delete Scheduled Task</value>+ </data>+ <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.CreateTitle" xml:space="preserve">+ <value>Create New Task</value>+ </data>+ <data name="ScheduledTasks.Dialog.TaskName" xml:space="preserve">+ <value>Task Name</value>+ </data>+ <data name="ScheduledTasks.Dialog.TaskNameHint" xml:space="preserve">+ <value>Enter task name</value>+ </data>+ <data name="ScheduledTasks.Dialog.Description" xml:space="preserve">+ <value>Description</value>+ </data>+ <data name="ScheduledTasks.Dialog.DescriptionHint" xml:space="preserve">+ <value>Optional description</value>+ </data>+ <data name="ScheduledTasks.Dialog.FolderPath" xml:space="preserve">+ <value>Folder Path</value>+ </data>+ <data name="ScheduledTasks.Dialog.Executable" xml:space="preserve">+ <value>Executable</value>+ </data>+ <data name="ScheduledTasks.Dialog.Trigger" xml:space="preserve">+ <value>Trigger</value>+ </data>+ <data name="ScheduledTasks.Dialog.TriggerLogon" xml:space="preserve">+ <value>On Logon</value>+ </data>+ <data name="ScheduledTasks.Dialog.TriggerBoot" xml:space="preserve">+ <value>On Boot</value>+ </data>+ <data name="ScheduledTasks.Dialog.Enabled" xml:space="preserve">+ <value>Enable this task</value>+ </data>++ <!-- Scheduled Tasks Details -->+ <data name="ScheduledTasks.Details.Path" xml:space="preserve">+ <value>Path</value>+ </data>+ <data name="ScheduledTasks.Details.Description" xml:space="preserve">+ <value>Description</value>+ </data>+ <data name="ScheduledTasks.Details.Author" xml:space="preserve">+ <value>Author</value>+ </data>+ <data name="ScheduledTasks.Details.State" xml:space="preserve">+ <value>State</value>+ </data>+ <data name="ScheduledTasks.Details.Triggers" xml:space="preserve">+ <value>Triggers</value>+ </data>+ <data name="ScheduledTasks.Details.Action" xml:space="preserve">+ <value>Action</value>+ </data>+ <data name="ScheduledTasks.Details.LastRun" xml:space="preserve">+ <value>Last Run</value>+ </data>+ <data name="ScheduledTasks.Details.NextRun" xml:space="preserve">+ <value>Next Run</value>+ </data>+ <data name="ScheduledTasks.Details.LastResult" xml:space="preserve">+ <value>Last Result</value>+ </data>++ <!-- Common -->+ <data name="Common.Delete" xml:space="preserve">+ <value>Delete</value>+ </data>+ <data name="Common.Cancel" xml:space="preserve">+ <value>Cancel</value>+ </data>+ <data name="Common.SortBy.State" xml:space="preserve">+ <value>State</value>+ </data>+ <data name="ScheduledTasks.Menu.OpenSettings" xml:space="preserve">+ <value>Open Task Scheduler</value>+ </data>+ <data name="ScheduledTasks.Details.Name" xml:space="preserve">+ <value>Name</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Enabled_Title" xml:space="preserve">+ <value>Task Enabled</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Disabled_Title" xml:space="preserve">+ <value>Task Disabled</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Toggle_Message" xml:space="preserve">+ <value>{0} has been updated successfully.</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Run_Title" xml:space="preserve">+ <value>Task Started</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Run_Message" xml:space="preserve">+ <value>{0} is now running.</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Stop_Title" xml:space="preserve">+ <value>Task Stopped</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Stop_Message" xml:space="preserve">+ <value>{0} has been stopped.</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Delete_Title" xml:space="preserve">+ <value>Task Deleted</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Delete_Message" xml:space="preserve">+ <value>{0} has been deleted.</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Create_Title" xml:space="preserve">+ <value>Task Created</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Create_Message" xml:space="preserve">+ <value>{0} has been created successfully.</value>+ </data>+ <data name="ScheduledTasks_Snackbar_Error_Title" xml:space="preserve">+ <value>Error</value>+ </data></root>\ No newline at end of filediff --git a/optimizerDuck/Services/OptimizationServices/ScheduledTaskService.cs b/optimizerDuck/Services/OptimizationServices/ScheduledTaskService.csnew file mode 100644index 0000000..9fd3dfa--- /dev/null+++ b/optimizerDuck/Services/OptimizationServices/ScheduledTaskService.cs@@ -0,0 +1,306 @@+using Microsoft.Extensions.Logging;+using Microsoft.Win32.TaskScheduler;+using optimizerDuck.Core.Models.ScheduledTask;++namespace optimizerDuck.Services.OptimizationServices;++public class ScheduledTaskService(ILogger<ScheduledTaskService> logger)+{+ #region Static utility methods (for optimizer use)++ /// <summary>+ /// Checks whether a task at the given full path exists and is enabled.+ /// Static overload for use from optimizers.+ /// </summary>+ public static bool IsTaskEnabled(string fullPath)+ {+ try+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath);+ return task is { Enabled: true };+ }+ catch+ {+ return false;+ }+ }++ /// <summary>+ /// Disables a task by full path. Static overload for use from optimizers.+ /// </summary>+ public static void DisableTask(string fullPath)+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException($"Task not found: {fullPath}");+ task.Enabled = false;+ }++ /// <summary>+ /// Enables a task by full path. Static overload for use from optimizers.+ /// </summary>+ public static void EnableTask(string fullPath)+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException($"Task not found: {fullPath}");+ task.Enabled = true;+ }++ #endregion++ #region Instance methods (for DI use)++ /// <summary>+ /// Recursively retrieves all scheduled tasks from the system.+ /// </summary>+ public List<ScheduledTaskModel> GetAllTasks()+ {+ var results = new List<ScheduledTaskModel>();+ try+ {+ using var ts = new TaskService();+ CollectTasks(ts.RootFolder, results);++ // Extract icons from task commands+ Parallel.ForEach(results, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, task =>+ {+ if (!string.IsNullOrWhiteSpace(task.ActionSummary))+ task.LogoImage = StartupManagerService.ExtractIcon(task.ActionSummary);+ });+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to enumerate scheduled tasks");+ }++ return results;+ }++ /// <summary>+ /// Returns only tasks that have a LogonTrigger or BootTrigger (startup-related).+ /// </summary>+ public List<ScheduledTaskModel> GetStartupTasks()+ {+ return GetAllTasks()+ .Where(t => t.HasLogonTrigger || t.HasBootTrigger)+ .OrderBy(t => t.Name)+ .ToList();+ }++ public void EnableTaskLogged(string fullPath)+ {+ try+ {+ EnableTask(fullPath);+ logger.LogInformation("Enabled task {Path}", fullPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to enable task {Path}", fullPath);+ throw;+ }+ }++ public void DisableTaskLogged(string fullPath)+ {+ try+ {+ DisableTask(fullPath);+ logger.LogInformation("Disabled task {Path}", fullPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to disable task {Path}", fullPath);+ throw;+ }+ }++ public void RunTask(string fullPath)+ {+ try+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException($"Task not found: {fullPath}");+ task.Run();+ logger.LogInformation("Started task {Path}", fullPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to run task {Path}", fullPath);+ throw;+ }+ }++ public void StopTask(string fullPath)+ {+ try+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException($"Task not found: {fullPath}");+ task.Stop();+ logger.LogInformation("Stopped task {Path}", fullPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to stop task {Path}", fullPath);+ throw;+ }+ }++ /// <summary>+ /// Gets the current state string of a task by its full path.+ /// </summary>+ public string? GetTaskState(string fullPath)+ {+ try+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath);+ return task?.State.ToString();+ }+ catch (Exception ex)+ {+ logger.LogDebug(ex, "Failed to get state for task {Path}", fullPath);+ return null;+ }+ }++ public void DeleteTask(string fullPath)+ {+ try+ {+ using var ts = new TaskService();+ var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException($"Task not found: {fullPath}");+ var folderPath = task.Folder.Path;+ ts.GetFolder(folderPath).DeleteTask(task.Name);+ logger.LogInformation("Deleted task {Path}", fullPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to delete task {Path}", fullPath);+ throw;+ }+ }++ /// <summary>+ /// Registers a new scheduled task from a model definition.+ /// </summary>+ public void RegisterTask(string folderPath, ScheduledTaskModel model)+ {+ try+ {+ using var ts = new TaskService();+ var td = ts.NewTask();+ td.RegistrationInfo.Description = model.Description ?? string.Empty;+ td.RegistrationInfo.Author = model.Author ?? string.Empty;+ td.Settings.Enabled = model.IsEnabled;++ // Parse action from ActionSummary ("exe args" format)+ if (!string.IsNullOrWhiteSpace(model.ActionSummary))+ {+ var parts = model.ActionSummary.Trim();+ var spaceIdx = parts.IndexOf(' ');+ if (spaceIdx > 0)+ td.Actions.Add(new ExecAction(parts[..spaceIdx], parts[(spaceIdx + 1)..]));+ else+ td.Actions.Add(new ExecAction(parts));+ }++ // Add triggers based on model flags+ if (model.HasLogonTrigger)+ td.Triggers.Add(new LogonTrigger());+ if (model.HasBootTrigger)+ td.Triggers.Add(new BootTrigger());++ // Ensure folder exists+ var folder = ts.RootFolder;+ if (!string.IsNullOrWhiteSpace(folderPath) && folderPath != "\\")+ {+ try+ {+ folder = ts.GetFolder(folderPath);+ }+ catch+ {+ folder = ts.RootFolder.CreateFolder(folderPath);+ }+ }++ folder.RegisterTaskDefinition(model.Name, td);+ logger.LogInformation("Registered task {Name} in folder {Folder}", model.Name, folderPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to register task {Name} in {Folder}", model.Name, folderPath);+ throw;+ }+ }++ #endregion++ #region Private helpers++ private void CollectTasks(TaskFolder folder, List<ScheduledTaskModel> results)+ {+ try+ {+ foreach (var task in folder.Tasks)+ try+ {+ results.Add(MapTaskToModel(task));+ }+ catch (Exception ex)+ {+ logger.LogDebug(ex, "Failed to map task {Name}", task.Name);+ }++ foreach (var subFolder in folder.SubFolders)+ CollectTasks(subFolder, results);+ }+ catch (Exception ex)+ {+ logger.LogDebug(ex, "Failed to enumerate folder {Path}", folder.Path);+ }+ }++ private static ScheduledTaskModel MapTaskToModel(Microsoft.Win32.TaskScheduler.Task task)+ {+ var def = task.Definition;+ var triggers = def.Triggers;+ var actions = def.Actions;++ var triggerDescriptions = triggers+ .Select(t => t.ToString() ?? t.TriggerType.ToString())+ .ToList();++ var actionSummary = string.Empty;+ if (actions.Count > 0 && actions[0] is ExecAction exec)+ actionSummary = string.IsNullOrWhiteSpace(exec.Arguments)+ ? exec.Path ?? string.Empty+ : $"{exec.Path} {exec.Arguments}";++ var hasLogon = triggers.Any(t => t.TriggerType == TaskTriggerType.Logon);+ var hasBoot = triggers.Any(t => t.TriggerType == TaskTriggerType.Boot);++ return new ScheduledTaskModel+ {+ Name = task.Name,+ Path = task.Folder.Path,+ FullPath = task.Path,+ Description = def.RegistrationInfo.Description,+ Author = def.RegistrationInfo.Author,+ IsEnabled = task.Enabled,+ State = task.State.ToString(),+ TriggerSummary = string.Join("; ", triggerDescriptions),+ TriggerTypes = new(triggerDescriptions),+ ActionSummary = actionSummary,+ LastRunTime = task.LastRunTime == DateTime.MinValue ? null : task.LastRunTime,+ NextRunTime = task.NextRunTime == DateTime.MinValue ? null : task.NextRunTime,+ LastRunResult = task.LastTaskResult,+ HasLogonTrigger = hasLogon,+ HasBootTrigger = hasBoot+ };+ }++ #endregion+}diff --git a/optimizerDuck/Services/StartupManagerService.cs b/optimizerDuck/Services/StartupManagerService.csindex 510c644..9cb8009 100644--- a/optimizerDuck/Services/StartupManagerService.cs+++ b/optimizerDuck/Services/StartupManagerService.cs@@ -1,7 +1,6 @@using System.Diagnostics;using System.Drawing;using System.IO;-using System.Text.Json;using System.Windows;using System.Windows.Interop;using System.Windows.Media;@@ -13,7 +12,7 @@ using optimizerDuck.Services.OptimizationServices;namespace optimizerDuck.Services;-public class StartupManagerService(ILogger<StartupManagerService> logger)+public class StartupManagerService(ILogger<StartupManagerService> logger, ScheduledTaskService scheduledTaskService){public async Task<List<StartupApp>> GetStartupAppsAsync(){@@ -222,89 +221,60 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)approvedKey.SetValue(app.OriginalValueNameOrFileName, data, RegistryValueKind.Binary);}- public async Task<List<StartupTask>> GetStartupTasksAsync()+ public Task<List<StartupTask>> GetStartupTasksAsync(){- var tasks = new List<StartupTask>();- try+ return Task.Run(() =>{- var result = await ShellService.PowerShellAsync(@"- Get-ScheduledTask |- Where-Object { $_.Triggers.CimClass.CimClassName -match 'LogonTrigger' -and $_.TaskPath -notlike '\Microsoft\*' } |- Select-Object TaskName, TaskPath, State, Description, @{Name=""Enabled"";Expression={$_.Settings.Enabled}} |- ConvertTo-Json -Depth 3- ");-- if (result.ExitCode == 0 && !string.IsNullOrWhiteSpace(result.Stdout))- try+ try+ {+ var models = scheduledTaskService.GetStartupTasks();+ var tasks = models.Select(m => new StartupTask{- using var doc = JsonDocument.Parse(result.Stdout);- switch (doc.RootElement.ValueKind)- {- case JsonValueKind.Array:- {- foreach (var el in doc.RootElement.EnumerateArray())- ParseTaskElement(el, tasks);- break;- }- case JsonValueKind.Object:- ParseTaskElement(doc.RootElement, tasks);- break;- }- }- catch (Exception parserEx)+ TaskName = m.Name,+ TaskPath = m.Path,+ Description = m.Description,+ TriggerSummary = m.TriggerSummary,+ ActionSummary = m.ActionSummary,+ IsEnabled = m.IsEnabled+ }).OrderBy(t => t.TaskName).ToList();++ // Extract icons from task commands+ Parallel.ForEach(tasks, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, task =>{- logger.LogError(parserEx, "Failed to parse json: {Json}", result.Stdout);- }- }- catch (Exception ex)- {- logger.LogError(ex, "Failed to get scheduled tasks");- }-- return tasks.OrderBy(t => t.TaskName).ToList();- }-- private static void ParseTaskElement(JsonElement el, List<StartupTask> tasks)- {- var name = el.TryGetProperty("TaskName", out var nProp) ? nProp.GetString() ?? "" : "";- var path = el.TryGetProperty("TaskPath", out var pProp) ? pProp.GetString() ?? "" : "";- var enabled = el.TryGetProperty("Enabled", out var eProp) && eProp.GetBoolean();- var desc = el.TryGetProperty("Description", out var dProp) ? dProp.GetString() : "";-- if (string.IsNullOrWhiteSpace(name)) return;+ if (!string.IsNullOrWhiteSpace(task.ActionSummary))+ task.LogoImage = ExtractIcon(task.ActionSummary);+ });- tasks.Add(new StartupTask- {- TaskName = name,- TaskPath = path,- Description = desc,- IsEnabled = enabled+ return tasks;+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to get scheduled tasks");+ return [];+ }});}- public async Task ToggleStartupTask(StartupTask task, bool enable)+ public Task ToggleStartupTask(StartupTask task, bool enable){- try+ return Task.Run(() =>{- var command = enable ? "Enable-ScheduledTask" : "Disable-ScheduledTask";- var script = $"""- {command} -TaskPath "{task.TaskPath}" -TaskName "{task.TaskName}"- """;-- var result = await ShellService.PowerShellAsync(script);- if (result.ExitCode != 0)- logger.LogWarning("Toggle tasks returned exit code {ExitCode}. Stderr: {Stderr}", result.ExitCode,- result.Stderr);-- logger.LogInformation("Toggled scheduled task {Name} to {Enable}", task.TaskName, enable);- }- catch (Exception ex)- {- logger.LogError(ex, "Failed to toggle task {Name}", task.TaskName);- }+ try+ {+ var fullPath = task.TaskPath.TrimEnd('\\') + "\\" + task.TaskName;+ if (enable)+ scheduledTaskService.EnableTaskLogged(fullPath);+ else+ scheduledTaskService.DisableTaskLogged(fullPath);+ }+ catch (Exception ex)+ {+ logger.LogError(ex, "Failed to toggle task {Name}", task.TaskName);+ }+ });}- private static BitmapSource? ExtractIcon(string command)+ public static BitmapSource? ExtractIcon(string command){try{@@ -346,7 +316,7 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)return null;}- private static string? GetFullPathFromEnvironment(string fileName)+ public static string? GetFullPathFromEnvironment(string fileName){if (File.Exists(fileName))return Path.GetFullPath(fileName);diff --git a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.csnew file mode 100644index 0000000..4546207--- /dev/null+++ b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs@@ -0,0 +1,364 @@+using System.Collections.ObjectModel;+using System.ComponentModel;+using System.Diagnostics;+using CommunityToolkit.Mvvm.ComponentModel;+using CommunityToolkit.Mvvm.Input;+using Microsoft.Extensions.Logging;+using optimizerDuck.Core.Models.ScheduledTask;+using optimizerDuck.Resources.Languages;+using optimizerDuck.Services.OptimizationServices;+using optimizerDuck.UI.Views.Dialogs;+using Wpf.Ui;+using Wpf.Ui.Controls;++namespace optimizerDuck.UI.ViewModels.Pages;++public partial class ScheduledTasksViewModel : ViewModel+{+ private readonly List<ScheduledTaskModel> _allTasks = [];+ private readonly ILogger<ScheduledTasksViewModel> _logger;+ private readonly ScheduledTaskService _scheduledTaskService;+ private readonly IContentDialogService _contentDialogService;+ private readonly ISnackbarService _snackbarService;+ private bool _isInitialized;++ [ObservableProperty] [NotifyPropertyChangedFor(nameof(IsNotLoading))]+ private bool _isLoading;++ [ObservableProperty] private string _searchText = string.Empty;+ [ObservableProperty] private int _sortByIndex;+ [ObservableProperty] private bool _hideMicrosoftTasks = true;++ public ScheduledTasksViewModel(+ ScheduledTaskService scheduledTaskService,+ IContentDialogService contentDialogService,+ ISnackbarService snackbarService,+ ILogger<ScheduledTasksViewModel> logger)+ {+ _scheduledTaskService = scheduledTaskService;+ _contentDialogService = contentDialogService;+ _snackbarService = snackbarService;+ _logger = logger;+ }++ public ObservableCollection<ScheduledTaskModel> Tasks { get; } = [];++ public bool IsNotLoading => !IsLoading;+ public bool HasData => _allTasks.Count > 0;++ public override async Task OnNavigatedToAsync()+ {+ if (_isInitialized)+ return;++ _isInitialized = true;+ await LoadDataAsync();+ }++ [RelayCommand]+ private async Task Refresh()+ {+ await LoadDataAsync();+ }++ [RelayCommand]+ private void OpenTaskScheduler()+ {+ try+ {+ Process.Start(new ProcessStartInfo("taskschd.msc") { UseShellExecute = true });+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to open Task Scheduler");+ }+ }++ [RelayCommand]+ private async Task ToggleTask(ScheduledTaskModel? task)+ {+ if (task == null) return;+ try+ {+ await Task.Run(() =>+ {+ if (task.IsEnabled)+ _scheduledTaskService.EnableTaskLogged(task.FullPath);+ else+ _scheduledTaskService.DisableTaskLogged(task.FullPath);+ });++ _snackbarService.Show(+ task.IsEnabled ? Translations.ScheduledTasks_Snackbar_Enabled_Title : Translations.ScheduledTasks_Snackbar_Disabled_Title,+ string.Format(Translations.ScheduledTasks_Snackbar_Toggle_Message, task.Name),+ ControlAppearance.Success,+ new SymbolIcon { Symbol = SymbolRegular.CheckmarkCircle24, Filled = true },+ TimeSpan.FromSeconds(3));++ await RefreshTaskState(task);+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to toggle task {Name}", task.Name);+ task.IsEnabled = !task.IsEnabled; // revert UI++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Error_Title,+ ex.Message,+ ControlAppearance.Danger,+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },+ TimeSpan.FromSeconds(5));+ }+ }++ [RelayCommand]+ private async Task RunTask(ScheduledTaskModel? task)+ {+ if (task == null) return;+ try+ {+ await Task.Run(() => _scheduledTaskService.RunTask(task.FullPath));++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Run_Title,+ string.Format(Translations.ScheduledTasks_Snackbar_Run_Message, task.Name),+ ControlAppearance.Success,+ new SymbolIcon { Symbol = SymbolRegular.Play24, Filled = true },+ TimeSpan.FromSeconds(3));++ await RefreshTaskState(task);+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to run task {Name}", task.Name);++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Error_Title,+ ex.Message,+ ControlAppearance.Danger,+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },+ TimeSpan.FromSeconds(5));+ }+ }++ [RelayCommand]+ private async Task StopTask(ScheduledTaskModel? task)+ {+ if (task == null) return;+ try+ {+ await Task.Run(() => _scheduledTaskService.StopTask(task.FullPath));++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Stop_Title,+ string.Format(Translations.ScheduledTasks_Snackbar_Stop_Message, task.Name),+ ControlAppearance.Success,+ new SymbolIcon { Symbol = SymbolRegular.Stop24, Filled = true },+ TimeSpan.FromSeconds(3));++ await RefreshTaskState(task);+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to stop task {Name}", task.Name);++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Error_Title,+ ex.Message,+ ControlAppearance.Danger,+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },+ TimeSpan.FromSeconds(5));+ }+ }++ [RelayCommand]+ private async Task DeleteTask(ScheduledTaskModel? task)+ {+ if (task == null) return;++ var dialog = new ContentDialog+ {+ Title = Translations.ScheduledTasks_Dialog_DeleteTitle,+ Content = string.Format(Translations.ScheduledTasks_Dialog_DeleteMessage, task.Name),+ PrimaryButtonText = Translations.Common_Delete,+ CloseButtonText = Translations.Common_Cancel+ };++ var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);+ if (result != ContentDialogResult.Primary) return;++ try+ {+ await Task.Run(() => _scheduledTaskService.DeleteTask(task.FullPath));+ _allTasks.RemoveAll(t => t.FullPath == task.FullPath);+ ApplyFilter();++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Delete_Title,+ string.Format(Translations.ScheduledTasks_Snackbar_Delete_Message, task.Name),+ ControlAppearance.Success,+ new SymbolIcon { Symbol = SymbolRegular.Delete24, Filled = true },+ TimeSpan.FromSeconds(3));+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to delete task {Name}", task.Name);++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Error_Title,+ ex.Message,+ ControlAppearance.Danger,+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },+ TimeSpan.FromSeconds(5));+ }+ }++ [RelayCommand]+ private async Task CreateTask()+ {+ var dialogContent = new ScheduledTaskCreateDialog();+ var dialog = new ContentDialog+ {+ Title = Translations.ScheduledTasks_Dialog_CreateTitle,+ Content = dialogContent,+ PrimaryButtonText = Translations.Button_Ok,+ CloseButtonText = Translations.Button_Cancel+ };++ var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);+ if (result != ContentDialogResult.Primary || dialogContent.CreatedModel == null) return;++ try+ {+ var model = dialogContent.CreatedModel;+ var folderPath = string.IsNullOrWhiteSpace(model.Path) ? "\\" : model.Path;+ await Task.Run(() => _scheduledTaskService.RegisterTask(folderPath, model));+ await LoadDataAsync();++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Create_Title,+ string.Format(Translations.ScheduledTasks_Snackbar_Create_Message, model.Name),+ ControlAppearance.Success,+ new SymbolIcon { Symbol = SymbolRegular.Add24, Filled = true },+ TimeSpan.FromSeconds(3));+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to create task");++ _snackbarService.Show(+ Translations.ScheduledTasks_Snackbar_Error_Title,+ ex.Message,+ ControlAppearance.Danger,+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },+ TimeSpan.FromSeconds(5));+ }+ }++ [RelayCommand]+ private async Task ViewDetails(ScheduledTaskModel? task)+ {+ if (task == null) return;++ var dialogContent = new ScheduledTaskDetailsDialog { TaskModel = task };+ var dialog = new ContentDialog+ {+ Title = task.Name,+ Content = dialogContent,+ CloseButtonText = Translations.Button_Ok+ };++ await _contentDialogService.ShowAsync(dialog, CancellationToken.None);+ }++ // Filter triggers+ partial void OnSearchTextChanged(string value) => ApplyFilter();+ partial void OnSortByIndexChanged(int value) => ApplyFilter();+ partial void OnHideMicrosoftTasksChanged(bool value) => ApplyFilter();++ /// <summary>+ /// Refreshes the state of a single task in-place by re-querying the task scheduler.+ /// </summary>+ private async Task RefreshTaskState(ScheduledTaskModel task)+ {+ try+ {+ var newState = await Task.Run(() => _scheduledTaskService.GetTaskState(task.FullPath));+ if (newState != null)+ {+ task.State = newState;+ task.NotifyStateChanged();+ }+ }+ catch (Exception ex)+ {+ _logger.LogDebug(ex, "Failed to refresh state for {Name}", task.Name);+ }+ }++ private async Task LoadDataAsync()+ {+ IsLoading = true;+ _allTasks.Clear();+ Tasks.Clear();++ try+ {+ var tasks = await Task.Run(() => _scheduledTaskService.GetAllTasks());+ _allTasks.AddRange(tasks);+ ApplyFilter();+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to load scheduled tasks");+ }+ finally+ {+ IsLoading = false;+ }+ }++ private void ApplyFilter()+ {+ // Unsubscribe+ foreach (var task in Tasks) task.PropertyChanged -= Task_PropertyChanged;+ Tasks.Clear();++ var search = SearchText.Trim();+ var hasSearch = !string.IsNullOrWhiteSpace(search);++ var sorted = SortByIndex switch+ {+ 0 => _allTasks.OrderBy(t => t.Name),+ 1 => _allTasks.OrderBy(t => !t.IsEnabled).ThenBy(t => t.Name),+ 2 => _allTasks.OrderBy(t => t.Path).ThenBy(t => t.Name),+ 3 => _allTasks.OrderBy(t => t.State).ThenBy(t => t.Name),+ _ => _allTasks.OrderBy(t => t.Name)+ };++ foreach (var task in sorted)+ {+ if (HideMicrosoftTasks && task.IsMicrosoftTask)+ continue;++ if (hasSearch &&+ !task.Name.Contains(search, StringComparison.OrdinalIgnoreCase) &&+ !(task.Description?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false) &&+ !task.FullPath.Contains(search, StringComparison.OrdinalIgnoreCase) &&+ !task.ActionSummary.Contains(search, StringComparison.OrdinalIgnoreCase))+ continue;++ task.PropertyChanged -= Task_PropertyChanged;+ task.PropertyChanged += Task_PropertyChanged;+ Tasks.Add(task);+ }++ OnPropertyChanged(nameof(HasData));+ }++ private async void Task_PropertyChanged(object? sender, PropertyChangedEventArgs e)+ {+ if (e.PropertyName == nameof(ScheduledTaskModel.IsEnabled) && sender is ScheduledTaskModel task)+ await ToggleTask(task);+ }+}diff --git a/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.csindex 2102010..a16bdcc 100644--- a/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs+++ b/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs@@ -5,7 +5,11 @@ using CommunityToolkit.Mvvm.ComponentModel;using CommunityToolkit.Mvvm.Input;using Microsoft.Extensions.Logging;using optimizerDuck.Core.Models.StartupManager;+using optimizerDuck.Resources.Languages;using optimizerDuck.Services;+using optimizerDuck.UI.Views.Dialogs;+using Wpf.Ui;+using Wpf.Ui.Controls;namespace optimizerDuck.UI.ViewModels.Pages;@@ -15,17 +19,28 @@ public partial class StartupManagerViewModel : ViewModelprivate readonly List<StartupTask> _allTasks = [];private readonly ILogger<StartupManagerViewModel> _logger;private readonly StartupManagerService _startupManagerService;+ private readonly IContentDialogService _contentDialogService;private bool _isInitialized;[ObservableProperty] [NotifyPropertyChangedFor(nameof(IsNotLoading))]private bool _isLoading;- [ObservableProperty] private string _searchText = string.Empty;- [ObservableProperty] private int _selectedSortByIndex;+ // Per-section: Apps+ [ObservableProperty] private string _appSearchText = string.Empty;+ [ObservableProperty] private int _appSortByIndex;- public StartupManagerViewModel(StartupManagerService startupManagerService, ILogger<StartupManagerViewModel> logger)+ // Per-section: Tasks+ [ObservableProperty] private string _taskSearchText = string.Empty;+ [ObservableProperty] private int _taskSortByIndex;+ [ObservableProperty] private bool _hideMicrosoftTasks = true;++ public StartupManagerViewModel(+ StartupManagerService startupManagerService,+ IContentDialogService contentDialogService,+ ILogger<StartupManagerViewModel> logger){_startupManagerService = startupManagerService;+ _contentDialogService = contentDialogService;_logger = logger;}@@ -34,8 +49,8 @@ public partial class StartupManagerViewModel : ViewModelpublic bool IsNotLoading => !IsLoading;- public bool HasApps => Apps.Count > 0;- public bool HasTasks => Tasks.Count > 0;+ public bool HasApps => _allApps.Count > 0;+ public bool HasTasks => _allTasks.Count > 0;public bool HasData => HasApps || HasTasks;public override async Task OnNavigatedToAsync()@@ -66,6 +81,19 @@ public partial class StartupManagerViewModel : ViewModel}}+ [RelayCommand]+ private void OpenTaskScheduler()+ {+ try+ {+ Process.Start(new ProcessStartInfo("taskschd.msc") { UseShellExecute = true });+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "Failed to open Task Scheduler");+ }+ }+[RelayCommand]private void OpenLocation(StartupApp? app){@@ -80,16 +108,30 @@ public partial class StartupManagerViewModel : ViewModel}}- partial void OnSearchTextChanged(string value)+ [RelayCommand]+ private async Task ViewTaskDetails(StartupTask? task){- ApplyFilter();- }+ if (task == null) return;- partial void OnSelectedSortByIndexChanged(int value)- {- ApplyFilter();+ var dialog = new ContentDialog+ {+ Title = task.TaskName,+ Content = new StartupTaskDetailsPanel(task),+ CloseButtonText = Translations.Button_Ok+ };++ await _contentDialogService.ShowAsync(dialog, CancellationToken.None);}+ // Apps filter triggers+ partial void OnAppSearchTextChanged(string value) => ApplyAppFilter();+ partial void OnAppSortByIndexChanged(int value) => ApplyAppFilter();++ // Tasks filter triggers+ partial void OnTaskSearchTextChanged(string value) => ApplyTaskFilter();+ partial void OnTaskSortByIndexChanged(int value) => ApplyTaskFilter();+ partial void OnHideMicrosoftTasksChanged(bool value) => ApplyTaskFilter();+private async Task LoadDataAsync(){IsLoading = true;@@ -108,7 +150,8 @@ public partial class StartupManagerViewModel : ViewModel_allApps.AddRange(appsTask.Result);_allTasks.AddRange(tasksTask.Result);- ApplyFilter();+ ApplyAppFilter();+ ApplyTaskFilter();}catch (Exception ex){@@ -120,19 +163,15 @@ public partial class StartupManagerViewModel : ViewModel}}- private void ApplyFilter()+ private void ApplyAppFilter(){- // Unsubscribe existing itemsforeach (var app in Apps) app.PropertyChanged -= App_PropertyChanged;- foreach (var task in Tasks) task.PropertyChanged -= Task_PropertyChanged;-Apps.Clear();- Tasks.Clear();- var search = SearchText.Trim();+ var search = AppSearchText.Trim();var hasSearch = !string.IsNullOrWhiteSpace(search);- var sortedApps = SelectedSortByIndex switch+ var sortedApps = AppSortByIndex switch{0 => _allApps.OrderBy(a => a.Name),1 => _allApps.OrderBy(a => !a.IsEnabled).ThenBy(a => a.Name),@@ -153,7 +192,19 @@ public partial class StartupManagerViewModel : ViewModelApps.Add(app);}- var sortedTasks = SelectedSortByIndex switch+ OnPropertyChanged(nameof(HasApps));+ OnPropertyChanged(nameof(HasData));+ }++ private void ApplyTaskFilter()+ {+ foreach (var task in Tasks) task.PropertyChanged -= Task_PropertyChanged;+ Tasks.Clear();++ var search = TaskSearchText.Trim();+ var hasSearch = !string.IsNullOrWhiteSpace(search);++ var sortedTasks = TaskSortByIndex switch{0 => _allTasks.OrderBy(t => t.TaskName),1 => _allTasks.OrderBy(t => !t.IsEnabled).ThenBy(t => t.TaskName),@@ -163,6 +214,9 @@ public partial class StartupManagerViewModel : ViewModelforeach (var task in sortedTasks){+ if (HideMicrosoftTasks && task.IsMicrosoftTask)+ continue;+if (hasSearch &&!task.TaskName.Contains(search, StringComparison.OrdinalIgnoreCase) &&!(task.Description?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false) &&@@ -174,7 +228,6 @@ public partial class StartupManagerViewModel : ViewModelTasks.Add(task);}- OnPropertyChanged(nameof(HasApps));OnPropertyChanged(nameof(HasTasks));OnPropertyChanged(nameof(HasData));}diff --git a/optimizerDuck/UI/Views/Dialogs/ScheduledTaskCreateDialog.xaml b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskCreateDialog.xamlnew file mode 100644index 0000000..43c9e9f--- /dev/null+++ b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskCreateDialog.xaml@@ -0,0 +1,36 @@+<UserControl+ d:DesignHeight="400"+ d:DesignWidth="500"+ mc:Ignorable="d"+ x:Class="optimizerDuck.UI.Views.Dialogs.ScheduledTaskCreateDialog"+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"+ 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:ui="http://schemas.lepo.co/wpfui/2022/xaml"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">++ <StackPanel MinWidth="400">+ <ui:TextBlock FontTypography="BodyStrong" Margin="0,0,0,12" Text="{ext:Loc ScheduledTasks.Dialog.CreateTitle}" />++ <ui:TextBlock FontTypography="Caption" Margin="0,0,0,4" Text="{ext:Loc ScheduledTasks.Dialog.TaskName}" />+ <ui:TextBox Margin="0,0,0,12" x:Name="TaskNameBox" PlaceholderText="{ext:Loc ScheduledTasks.Dialog.TaskNameHint}" />++ <ui:TextBlock FontTypography="Caption" Margin="0,0,0,4" Text="{ext:Loc ScheduledTasks.Dialog.Description}" />+ <ui:TextBox Margin="0,0,0,12" x:Name="DescriptionBox" PlaceholderText="{ext:Loc ScheduledTasks.Dialog.DescriptionHint}" AcceptsReturn="True" MinHeight="60" />++ <ui:TextBlock FontTypography="Caption" Margin="0,0,0,4" Text="{ext:Loc ScheduledTasks.Dialog.FolderPath}" />+ <ui:TextBox Margin="0,0,0,12" x:Name="FolderPathBox" PlaceholderText="\" />++ <ui:TextBlock FontTypography="Caption" Margin="0,0,0,4" Text="{ext:Loc ScheduledTasks.Dialog.Executable}" />+ <ui:TextBox Margin="0,0,0,12" x:Name="ExecutableBox" PlaceholderText="C:\path\to\program.exe arguments" />++ <ui:TextBlock FontTypography="Caption" Margin="0,0,0,4" Text="{ext:Loc ScheduledTasks.Dialog.Trigger}" />+ <StackPanel Margin="0,0,0,12" Orientation="Horizontal">+ <CheckBox Content="{ext:Loc ScheduledTasks.Dialog.TriggerLogon}" Margin="0,0,16,0" x:Name="LogonTriggerCheck" IsChecked="True" />+ <CheckBox Content="{ext:Loc ScheduledTasks.Dialog.TriggerBoot}" x:Name="BootTriggerCheck" />+ </StackPanel>++ <CheckBox Content="{ext:Loc ScheduledTasks.Dialog.Enabled}" x:Name="EnabledCheck" IsChecked="True" />+ </StackPanel>+</UserControl>diff --git a/optimizerDuck/UI/Views/Dialogs/ScheduledTaskCreateDialog.xaml.cs b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskCreateDialog.xaml.csnew file mode 100644index 0000000..25f4dcc--- /dev/null+++ b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskCreateDialog.xaml.cs@@ -0,0 +1,33 @@+using System.Windows.Controls;+using optimizerDuck.Core.Models.ScheduledTask;++namespace optimizerDuck.UI.Views.Dialogs;++public partial class ScheduledTaskCreateDialog : UserControl+{+ public ScheduledTaskCreateDialog()+ {+ InitializeComponent();+ }++ public ScheduledTaskModel? CreatedModel+ {+ get+ {+ var name = TaskNameBox.Text?.Trim();+ if (string.IsNullOrWhiteSpace(name)) return null;++ return new ScheduledTaskModel+ {+ Name = name,+ Path = FolderPathBox.Text?.Trim() ?? "\\",+ FullPath = (FolderPathBox.Text?.Trim()?.TrimEnd('\\') ?? "\\") + "\\" + name,+ Description = DescriptionBox.Text?.Trim(),+ ActionSummary = ExecutableBox.Text?.Trim() ?? string.Empty,+ IsEnabled = EnabledCheck.IsChecked == true,+ HasLogonTrigger = LogonTriggerCheck.IsChecked == true,+ HasBootTrigger = BootTriggerCheck.IsChecked == true+ };+ }+ }+}diff --git a/optimizerDuck/UI/Views/Dialogs/ScheduledTaskDetailsDialog.xaml b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskDetailsDialog.xamlnew file mode 100644index 0000000..8f16089--- /dev/null+++ b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskDetailsDialog.xaml@@ -0,0 +1,264 @@+<UserControl+ d:DesignHeight="400"+ d:DesignWidth="500"+ mc:Ignorable="d"+ x:Class="optimizerDuck.UI.Views.Dialogs.ScheduledTaskDetailsDialog"+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"+ 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:ui="http://schemas.lepo.co/wpfui/2022/xaml"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">++ <StackPanel MinWidth="450" x:Name="RootPanel">+ <!-- General Info Card -->+ <Border+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"+ CornerRadius="8"+ Margin="0,0,0,8"+ Padding="0">+ <StackPanel>+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Folder24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Path}" />+ <ui:TextBlock+ FontFamily="Consolas"+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="PathText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="TextDescription24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Description}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="DescriptionText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Person24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Author}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ x:Name="AuthorText" />+ </StackPanel>+ </Grid>+ </StackPanel>+ </Border>++ <!-- State & Triggers Card -->+ <Border+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"+ CornerRadius="8"+ Margin="0,0,0,8"+ Padding="0">+ <StackPanel>+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Flash24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.State}" />+ <Border+ CornerRadius="4"+ HorizontalAlignment="Left"+ Margin="0,4,0,0"+ Padding="8,2"+ x:Name="StateBorder">+ <ui:TextBlock+ FontTypography="Caption"+ Foreground="{DynamicResource TextFillColorInverseBrush}"+ Text=""+ x:Name="StateText" />+ </Border>+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Timer24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Triggers}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="TriggersText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Play24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Action}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="ActionText" />+ </StackPanel>+ </Grid>+ </StackPanel>+ </Border>++ <!-- Run History Card -->+ <Border+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"+ CornerRadius="8"+ Padding="0">+ <StackPanel>+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="History24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1" Margin="0,0,16,0">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.LastRun}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ x:Name="LastRunText" />+ </StackPanel>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Grid.Column="2"+ Margin="0,0,10,0"+ Symbol="CalendarArrowRight24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="3">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.NextRun}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ x:Name="NextRunText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="CheckmarkCircle24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.LastResult}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ x:Name="LastResultText" />+ </StackPanel>+ </Grid>+ </StackPanel>+ </Border>+ </StackPanel>+</UserControl>diff --git a/optimizerDuck/UI/Views/Dialogs/ScheduledTaskDetailsDialog.xaml.cs b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskDetailsDialog.xaml.csnew file mode 100644index 0000000..00b26fe--- /dev/null+++ b/optimizerDuck/UI/Views/Dialogs/ScheduledTaskDetailsDialog.xaml.cs@@ -0,0 +1,47 @@+using System.Windows.Controls;+using System.Windows.Media;+using optimizerDuck.Core.Models.ScheduledTask;++namespace optimizerDuck.UI.Views.Dialogs;++public partial class ScheduledTaskDetailsDialog : UserControl+{+ private ScheduledTaskModel? _taskModel;++ public ScheduledTaskDetailsDialog()+ {+ InitializeComponent();+ }++ public ScheduledTaskModel? TaskModel+ {+ get => _taskModel;+ set+ {+ _taskModel = value;+ if (value == null) return;++ 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() ?? "—";++ // Set state badge color+ var brushKey = value.State switch+ {+ "Ready" => "SystemFillColorSuccessBrush",+ "Running" => "AccentButtonBackground",+ "Disabled" => "SystemFillColorCautionBrush",+ _ => "CardBackgroundFillColorSecondaryBrush"+ };++ if (TryFindResource(brushKey) is Brush brush)+ StateBorder.Background = brush;+ }+ }+}diff --git a/optimizerDuck/UI/Views/Dialogs/StartupTaskDetailsPanel.xaml b/optimizerDuck/UI/Views/Dialogs/StartupTaskDetailsPanel.xamlnew file mode 100644index 0000000..6aebdcf--- /dev/null+++ b/optimizerDuck/UI/Views/Dialogs/StartupTaskDetailsPanel.xaml@@ -0,0 +1,156 @@+<UserControl+ d:DesignHeight="200"+ d:DesignWidth="400"+ mc:Ignorable="d"+ x:Class="optimizerDuck.UI.Views.Dialogs.StartupTaskDetailsPanel"+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"+ 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:ui="http://schemas.lepo.co/wpfui/2022/xaml"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">++ <Border+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"+ CornerRadius="8"+ MinWidth="400"+ Padding="0">+ <StackPanel>+ <!-- Name -->+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="AppGeneric24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Name}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="NameText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />++ <!-- Description -->+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="TextDescription24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Description}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="DescriptionText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />++ <!-- Path -->+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Folder24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Path}" />+ <ui:TextBlock+ FontFamily="Consolas"+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="PathText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />++ <!-- Triggers -->+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Timer24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Triggers}" />+ <ui:TextBlock+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="TriggersText" />+ </StackPanel>+ </Grid>+ <Separator Margin="14,0" />++ <!-- Action -->+ <Grid Margin="14,12">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>+ <ui:SymbolIcon+ FontSize="14"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,10,0"+ Symbol="Play24"+ VerticalAlignment="Top" />+ <StackPanel Grid.Column="1">+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Text="{ext:Loc ScheduledTasks.Details.Actions}" />+ <ui:TextBlock+ FontFamily="Consolas"+ FontTypography="Body"+ Margin="0,2,0,0"+ Text=""+ TextWrapping="Wrap"+ x:Name="ActionText" />+ </StackPanel>+ </Grid>+ </StackPanel>+ </Border>+</UserControl>diff --git a/optimizerDuck/UI/Views/Dialogs/StartupTaskDetailsPanel.xaml.cs b/optimizerDuck/UI/Views/Dialogs/StartupTaskDetailsPanel.xaml.csnew file mode 100644index 0000000..8e8f10c--- /dev/null+++ b/optimizerDuck/UI/Views/Dialogs/StartupTaskDetailsPanel.xaml.cs@@ -0,0 +1,18 @@+using System.Windows.Controls;+using optimizerDuck.Core.Models.StartupManager;++namespace optimizerDuck.UI.Views.Dialogs;++public partial class StartupTaskDetailsPanel : 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 ?? "—";+ }+}diff --git a/optimizerDuck/UI/Views/Pages/ScheduledTasksPage.xaml b/optimizerDuck/UI/Views/Pages/ScheduledTasksPage.xamlnew file mode 100644index 0000000..ff095d6--- /dev/null+++ b/optimizerDuck/UI/Views/Pages/ScheduledTasksPage.xaml@@ -0,0 +1,415 @@+<Page+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"+ Margin="0,32,0,0"+ ScrollViewer.CanContentScroll="False"+ Title="ScheduledTasksPage"+ d:DataContext="{d:DesignInstance local:ScheduledTasksPage}"+ d:DesignHeight="1200"+ d:DesignWidth="800"+ mc:Ignorable="d"+ ui:Design.Background="Black"+ ui:Design.Foreground="White"+ x:Class="optimizerDuck.UI.Views.Pages.ScheduledTasksPage"+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"+ xmlns:local="clr-namespace:optimizerDuck.UI.Views.Pages"+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"+ xmlns:models="clr-namespace:optimizerDuck.Core.Models.ScheduledTask"+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">++ <Page.Resources>+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />+ <BooleanToVisibilityConverter x:Key="WpfBoolToVis" />+ <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />+ <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />+ </Page.Resources>++ <Grid RowDefinitions="Auto, *">+ <!-- Header -->+ <StackPanel Margin="0,0,0,20">+ <Grid>+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto" />+ </Grid.ColumnDefinitions>+ <StackPanel Grid.Column="0">+ <ui:TextBlock FontTypography="Title" Text="{ext:Loc ScheduledTasks.Header.Title}" />+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Body"+ Margin="0,4,0,0"+ Text="{ext:Loc ScheduledTasks.Header.Description}"+ TextWrapping="Wrap" />+ </StackPanel>+ <WrapPanel+ Grid.Column="1"+ Orientation="Horizontal"+ VerticalAlignment="Center">+ <ui:Button+ Appearance="Primary"+ Command="{Binding ViewModel.CreateTaskCommand}"+ Content="{ext:Loc ScheduledTasks.Menu.CreateTask}"+ Icon="{ui:SymbolIcon Add24,+ FontSize=18}"+ Margin="0,0,8,0" />+ <ui:Button+ Appearance="Secondary"+ Command="{Binding ViewModel.OpenTaskSchedulerCommand}"+ Content="{ext:Loc ScheduledTasks.Menu.OpenSettings}"+ Icon="{ui:SymbolIcon Settings24,+ FontSize=18}"+ Margin="0,0,8,0" />+ <ui:Button+ Appearance="Secondary"+ Command="{Binding ViewModel.RefreshCommand}"+ Content="{ext:Loc StartupManager.Menu.Refresh}"+ Icon="{ui:SymbolIcon ArrowClockwise24,+ FontSize=18}" />+ </WrapPanel>+ </Grid>+ </StackPanel>++ <!-- Loading Indicator -->+ <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">+ <ui:ProgressRing+ Height="48"+ HorizontalAlignment="Center"+ IsIndeterminate="True"+ Margin="0,0,0,16"+ VerticalAlignment="Center"+ Width="48" />+ <ui:TextBlock+ FontTypography="BodyStrong"+ HorizontalAlignment="Center"+ Text="{ext:Loc ScheduledTasks.Loading}" />+ </StackPanel>+ </Border>++ <!-- Main Content -->+ <Grid+ Grid.Row="1"+ RowDefinitions="Auto,*"+ Visibility="{Binding ViewModel.IsNotLoading, Converter={StaticResource BooleanToVisibilityConverter}}">+ <!-- Toolbar -->+ <WrapPanel+ Grid.Row="0"+ Margin="0,0,16,12"+ Orientation="Horizontal">+ <!-- Search -->+ <ui:TextBox+ Icon="{ui:SymbolIcon Search24}"+ Margin="0,0,8,0"+ MinWidth="250"+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"+ Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}"+ VerticalAlignment="Center" />++ <!-- Sort By -->+ <ComboBox+ Margin="0,0,8,0"+ SelectedIndex="{Binding ViewModel.SortByIndex}"+ ToolTip="{ext:Loc Common.SortBy}"+ VerticalAlignment="Center">+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="TextSortAscending24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Name}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="ToggleRight24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Status}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="Folder24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Path}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="Flash24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.State}" />+ </Grid>+ </ComboBoxItem>+ </ComboBox>++ <!-- Hide Microsoft -->+ <ui:ToggleSwitch+ Cursor="Hand"+ IsChecked="{Binding ViewModel.HideMicrosoftTasks, Mode=TwoWay}"+ Margin="0,0,8,0"+ OffContent="{ext:Loc ScheduledTasks.HideMicrosoft}"+ OnContent="{ext:Loc ScheduledTasks.HideMicrosoft}"+ VerticalAlignment="Center" />++ </WrapPanel>++ <!-- No search results -->+ <StackPanel+ Grid.Row="1"+ HorizontalAlignment="Center"+ Margin="0,64,0,32"+ VerticalAlignment="Top"+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource ZeroToVisibilityConverter}}">+ <ui:SymbolIcon+ FontSize="36"+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"+ HorizontalAlignment="Center"+ Margin="0,0,0,10"+ Symbol="SearchInfo24" />+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Body"+ HorizontalAlignment="Center"+ Text="{ext:Loc Bloatware.Search.NoResults}" />+ </StackPanel>++ <!-- Task List -->+ <ScrollViewer Grid.Row="1" Margin="0,0,16,0">+ <ItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">+ <ItemsControl.ItemTemplate>+ <DataTemplate DataType="{x:Type models:ScheduledTaskModel}">+ <Border+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"+ CornerRadius="6"+ Margin="0,0,0,6"+ Padding="16,12">+ <Grid>+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto" />+ </Grid.ColumnDefinitions>++ <!-- Task Logo -->+ <Image+ Grid.Column="0"+ Height="36"+ Margin="0,0,12,0"+ Source="{Binding LogoImage}"+ Stretch="UniformToFill"+ VerticalAlignment="Center"+ Width="36" />++ <!-- Task info -->+ <StackPanel+ Grid.Column="1"+ Margin="0,0,12,0"+ VerticalAlignment="Center">++ <!-- Row 1: Name + State badge -->+ <DockPanel LastChildFill="False">+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />+ <Border+ CornerRadius="4"+ Margin="8,0,0,0"+ Padding="6,1"+ VerticalAlignment="Center">+ <Border.Style>+ <Style TargetType="Border">+ <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />+ <Style.Triggers>+ <DataTrigger Binding="{Binding IsReady}" Value="True">+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />+ </DataTrigger>+ <DataTrigger Binding="{Binding IsRunning}" Value="True">+ <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />+ </DataTrigger>+ <DataTrigger Binding="{Binding IsDisabledState}" Value="True">+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />+ </DataTrigger>+ </Style.Triggers>+ </Style>+ </Border.Style>+ <StackPanel Orientation="Horizontal">+ <ui:SymbolIcon+ FontSize="10"+ Margin="0,0,4,0"+ x:Name="StateIcon">+ <ui:SymbolIcon.Style>+ <Style TargetType="ui:SymbolIcon">+ <Setter Property="Symbol" Value="Circle24" />+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />+ <Style.Triggers>+ <DataTrigger Binding="{Binding IsReady}" Value="True">+ <Setter Property="Symbol" Value="CheckmarkCircle24" />+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />+ </DataTrigger>+ <DataTrigger Binding="{Binding IsRunning}" Value="True">+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />+ <Setter Property="Symbol" Value="Play24" />+ </DataTrigger>+ <DataTrigger Binding="{Binding 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 State}"+ VerticalAlignment="Center" />+ </StackPanel>+ </Border>+ </DockPanel>++ <!-- Row 2: Description -->+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Margin="0,4,0,0"+ Text="{Binding Description}"+ TextWrapping="Wrap" />++ <!-- Row 3: Path -->+ <ui:TextBlock+ Appearance="Disabled"+ FontTypography="Caption"+ Margin="0,2,0,0"+ Text="{Binding FullPath}" />++ <!-- Row 4: Trigger badges -->+ <ItemsControl ItemsSource="{Binding TriggerTypes}" Margin="0,4,0,0">+ <ItemsControl.ItemsPanel>+ <ItemsPanelTemplate>+ <WrapPanel Orientation="Horizontal" />+ </ItemsPanelTemplate>+ </ItemsControl.ItemsPanel>+ <ItemsControl.ItemTemplate>+ <DataTemplate>+ <Border+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"+ CornerRadius="4"+ Margin="0,0,4,2"+ Padding="6,2">+ <StackPanel Orientation="Horizontal">+ <ui:SymbolIcon+ FontSize="10"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Margin="0,0,4,0"+ Symbol="Timer24" />+ <TextBlock+ FontSize="11"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Text="{Binding}"+ VerticalAlignment="Center" />+ </StackPanel>+ </Border>+ </DataTemplate>+ </ItemsControl.ItemTemplate>+ </ItemsControl>++ <!-- Row 5: Action summary -->+ <ui:TextBlock+ Appearance="Disabled"+ FontTypography="Caption"+ Margin="0,2,0,0"+ Text="{Binding ActionSummary}"+ TextTrimming="CharacterEllipsis" />+ </StackPanel>++ <!-- Actions -->+ <StackPanel+ Grid.Column="2"+ Orientation="Horizontal"+ VerticalAlignment="Center">+ <ui:Button+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.ViewDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Icon="{ui:SymbolIcon Info24,+ FontSize=16}"+ Margin="0,0,4,0"+ Padding="8"+ ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />+ <!-- Run: visible only when not running -->+ <ui:Button+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.RunTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Icon="{ui:SymbolIcon Play24,+ FontSize=16}"+ Margin="0,0,4,0"+ Padding="8"+ ToolTip="{ext:Loc ScheduledTasks.Action.Run}">+ <ui:Button.Style>+ <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">+ <Setter Property="Visibility" Value="Visible" />+ <Style.Triggers>+ <DataTrigger Binding="{Binding IsRunning}" Value="True">+ <Setter Property="Visibility" Value="Collapsed" />+ </DataTrigger>+ </Style.Triggers>+ </Style>+ </ui:Button.Style>+ </ui:Button>+ <!-- Stop: visible only when running -->+ <ui:Button+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.StopTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Icon="{ui:SymbolIcon Stop24,+ FontSize=16}"+ Margin="0,0,4,0"+ Padding="8"+ ToolTip="{ext:Loc ScheduledTasks.Action.Stop}"+ Visibility="{Binding IsRunning, Converter={StaticResource WpfBoolToVis}}" />+ <ui:Button+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Icon="{ui:SymbolIcon Delete24,+ FontSize=16}"+ Margin="0,0,8,0"+ Padding="8"+ ToolTip="{ext:Loc ScheduledTasks.Action.Delete}" />+ <ui:ToggleSwitch+ Cursor="Hand"+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"+ OffContent="{ext:Loc Common.Toggle.Off}"+ OnContent="{ext:Loc Common.Toggle.On}"+ VerticalAlignment="Center" />+ </StackPanel>+ </Grid>+ </Border>+ </DataTemplate>+ </ItemsControl.ItemTemplate>+ </ItemsControl>+ </ScrollViewer>+ </Grid>+ </Grid>+</Page>diff --git a/optimizerDuck/UI/Views/Pages/ScheduledTasksPage.xaml.cs b/optimizerDuck/UI/Views/Pages/ScheduledTasksPage.xaml.csnew file mode 100644index 0000000..278dde8--- /dev/null+++ b/optimizerDuck/UI/Views/Pages/ScheduledTasksPage.xaml.cs@@ -0,0 +1,16 @@+using optimizerDuck.UI.ViewModels.Pages;+using Wpf.Ui.Abstractions.Controls;++namespace optimizerDuck.UI.Views.Pages;++public partial class ScheduledTasksPage : INavigableView<ScheduledTasksViewModel>+{+ public ScheduledTasksPage(ScheduledTasksViewModel viewModel)+ {+ ViewModel = viewModel;+ DataContext = this;+ InitializeComponent();+ }++ public ScheduledTasksViewModel ViewModel { get; }+}diff --git a/optimizerDuck/UI/Views/Pages/StartupManagerPage.xaml b/optimizerDuck/UI/Views/Pages/StartupManagerPage.xamlindex ad3acec..569f2e4 100644--- a/optimizerDuck/UI/Views/Pages/StartupManagerPage.xaml+++ b/optimizerDuck/UI/Views/Pages/StartupManagerPage.xaml@@ -23,18 +23,38 @@<Page.Resources><converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /><converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />+ <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" /></Page.Resources><Grid RowDefinitions="Auto, *"><!-- Header --><StackPanel Margin="0,0,0,20">- <ui:TextBlock FontTypography="Title" Text="{ext:Loc StartupManager.Header.Title}" />- <ui:TextBlock- Appearance="Secondary"- FontTypography="Body"- Margin="0,4,0,0"- Text="{ext:Loc StartupManager.Header.Description}"- TextWrapping="Wrap" />+ <Grid>+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto" />+ </Grid.ColumnDefinitions>+ <StackPanel Grid.Column="0">+ <ui:TextBlock FontTypography="Title" Text="{ext:Loc StartupManager.Header.Title}" />+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Body"+ Margin="0,4,0,0"+ Text="{ext:Loc StartupManager.Header.Description}"+ TextWrapping="Wrap" />+ </StackPanel>+ <WrapPanel+ Grid.Column="1"+ Orientation="Horizontal"+ VerticalAlignment="Center">+ <ui:Button+ Appearance="Primary"+ Command="{Binding ViewModel.RefreshCommand}"+ Content="{ext:Loc StartupManager.Menu.Refresh}"+ Icon="{ui:SymbolIcon ArrowClockwise24,+ FontSize=18}" />+ </WrapPanel>+ </Grid></StackPanel><!-- Loading Indicator -->@@ -106,120 +126,118 @@<!-- Main Content --><Border Grid.Row="1" Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}">- <Grid RowDefinitions="Auto,*">- <!-- Toolbar -->- <Grid Grid.Row="0" Margin="0,0,16,12">- <Grid.ColumnDefinitions>- <ColumnDefinition Width="Auto" />- <ColumnDefinition Width="*" />- <ColumnDefinition Width="Auto" />- </Grid.ColumnDefinitions>-- <WrapPanel Grid.Column="0" Orientation="Horizontal">- <!-- Search -->- <ui:TextBox- Icon="{ui:SymbolIcon Search24}"- Margin="0,0,8,0"- MinWidth="220"- PlaceholderText="{ext:Loc Common.Search.Placeholder}"- Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}"- VerticalAlignment="Center" />-- <!-- Sort By -->- <ComboBox- Margin="0,0,8,0"- SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"- ToolTip="{ext:Loc Common.SortBy}"- ToolTipService.BetweenShowDelay="160"- ToolTipService.Placement="Top"- VerticalAlignment="Center">- <ComboBoxItem HorizontalContentAlignment="Left">- <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">- <ui:SymbolIcon- HorizontalAlignment="Left"- Margin="0,0,6,0"- Symbol="TextSortAscending24" />- <TextBlock- Grid.Column="1"- HorizontalAlignment="Left"- Text="{ext:Loc Common.SortBy.Name}" />- </Grid>- </ComboBoxItem>- <ComboBoxItem HorizontalContentAlignment="Left">- <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">- <ui:SymbolIcon- HorizontalAlignment="Left"- Margin="0,0,6,0"- Symbol="ToggleRight24" />- <TextBlock- Grid.Column="1"- HorizontalAlignment="Left"- Text="{ext:Loc Common.SortBy.Status}" />- </Grid>- </ComboBoxItem>- <ComboBoxItem HorizontalContentAlignment="Left">- <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">- <ui:SymbolIcon- HorizontalAlignment="Left"- Margin="0,0,6,0"- Symbol="Folder24" />- <TextBlock- Grid.Column="1"- HorizontalAlignment="Left"- Text="{ext:Loc Common.SortBy.Path}" />- </Grid>- </ComboBoxItem>- </ComboBox>-- <ui:Button- Appearance="Primary"- Command="{Binding ViewModel.RefreshCommand}"- Content="{ext:Loc StartupManager.Menu.Refresh}"- Icon="{ui:SymbolIcon ArrowClockwise24,- FontSize=18}" />- </WrapPanel>-- <ui:Button- Appearance="Secondary"- Command="{Binding ViewModel.OpenStartupSettingsCommand}"- Content="{ext:Loc StartupManager.Menu.OpenSettings}"- Grid.Column="2"- Icon="{ui:SymbolIcon Settings24,- FontSize=18}"- VerticalAlignment="Center" />- </Grid>-- <!-- Scrollable content -->- <ScrollViewer Grid.Row="1" Margin="0,0,16,0">- <StackPanel>- <!-- Startup Apps Section -->- <ui:CardExpander- Icon="{ui:SymbolIcon Apps24}"- IsExpanded="True"- Margin="0,0,0,12"- Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">- <ui:CardExpander.Header>- <StackPanel Orientation="Horizontal">+ <ScrollViewer Margin="0,0,16,0">+ <StackPanel>+ <!-- ═══════════ Startup Apps Section ═══════════ -->+ <ui:CardExpander+ Icon="{ui:SymbolIcon Apps24}"+ IsExpanded="True"+ Margin="0,0,0,12"+ Visibility="{Binding ViewModel.HasApps, Converter={StaticResource BooleanToVisibilityConverter}}">+ <ui:CardExpander.Header>+ <StackPanel Orientation="Horizontal">+ <ui:TextBlock+ FontTypography="BodyStrong"+ Text="{ext:Loc StartupManager.Apps.Title}"+ VerticalAlignment="Center" />+ <Border+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"+ CornerRadius="10"+ Margin="8,0,0,0"+ Padding="8,2"+ VerticalAlignment="Center"><ui:TextBlock- FontTypography="BodyStrong"- Text="{ext:Loc StartupManager.Apps.Title}"+ Appearance="Tertiary"+ FontTypography="Caption"+ Text="{Binding ViewModel.Apps.Count}"VerticalAlignment="Center" />- <Border- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"- CornerRadius="10"- Margin="8,0,0,0"- Padding="8,2"- VerticalAlignment="Center">- <ui:TextBlock- Appearance="Tertiary"- FontTypography="Caption"- Text="{Binding ViewModel.Apps.Count}"- VerticalAlignment="Center" />- </Border>- </StackPanel>- </ui:CardExpander.Header>+ </Border>+ </StackPanel>+ </ui:CardExpander.Header>- <ItemsControl ItemsSource="{Binding ViewModel.Apps}">+ <StackPanel>+ <!-- Apps Toolbar -->+ <WrapPanel Margin="0,0,0,8" Orientation="Horizontal">+ <ui:TextBox+ Icon="{ui:SymbolIcon Search24}"+ Margin="0,0,8,0"+ MinWidth="200"+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"+ Text="{Binding ViewModel.AppSearchText, UpdateSourceTrigger=PropertyChanged}"+ VerticalAlignment="Center" />+ <ComboBox+ Margin="0,0,8,0"+ SelectedIndex="{Binding ViewModel.AppSortByIndex}"+ ToolTip="{ext:Loc Common.SortBy}"+ VerticalAlignment="Center">+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="TextSortAscending24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Name}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="ToggleRight24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Status}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="Folder24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Path}" />+ </Grid>+ </ComboBoxItem>+ </ComboBox>+ <ui:Button+ Appearance="Secondary"+ Command="{Binding ViewModel.OpenStartupSettingsCommand}"+ Icon="{ui:SymbolIcon Settings24,+ FontSize=16}"+ Padding="8"+ ToolTip="{ext:Loc StartupManager.Menu.OpenSettings}"+ VerticalAlignment="Center" />+ </WrapPanel>++ <!-- No search results (Apps) -->+ <StackPanel+ HorizontalAlignment="Center"+ Margin="0,32,0,32"+ VerticalAlignment="Center"+ Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource ZeroToVisibilityConverter}}">+ <ui:SymbolIcon+ FontSize="36"+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"+ HorizontalAlignment="Center"+ Margin="0,0,0,10"+ Symbol="SearchInfo24" />+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Body"+ HorizontalAlignment="Center"+ Text="{ext:Loc Bloatware.Search.NoResults}" />+ </StackPanel>++ <!-- Apps List -->+ <ItemsControl ItemsSource="{Binding ViewModel.Apps}" Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"><ItemsControl.ItemTemplate><DataTemplate DataType="{x:Type models:StartupApp}"><Grid>@@ -288,58 +306,158 @@</DataTemplate></ItemsControl.ItemTemplate></ItemsControl>- </ui:CardExpander>+ </StackPanel>+ </ui:CardExpander>- <!-- Scheduled Tasks Section -->- <ui:CardExpander- Icon="{ui:SymbolIcon CalculatorArrowClockwise24}"- IsExpanded="True"- Margin="0,0,0,12"- Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">- <ui:CardExpander.Header>- <StackPanel Orientation="Horizontal">+ <!-- ═══════════ Scheduled Tasks Section ═══════════ -->+ <ui:CardExpander+ Icon="{ui:SymbolIcon CalculatorArrowClockwise24}"+ IsExpanded="True"+ Margin="0,0,0,12"+ Visibility="{Binding ViewModel.HasTasks, Converter={StaticResource BooleanToVisibilityConverter}}">+ <ui:CardExpander.Header>+ <StackPanel Orientation="Horizontal">+ <ui:TextBlock+ FontTypography="BodyStrong"+ Text="{ext:Loc StartupManager.Tasks.Title}"+ VerticalAlignment="Center" />+ <Border+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"+ CornerRadius="10"+ Margin="8,0,0,0"+ Padding="8,2"+ VerticalAlignment="Center"><ui:TextBlock- FontTypography="BodyStrong"- Text="{ext:Loc StartupManager.Tasks.Title}"+ Appearance="Tertiary"+ FontTypography="Caption"+ Text="{Binding ViewModel.Tasks.Count}"VerticalAlignment="Center" />- <Border- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"- CornerRadius="10"- Margin="8,0,0,0"- Padding="8,2"- VerticalAlignment="Center">- <ui:TextBlock- Appearance="Tertiary"- FontTypography="Caption"- Text="{Binding ViewModel.Tasks.Count}"- VerticalAlignment="Center" />- </Border>- </StackPanel>- </ui:CardExpander.Header>+ </Border>+ </StackPanel>+ </ui:CardExpander.Header>++ <StackPanel>+ <!-- Tasks Toolbar -->+ <WrapPanel Margin="0,0,0,8" Orientation="Horizontal">+ <ui:TextBox+ Icon="{ui:SymbolIcon Search24}"+ Margin="0,0,8,0"+ MinWidth="200"+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"+ Text="{Binding ViewModel.TaskSearchText, UpdateSourceTrigger=PropertyChanged}"+ VerticalAlignment="Center" />+ <ComboBox+ Margin="0,0,8,0"+ SelectedIndex="{Binding ViewModel.TaskSortByIndex}"+ ToolTip="{ext:Loc Common.SortBy}"+ VerticalAlignment="Center">+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="TextSortAscending24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Name}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="ToggleRight24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Status}" />+ </Grid>+ </ComboBoxItem>+ <ComboBoxItem HorizontalContentAlignment="Left">+ <Grid ColumnDefinitions="Auto Auto" HorizontalAlignment="Left">+ <ui:SymbolIcon+ HorizontalAlignment="Left"+ Margin="0,0,6,0"+ Symbol="Folder24" />+ <TextBlock+ Grid.Column="1"+ HorizontalAlignment="Left"+ Text="{ext:Loc Common.SortBy.Path}" />+ </Grid>+ </ComboBoxItem>+ </ComboBox>+ <ui:ToggleSwitch+ Cursor="Hand"+ IsChecked="{Binding ViewModel.HideMicrosoftTasks, Mode=TwoWay}"+ Margin="0,0,8,0"+ OffContent="{ext:Loc StartupManager.Tasks.HideMicrosoft}"+ OnContent="{ext:Loc StartupManager.Tasks.HideMicrosoft}"+ VerticalAlignment="Center" />+ <ui:Button+ Appearance="Secondary"+ Command="{Binding ViewModel.OpenTaskSchedulerCommand}"+ Icon="{ui:SymbolIcon Settings24,+ FontSize=16}"+ Padding="8"+ ToolTip="{ext:Loc ScheduledTasks.Menu.OpenSettings}"+ VerticalAlignment="Center" />+ </WrapPanel>++ <!-- No search results (Tasks) -->+ <StackPanel+ HorizontalAlignment="Center"+ Margin="0,32,0,32"+ VerticalAlignment="Center"+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource ZeroToVisibilityConverter}}">+ <ui:SymbolIcon+ FontSize="36"+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"+ HorizontalAlignment="Center"+ Margin="0,0,0,10"+ Symbol="SearchInfo24" />+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Body"+ HorizontalAlignment="Center"+ Text="{ext:Loc Bloatware.Search.NoResults}" />+ </StackPanel>- <ItemsControl ItemsSource="{Binding ViewModel.Tasks}">+ <!-- Tasks List -->+ <ItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"><ItemsControl.ItemTemplate><DataTemplate DataType="{x:Type models:StartupTask}"><BorderBackground="{DynamicResource CardBackgroundFillColorDefaultBrush}"CornerRadius="6"Margin="0,0,0,4"- Padding="12,10">+ Padding="16,12"><Grid><Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" /><ColumnDefinition Width="*" /><ColumnDefinition Width="Auto" /></Grid.ColumnDefinitions>- <StackPanel+ <ImageGrid.Column="0"+ Height="36"+ Margin="0,0,12,0"+ Source="{Binding LogoImage}"+ Stretch="UniformToFill"+ VerticalAlignment="Center"+ Width="36" />++ <StackPanel+ Grid.Column="1"Margin="0,0,12,0"VerticalAlignment="Center"><ui:TextBlock FontTypography="BodyStrong" Text="{Binding TaskName}" /><ui:TextBlockAppearance="Secondary"FontTypography="Caption"- Margin="0,2,0,0"+ Margin="0,4,0,0"Text="{Binding Description}"TextWrapping="Wrap" /><ui:TextBlock@@ -347,24 +465,48 @@FontTypography="Caption"Margin="0,2,0,0"Text="{Binding TaskPath}" />+ <ui:TextBlock+ Appearance="Secondary"+ FontTypography="Caption"+ Margin="0,2,0,0"+ Text="{Binding TriggerSummary}" />+ <ui:TextBlock+ Appearance="Disabled"+ FontTypography="Caption"+ Margin="0,2,0,0"+ Text="{Binding ActionSummary}"+ TextTrimming="CharacterEllipsis" /></StackPanel>- <ui:ToggleSwitch- Cursor="Hand"- Grid.Column="1"- IsChecked="{Binding IsEnabled, Mode=TwoWay}"- OffContent="{ext:Loc Common.Toggle.Off}"- OnContent="{ext:Loc Common.Toggle.On}"- VerticalAlignment="Center" />+ <StackPanel+ Grid.Column="2"+ Orientation="Horizontal"+ VerticalAlignment="Center">+ <ui:Button+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.ViewTaskDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Icon="{ui:SymbolIcon Info24,+ FontSize=16}"+ Margin="0,0,4,0"+ Padding="8"+ ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />+ <ui:ToggleSwitch+ Cursor="Hand"+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"+ OffContent="{ext:Loc Common.Toggle.Off}"+ OnContent="{ext:Loc Common.Toggle.On}"+ VerticalAlignment="Center" />+ </StackPanel></Grid></Border></DataTemplate></ItemsControl.ItemTemplate></ItemsControl>- </ui:CardExpander>- </StackPanel>- </ScrollViewer>- </Grid>+ </StackPanel>+ </ui:CardExpander>+ </StackPanel>+ </ScrollViewer></Border></Grid></Page>\ No newline at end of filediff --git a/optimizerDuck/UI/Views/Windows/MainWindow.xaml b/optimizerDuck/UI/Views/Windows/MainWindow.xamlindex 23b2b4b..80106e6 100644--- a/optimizerDuck/UI/Views/Windows/MainWindow.xaml+++ b/optimizerDuck/UI/Views/Windows/MainWindow.xaml@@ -58,6 +58,11 @@Icon="{ui:SymbolIcon WindowArrowUp24}"TargetPageType="{x:Type pages:StartupManagerPage}" />+ <controls:FilledNavigationViewItem+ Content="{extensions:Loc Sidebar.ScheduledTasks}"+ Icon="{ui:SymbolIcon CalendarLtr24}"+ TargetPageType="{x:Type pages:ScheduledTasksPage}" />+<controls:FilledNavigationViewItemContent="{extensions:Loc Sidebar.DiskCleanup}"Icon="{ui:SymbolIcon HardDrive20}"diff --git a/optimizerDuck/optimizerDuck.csproj b/optimizerDuck/optimizerDuck.csprojindex 0897b76..e28b2ef 100644--- a/optimizerDuck/optimizerDuck.csproj+++ b/optimizerDuck/optimizerDuck.csproj@@ -47,13 +47,14 @@<PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0"/><PackageReference Include="Serilog.Sinks.File" Version="7.0.0"/><PackageReference Include="System.Management.Automation" Version="7.5.4"/>+ <PackageReference Include="TaskScheduler" Version="2.12.2" /><PackageReference Include="WPF-UI" Version="4.2.0"/><PackageReference Include="WPF-UI.DependencyInjection" Version="4.2.0"/></ItemGroup><ItemGroup><EmbeddedResource Update="Resources\Languages\Translations.resx">- <Generator>PublicResXFileCodeGenerator</Generator>+ <Generator>ResXFileCodeGenerator</Generator><LastGenOutput>Translations.Designer.cs</LastGenOutput></EmbeddedResource></ItemGroup>