This too didn't work. Creating the XAML thing not on the XAML thing isn't going to work

This commit is contained in:
Mike Griese 2021-08-16 11:17:05 -05:00
parent 3a0fbd9f59
commit fd364db727
3 changed files with 21 additions and 4 deletions

View file

@ -1484,4 +1484,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_updatePatternLocations->Run();
}
winrt::Windows::System::DispatcherQueue ControlCore::Dispatcher()
{
return _dispatcher;
}
}

View file

@ -144,6 +144,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
bool IsInReadOnlyMode() const;
void ToggleReadOnlyMode();
winrt::Windows::System::DispatcherQueue Dispatcher();
// -------------------------------- WinRT Events ---------------------------------
// clang-format off
WINRT_CALLBACK(FontSizeChanged, Control::FontSizeChangedEventArgs);

View file

@ -17,6 +17,7 @@
#include "ControlInteractivity.g.cpp"
#include "TermControl.h"
#include <til/latch.h>
using namespace ::Microsoft::Console::Types;
using namespace ::Microsoft::Console::VirtualTerminal;
@ -614,11 +615,21 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::InteractivityAutomationPeer ControlInteractivity::OnCreateAutomationPeer()
try
{
auto autoPeer = winrt::make_self<implementation::InteractivityAutomationPeer>(this);
til::latch latch{ 1 };
Control::InteractivityAutomationPeer peer{ nullptr };
_uiaEngine = std::make_unique<::Microsoft::Console::Render::UiaEngine>(autoPeer.get());
_core->AttachUiaEngine(_uiaEngine.get());
return *autoPeer;
_core->Dispatcher().TryEnqueue([this, &peer, &latch]() {
auto autoPeer = winrt::make_self<implementation::InteractivityAutomationPeer>(this);
_uiaEngine = std::make_unique<::Microsoft::Console::Render::UiaEngine>(autoPeer.get());
_core->AttachUiaEngine(_uiaEngine.get());
peer = *autoPeer;
latch.count_down();
});
latch.wait();
return peer;
}
catch (...)
{