I'm trying to understand how to register the events using C++ WinRT using console application.
void Radio_StateChanged(Windows::Devices::Radios::Radio const& sender, Windows::Foundation::IInspectable const& args) {
printf("\t Radio_StateChanged %ls\n",sender.Name().c_str());
}
void Initialize()
{
auto radio10 = Radio::GetRadiosAsync().get();
for (Radio const& r : radio10) {
if (r.Kind() == RadioKind::MobileBroadband) {
r.StateChanged(&Radio_StateChanged);
printf("\t Radio Change enter\n");
}
}
}
I'm able to compile the code successfully but if I try to enable or disable the Mobile Broadband / cellular through Windows setting I'm not seeing any events called.
How can get the StateChanged notification in 64-bit console application whenever the radio state is changed via windows settings?
I have Mobile Broadband radio present. I also referred the link but it's more on Xaml.
I wanted to listen the event called whenever the RadioState is changed via Windows Settings / Task bar.
What changes should be done in the code in order to run in 64-bit console application?
Is there a need of co_await
and dispatcher in order to run in console application?
Should I need to use Xaml for console application?