[英]trigger a method when a method (associated with an object) has been called
i am calling some web services
in my wp7 app using postClient
(a dll incuded, which provides an interface to call the web services easily) the sample code---> 我正在使用
postClient
(包含一个dll,它提供了一个可以轻松调用Web服务的界面)在wp7应用程序中调用一些web services
的示例代码->
PostClient wbclient = new PostClient(parameters);
wbclient.DownloadStringAsync( //some uri );
wbclient.DownloadStringCompleted += (o, e) => { //some code }
i'v used these particular statements many where now i want to call a specific common method whenever the DownloadStringAsync
called of PostClient
object
, and so that i'v declared this PostClient
object
on top and initializing it every time whenever needed but how to attach some property or event handler or trigger to this PostClient
object
at same when declared. 我在许多地方都使用了这些特定的语句,现在我想在每次调用
PostClient
object
的DownloadStringAsync
时调用特定的通用方法 ,以便在顶部声明此PostClient
object
并在需要时进行每次初始化,但是如何附加一些属性或事件处理程序,或在声明时与此PostClient
object
触发器相同。
您可以考虑使用IoC容器,然后实现拦截器来修改方法调用的行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.