一次获得更多响应 [英] Getting Response More then One Time

查看:86
本文介绍了一次获得更多响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在为移动设备开发应用程序.我在其中使用Service.
当我使用开票服务"方法时,它的响应要超过一次".



在表单加载中(定义事件处理程序)

Hi Everyone,

I am Developing Application for the mobile device. In which have i am using Service.
When i am Invoiking Service method it response more then One Time.



In Form Load..(Define the Eventhandler )

serviceobj1.Get_InformationCompleted +=new EventHandler<ServiceObject1.Get_InformationCompletedEventArgs>(serviceobj1_Get_InformationCompleted);



然后在按钮中单击



And In Button Click

serviceObject1.Get_InformationRequest req  = new serviceObject1.Get_InformationRequest ();
req.Body  = new ServiceObject1.Get_InformationRequestBody();
req.Body.id  =Common.CurrentUserID;
Common.serviceobj1.Get_InformationAsync(req);







void serviceobj1_Get_InformationCompleted(object obj, ServiceObject1.Get_InformationCompletedEventArgs e)
        {
            MessageBox.Show("Complete");
        }




当我单击按钮时,我得到的响应(消息完成)多于一个.


所以,你能帮我解决这个问题吗?




When i am clicking on the button then i have get response (message Complete) more then one.


So Can u please help me how can i fix it.

推荐答案

大家好,

我已经找到解决此问题的方法.实际上,我有一个表单,并且在页面加载中添加了事件处理程序.但是在后退和前进的情况下,我不会处理表单实例.再一次,我回到这种形式,以便为此处理程序添加一个事件.


因此得出的结论是,在后退和处理的情况下,我们需要处理该类实例或删除处理程序.
Hi Everybody,

I have found the solution for this problem. Actually i have a form and Eventhandler is added in Page Load. But In case of back and Forward i am not disposing the form instance. and Again i am coming back to this form so that the one more event is added for this handler.


So the conclusion is that in case of back and dispose we should need to dispose the class instance or remove handler.


这篇关于一次获得更多响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆