diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Ice/winrt/hello/MainPage.xaml.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/cpp/demo/Ice/winrt/hello/MainPage.xaml.cpp b/cpp/demo/Ice/winrt/hello/MainPage.xaml.cpp index dcf0a5956c8..a52b4f92d79 100644 --- a/cpp/demo/Ice/winrt/hello/MainPage.xaml.cpp +++ b/cpp/demo/Ice/winrt/hello/MainPage.xaml.cpp @@ -198,14 +198,36 @@ hello::MainPage::hello_Click(Platform::Object^ sender, Windows::UI::Xaml::Routed void hello::MainPage::shutdown_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { + if(!_helloPrx) + { + return; + } + try { - if (!_helloPrx) + if(_helloPrx->ice_isBatchOneway() || _helloPrx->ice_isBatchDatagram()) { - return; + print("Queued shutdown request."); + _helloPrx->shutdown(); + flush->IsEnabled = true; + } + else + { + print("Shutting down..."); + shutdown->IsEnabled = false; + _helloPrx->begin_shutdown([=]() + { + shutdown->IsEnabled = true; + print("Ready."); + }, + [=](const Ice::Exception& ex) + { + shutdown->IsEnabled = true; + ostringstream os; + os << ex; + print(os.str()); + }); } - _helloPrx = Demo::HelloPrx::uncheckedCast(_helloPrx->ice_twoway()); - _helloPrx->begin_shutdown(); } catch(const Ice::Exception& ex) { @@ -273,4 +295,4 @@ void MainPage::print(const std::string& message) { output->Text = ref new String(IceUtil::stringToWstring(message).c_str()); -}
\ No newline at end of file +} |