mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[OOBE] Out of box experience window (#9973)
This commit is contained in:
@@ -5,6 +5,7 @@ namespace PTSettingsHelper
|
||||
{
|
||||
constexpr inline const wchar_t* settings_filename = L"\\settings.json";
|
||||
constexpr inline const wchar_t* log_settings_filename = L"log_settings.json";
|
||||
constexpr inline const wchar_t* oobe_filename = L"oobe_settings.json";
|
||||
|
||||
std::wstring get_root_save_folder_location()
|
||||
{
|
||||
@@ -77,4 +78,34 @@ namespace PTSettingsHelper
|
||||
result = result.append(log_settings_filename);
|
||||
return result.wstring();
|
||||
}
|
||||
|
||||
bool get_oobe_opened_state()
|
||||
{
|
||||
std::filesystem::path oobePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
oobePath = oobePath.append(oobe_filename);
|
||||
if (std::filesystem::exists(oobePath))
|
||||
{
|
||||
auto saved_settings = json::from_file(oobePath.c_str());
|
||||
if (!saved_settings.has_value())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool opened = saved_settings->GetNamedBoolean(L"openedAtFirstLaunch", false);
|
||||
return opened;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void save_oobe_opened_state()
|
||||
{
|
||||
std::filesystem::path oobePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
oobePath = oobePath.append(oobe_filename);
|
||||
|
||||
json::JsonObject obj;
|
||||
obj.SetNamedValue(L"openedAtFirstLaunch", json::value(true));
|
||||
|
||||
json::to_file(oobePath.c_str(), obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,7 @@ namespace PTSettingsHelper
|
||||
void save_general_settings(const json::JsonObject& settings);
|
||||
json::JsonObject load_general_settings();
|
||||
std::wstring get_log_settings_file_location();
|
||||
|
||||
bool get_oobe_opened_state();
|
||||
void save_oobe_opened_state();
|
||||
}
|
||||
|
||||
@@ -138,5 +138,13 @@ public
|
||||
static String ^ PowerLauncherSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowColorPickerSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowShortcutGuideSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_SHORTCUT_GUIDE_SHARED_EVENT);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ namespace CommonSharedConstants
|
||||
// Path to the event used by PowerLauncher
|
||||
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
|
||||
|
||||
// Path to the event used to show Color Picker
|
||||
const wchar_t SHOW_COLOR_PICKER_SHARED_EVENT[] = L"Local\\ShowColorPickerEvent-8c46be2a-3e05-4186-b56b-4ae986ef2525";
|
||||
|
||||
// Path to the event used to show Shortcut Guide
|
||||
const wchar_t SHOW_SHORTCUT_GUIDE_SHARED_EVENT[] = L"Local\\ShowShortcutGuideEvent-6982d682-7462-404f-95af-86ae3f089c4f";
|
||||
|
||||
// Max DWORD for key code to disable keys.
|
||||
const int VK_DISABLED = 0x100;
|
||||
}
|
||||
Reference in New Issue
Block a user