mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <common/notifications/notifications.h>
|
||
|
|
#include <common/notifications/dont_show_again.h>
|
||
|
|
#include <common/utils/resources.h>
|
||
|
|
|
||
|
|
#include "Generated Files/resource.h"
|
||
|
|
|
||
|
|
namespace notifications
|
||
|
|
{
|
||
|
|
// Non-Localizable strings
|
||
|
|
namespace NonLocalizable
|
||
|
|
{
|
||
|
|
const wchar_t RunAsAdminInfoPage[] = L"https://aka.ms/powertoysDetectedElevatedHelp";
|
||
|
|
const wchar_t ToastNotificationButtonUrl[] = L"powertoys://cant_drag_elevated_disable/";
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void WarnIfElevationIsRequired(std::wstring title, std::wstring message, std::wstring button1, std::wstring button2)
|
||
|
|
{
|
||
|
|
using namespace NonLocalizable;
|
||
|
|
|
||
|
|
static bool warning_shown = false;
|
||
|
|
if (!warning_shown && !is_toast_disabled(ElevatedDontShowAgainRegistryPath, ElevatedDisableIntervalInDays))
|
||
|
|
{
|
||
|
|
std::vector<action_t> actions = {
|
||
|
|
link_button{ button1, RunAsAdminInfoPage },
|
||
|
|
link_button{ button2, ToastNotificationButtonUrl }
|
||
|
|
};
|
||
|
|
show_toast_with_activations(message,
|
||
|
|
title,
|
||
|
|
{},
|
||
|
|
std::move(actions));
|
||
|
|
warning_shown = true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|