locked
How do I call RfcommDeviceService::FromIdAsync from the UI-Thread?

    Question

  • I tried the following, without success. The "result" var is never set

    IAsyncOperation<RfcommDeviceService^>^ Foo::getDeviceServiceAsync() {
      return create_async([this]() {
        RfcommDeviceService^ result = nullptr;
        return create_task(m_dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, &result] {
          create_task(RfcommDeviceService::FromIdAsync(FooDeviceId))
            .then([&result](RfcommDeviceService^ deviceService) {
            result = deviceService;
          });
        }))).then([result]() {
          return result;
        });
      });
    }

    Wednesday, July 16, 2014 12:29 AM

Answers

All replies