diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-11-30 11:00:17 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-11-30 11:00:17 -0330 |
commit | 60276ae3101dfc1fa1bb7b7ee2d23cb474e9666d (patch) | |
tree | 29b7541fed602821c8d5ea7ec418eba18c423a24 /cpp/demo/Ice/MFC/client/HelloClientDlg.cpp | |
parent | 4387 - Commited IceGrid/Scanner.cpp doesn't compilce with VC9 (diff) | |
download | ice-60276ae3101dfc1fa1bb7b7ee2d23cb474e9666d.tar.bz2 ice-60276ae3101dfc1fa1bb7b7ee2d23cb474e9666d.tar.xz ice-60276ae3101dfc1fa1bb7b7ee2d23cb474e9666d.zip |
Changed demos to use new AMI API
Diffstat (limited to 'cpp/demo/Ice/MFC/client/HelloClientDlg.cpp')
-rw-r--r-- | cpp/demo/Ice/MFC/client/HelloClientDlg.cpp | 87 |
1 files changed, 17 insertions, 70 deletions
diff --git a/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp b/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp index dad895e0802..e1e3b4404b3 100644 --- a/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp +++ b/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp @@ -27,61 +27,29 @@ using namespace Demo; namespace
{
-class SayHelloI : public AMI_Hello_sayHello, public Ice::AMISentCallback
+class Callback : public IceUtil::Shared
{
public:
- SayHelloI(CHelloClientDlg* dialog) :
+ Callback(CHelloClientDlg* dialog) :
_dialog(dialog)
{
}
- virtual void
- ice_sent()
+ void
+ sent(bool)
{
_dialog->PostMessage(WM_AMI_SENT, 0, 0);
}
- virtual void
- ice_response()
+ void
+ response()
{
_dialog->PostMessage(WM_AMI_RESPONSE, 0, 0);
}
- virtual void
- ice_exception(const Ice::Exception& ex)
- {
- _dialog->PostMessage(WM_AMI_EXCEPTION, 0, reinterpret_cast<LONG>(ex.ice_clone()));
- }
-
-private:
-
- CHelloClientDlg* _dialog;
-};
-
-class ShutdownI : public AMI_Hello_shutdown, public Ice::AMISentCallback
-{
-public:
-
- ShutdownI(CHelloClientDlg* dialog) :
- _dialog(dialog)
- {
- }
-
- virtual void
- ice_sent()
- {
- _dialog->PostMessage(WM_AMI_SENT, 0, 0);
- }
-
- virtual void
- ice_response()
- {
- _dialog->PostMessage(WM_AMI_RESPONSE, 0, 0);
- }
-
- virtual void
- ice_exception(const Ice::Exception& ex)
+ void
+ exception(const Ice::Exception& ex)
{
_dialog->PostMessage(WM_AMI_EXCEPTION, 0, reinterpret_cast<LONG>(ex.ice_clone()));
}
@@ -90,6 +58,7 @@ private: CHelloClientDlg* _dialog;
};
+typedef IceUtil::Handle<Callback> CallbackPtr;
enum DeliveryMode
{
@@ -273,21 +242,10 @@ CHelloClientDlg::OnSayHello() {
if(!deliveryModeIsBatch())
{
- if(hello->sayHello_async(new SayHelloI(this), delay))
- {
- if(hello->ice_isTwoway())
- {
- _status->SetWindowText(CString(" Waiting for response"));
- }
- else
- {
- _status->SetWindowText(CString(" Ready"));
- }
- }
- else
- {
- _status->SetWindowText(CString(" Sending request"));
- }
+ _status->SetWindowText(CString(" Sending request"));
+ CallbackPtr cb = new Callback(this);
+ hello->begin_sayHello(delay, newCallback_Hello_sayHello(cb, &Callback::response, &Callback::exception,
+ &Callback::sent));
}
else
{
@@ -310,21 +268,10 @@ CHelloClientDlg::OnShutdown() {
if(!deliveryModeIsBatch())
{
- if(hello->shutdown_async(new ShutdownI(this)))
- {
- if(hello->ice_isTwoway())
- {
- _status->SetWindowText(CString(" Waiting for response"));
- }
- else
- {
- _status->SetWindowText(CString(" Ready"));
- }
- }
- else
- {
- _status->SetWindowText(CString(" Sending request"));
- }
+ _status->SetWindowText(CString(" Sending request"));
+ CallbackPtr cb = new Callback(this);
+ hello->begin_shutdown(newCallback_Hello_shutdown(cb, &Callback::response, &Callback::exception,
+ &Callback::sent));
}
else
{
|