wpf - What's the best way to cancel an asynchronous WCF request? -


I'm using methods (and handling a blank flag while sending the results of the main thread). I would like to use the MyFunctionAsync method (and hooking in MyFunctionAsyncCompleted event instead of Begin / End instead of async calls) using MyFunctionAsyncCompleted if the best / supported cancellation is the way to handle WCF requests , And still make sure that the event is not removed on a page that is no longer loaded (ie page navigation within a range).

Edit:

I have decided that I want to create my WCFClient object on a call-based basis, so here's what I brought (As opposed to per-WPF-page or per application):

  Public Zero StartValidation () {WcfClient WCF = New WcfClient (); Wcf.IsValidCompleted + = new event handler & lt; IsValidCompletedEventArgs & gt; (Wcf_IsValidCompleted); // Pass WCFClient object as a userState parameter so that it can be wcf.IsValidAsync (TextBox.Text, wcf) turned off later; } Zero wcf_IsValidCompleted (object sender, IsValidCompletedEventArgs e) {if (! M_IsCanceled) {// UI update // m_IsCanceled is set to true when page unload event is removed} // if connection closes (e. UserState is WcfClient) {((WcfClient) e.UserState). Stop it (); }}  

I find it hard to find out what is the recommended way to complete what I have done, is it okay, or what to worry about in the loss / side cases Need it? What is the standard of sleep when it comes to canceling a WCF call properly? There is no way to cancel asynchronous request unless you manually make asynchronous functions.

Keeping in mind that you are automatically generating your WCF calls which will make it more of a house work. However, as you said you did not cancel the call, it is still going on. If you still want to make a cancellation you just have to make sure that the customer / UI does not pay attention to the result from the call.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -