|
10 | 10 |
|
11 | 11 | #include "Command/CommandManager.hpp" |
12 | 12 |
|
| 13 | +#include <winrt/Windows.UI.Core.h> |
| 14 | +#include <winrt/Windows.Foundation.h> |
| 15 | +#include <winrt/Windows.ApplicationModel.Core.h> |
| 16 | +#include <winrt/Windows.ApplicationModel.Activation.h> |
| 17 | +#include <winrt/Windows.Foundation.Collections.h> |
| 18 | + |
| 19 | +using namespace winrt::Windows::UI::Core; |
| 20 | +using namespace winrt::Windows::Foundation; |
| 21 | +using namespace winrt::Windows::ApplicationModel::Activation; |
| 22 | +using namespace winrt::Windows::ApplicationModel::Core; |
| 23 | + |
13 | 24 | Settings Client::settings = Settings(); |
14 | 25 |
|
15 | 26 | bool notifiedOfConnectionIssue = false; |
@@ -131,6 +142,25 @@ void Client::initialize() { |
131 | 142 |
|
132 | 143 | FlarialGUI::LoadFont(IDR_MINECRAFTIA_TTF); |
133 | 144 |
|
| 145 | + CoreApplication::MainView().Activated([](const auto &, const IActivatedEventArgs &context) { |
| 146 | + if (context.Kind() != ActivationKind::Protocol) |
| 147 | + return; |
| 148 | + |
| 149 | + auto uri = winrt::unbox_value<ProtocolActivatedEventArgs>(context).Uri(); |
| 150 | + |
| 151 | + std::vector<std::pair<std::wstring, std::wstring>> dataList; |
| 152 | + |
| 153 | + for (const auto& dataContext : uri.QueryParsed()) { |
| 154 | + std::wstring name = dataContext.Name().c_str(); |
| 155 | + std::wstring value = dataContext.Value().c_str(); |
| 156 | + |
| 157 | + dataList.emplace_back(name, value); |
| 158 | + } |
| 159 | + |
| 160 | + |
| 161 | + auto event = nes::make_holder<ProtocolEvent>(uri.Host().c_str(), dataList); |
| 162 | + eventMgr.trigger(event); |
| 163 | + }); |
134 | 164 | HookManager::initialize(); |
135 | 165 | ModuleManager::initialize(); |
136 | 166 | CommandManager::initialize(); |
|
0 commit comments