mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
UWP port: re-enable devtools
This commit is contained in:
parent
58ff35f5bf
commit
00395125f6
6 changed files with 34 additions and 7 deletions
|
@ -11,6 +11,8 @@ using namespace winrt::Windows::UI::Core;
|
|||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::Devices::Input;
|
||||
using namespace winrt::Windows::UI::Notifications;
|
||||
using namespace winrt::Windows::Data::Xml::Dom;
|
||||
using namespace concurrency;
|
||||
using namespace winrt::servo;
|
||||
|
||||
|
@ -556,6 +558,22 @@ std::optional<hstring> ServoControl::OnServoPromptInput(winrt::hstring message,
|
|||
return string;
|
||||
}
|
||||
|
||||
void ServoControl::OnServoDevtoolsStarted(bool success,
|
||||
const unsigned int port) {
|
||||
auto toastTemplate = ToastTemplateType::ToastText01;
|
||||
auto toastXml = ToastNotificationManager::GetTemplateContent(toastTemplate);
|
||||
auto toastTextElements = toastXml.GetElementsByTagName(L"text");
|
||||
std::wstring message;
|
||||
if (success) {
|
||||
message = L"DevTools server has started on port " + std::to_wstring(port);
|
||||
} else {
|
||||
message = L"Error: could not start DevTools";
|
||||
}
|
||||
toastTextElements.Item(0).InnerText(message);
|
||||
auto toast = ToastNotification(toastXml);
|
||||
ToastNotificationManager::CreateToastNotifier().Show(toast);
|
||||
}
|
||||
|
||||
template <typename Callable> void ServoControl::RunOnUIThread(Callable cb) {
|
||||
Dispatcher().RunAsync(CoreDispatcherPriority::High, cb);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue