diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-12-26 16:36:26 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-12-26 16:36:26 +0100 |
commit | 94da76281c4f079914ff7f11f82ae84a6b5e0f17 (patch) | |
tree | 97ea1d8506326c24dff9e0181c28b6095e1ac55e /cpp | |
parent | Unity fixes for IceSSL (diff) | |
download | ice-94da76281c4f079914ff7f11f82ae84a6b5e0f17.tar.bz2 ice-94da76281c4f079914ff7f11f82ae84a6b5e0f17.tar.xz ice-94da76281c4f079914ff7f11f82ae84a6b5e0f17.zip |
Fixed ICE-6243 - Fixed WinRT hello demo hang
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 +} |