mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
bootstrapper: use WinAPI progress bar window instead of toast notific… (#8210)
* bootstrapper: use WinAPI progress bar window instead of toast notifications * remove obsolete msi action
This commit is contained in:
@@ -234,21 +234,6 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == L"-install_dotnet")
|
||||
{
|
||||
if (updating::dotnet_is_installed())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const bool success = updating::install_dotnet();
|
||||
|
||||
MessageBoxW(nullptr,
|
||||
GET_RESOURCE_STRING(IDS_DOTNET_CORE_DOWNLOAD_FAILURE).c_str(),
|
||||
GET_RESOURCE_STRING(IDS_DOTNET_CORE_DOWNLOAD_FAILURE_TITLE).c_str(),
|
||||
MB_OK | MB_ICONERROR);
|
||||
|
||||
return !success;
|
||||
}
|
||||
else if (action == L"-uninstall_msi")
|
||||
{
|
||||
return uninstall_msi_action();
|
||||
|
||||
@@ -20,9 +20,9 @@ namespace updating
|
||||
return runtimes->find(DESKTOP_DOTNET_RUNTIME_STRING) != std::string::npos;
|
||||
}
|
||||
|
||||
bool install_dotnet(const bool silent)
|
||||
std::optional<fs::path> download_dotnet()
|
||||
{
|
||||
const wchar_t DOTNET_DESKTOP_DOWNLOAD_LINK[] = L"https://download.visualstudio.microsoft.com/download/pr/3eb7efa1-96c6-4e97-bb9f-563ecf595f8a/7efd9c1cdd74df8fb0a34c288138a84f/windowsdesktop-runtime-3.1.6-win-x64.exe";
|
||||
const wchar_t DOTNET_DESKTOP_DOWNLOAD_LINK[] = L"https://download.visualstudio.microsoft.com/download/pr/513acf37-8da2-497d-bdaa-84d6e33c1fee/eb7b010350df712c752f4ec4b615f89d/windowsdesktop-runtime-3.1.10-win-x64.exe";
|
||||
const wchar_t DOTNET_DESKTOP_FILENAME[] = L"windowsdesktop-runtime.exe";
|
||||
|
||||
auto dotnet_download_path = fs::temp_directory_path() / DOTNET_DESKTOP_FILENAME;
|
||||
@@ -44,10 +44,11 @@ namespace updating
|
||||
// couldn't download
|
||||
}
|
||||
}
|
||||
if (!download_success)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return download_success ? std::make_optional(dotnet_download_path) : std::nullopt;
|
||||
}
|
||||
|
||||
bool install_dotnet(fs::path dotnet_download_path, const bool silent = false)
|
||||
{
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE };
|
||||
sei.lpFile = dotnet_download_path.c_str();
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
namespace updating
|
||||
{
|
||||
bool dotnet_is_installed();
|
||||
bool install_dotnet(const bool silent = false);
|
||||
std::optional<fs::path> download_dotnet();
|
||||
bool install_dotnet(fs::path dotnet_download_path, const bool silent);
|
||||
}
|
||||
@@ -17,4 +17,6 @@
|
||||
#include <filesystem>
|
||||
#include <expected.hpp>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#endif //PCH_H
|
||||
|
||||
Reference in New Issue
Block a user