mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
28 lines
915 B
C++
28 lines
915 B
C++
|
|
#include "pch.h"
|
|||
|
|
#include "BackgroundHandler.h"
|
|||
|
|
#include "BackgroundHandler.g.cpp"
|
|||
|
|
|
|||
|
|
#include "handler_functions.h"
|
|||
|
|
|
|||
|
|
namespace winrt::PowerToysNotifications::implementation
|
|||
|
|
{
|
|||
|
|
using Windows::ApplicationModel::Background::IBackgroundTaskInstance;
|
|||
|
|
using Windows::UI::Notifications::ToastNotificationActionTriggerDetail;
|
|||
|
|
using Windows::Foundation::WwwFormUrlDecoder;
|
|||
|
|
|
|||
|
|
void BackgroundHandler::Run(IBackgroundTaskInstance bti)
|
|||
|
|
{
|
|||
|
|
const auto details = bti.TriggerDetails().try_as<ToastNotificationActionTriggerDetail>();
|
|||
|
|
if (!details)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
WwwFormUrlDecoder decoder{details.Argument()};
|
|||
|
|
|
|||
|
|
const size_t button_id = std::stoi(decoder.GetFirstValueByName(L"button_id").c_str());
|
|||
|
|
auto handler = decoder.GetFirstValueByName(L"handler");
|
|||
|
|
dispatch_to_backround_handler(std::move(handler), std::move(bti), button_id);
|
|||
|
|
}
|
|||
|
|
}
|