C++/CX access UI elements from external thread

  • Thread starter Thread starter Ourge
  • Start date Start date
O

Ourge

Guest
Hello, I'm trying to modify my UI content when my client is ready with this code :

Account::Account(String^ token) :
client(new DiscordClient::Client),
connected(false),
token(token)
{
InitializeComponent();

client->setDisconnectionHandler([&](const uint16_t& code, const winrt::hstring& reason) -> void
{
String^ message = L"Code: ";
message += ref new String(std::to_wstring(code).c_str());
message += L",\nReason: ";
message += ref new String(reason.c_str());
Windows::UI::Popups::MessageDialog(message).ShowAsync();
});
client->setReadyHandler([&](const DiscordClient::User& user) -> void
{
String^ username = ref new String(user.username.c_str());
statusBar->IsIndeterminate = true; // HERE
statusBar->ShowError = false;
statusBar->ShowPaused = false;
});
}



Unfortunately, an exception with no informations on it is thrown at the line with "// HERE". Is there an obvious reason that I am missing for that ? thanks

Continue reading...
 
Back
Top