Remove CreateScheduledTask CA and handle task creation from runner code (#27819)

* Refactor to avoid code duplication

* Remove CreateScheduledTask CA

* Update installer/PowerToysSetupCustomActions/CustomAction.cpp

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>

* Update installer/PowerToysSetupCustomActions/CustomAction.cpp

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>

---------

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
Stefan Markovic
2023-08-09 10:23:54 +02:00
committed by GitHub
parent 433edb4790
commit f0c30132a2
4 changed files with 66 additions and 323 deletions

View File

@@ -104,7 +104,7 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
if (is_process_elevated())
{
delete_auto_start_task_for_this_user();
create_auto_start_task_for_this_user(general_configs.GetNamedBoolean(L"run_elevated", false));
create_auto_start_task_for_this_user(run_as_elevated);
}
else
{
@@ -127,6 +127,12 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
delete_auto_start_task_for_this_user();
}
}
else
{
delete_auto_start_task_for_this_user();
create_auto_start_task_for_this_user(run_as_elevated);
}
if (json::has(general_configs, L"enabled"))
{
for (const auto& enabled_element : general_configs.GetNamedObject(L"enabled"))