WCF Service and event [modified]
-
Hi! New to silverlight, i have a problem. I have created a service to connect to a database and i want to call it many times, the problem is that string a and string b is executed before the event is triggered? in the event i have code that catches the result from the service and i want to save it to the string a and then call the same service again and save that result to string b. but i can't do that if the event isn't triggered each time any ideas on how to solve? main(){ serviceclient x = new serviceclient x.xxx_completed += the event x.getdataAsync(); string a; string b; } void event () { code to get data }
modified on Tuesday, January 4, 2011 6:09 AM
-
Hi! New to silverlight, i have a problem. I have created a service to connect to a database and i want to call it many times, the problem is that string a and string b is executed before the event is triggered? in the event i have code that catches the result from the service and i want to save it to the string a and then call the same service again and save that result to string b. but i can't do that if the event isn't triggered each time any ideas on how to solve? main(){ serviceclient x = new serviceclient x.xxx_completed += the event x.getdataAsync(); string a; string b; } void event () { code to get data }
modified on Tuesday, January 4, 2011 6:09 AM
Implement all string saving logic inside the
void event()
method. Call the service again after you obtain the result if you have to.The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick
-
Implement all string saving logic inside the
void event()
method. Call the service again after you obtain the result if you have to.The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick
I am doing some string operations in the event(). but the problem still is: in the void event () i define 2 dynamic keys (in a property) depending on the input parameter to the service after i have done this i use the keys in the other method before calling the service again to retrive two other keys. but the methodcall_x(keys) is executed before the event is triggered and keys = null so i can't call the service again. class x { MAIN{ Servicecall() methodcall_x(keys) } viod the event(){save result to a property} }
-
I am doing some string operations in the event(). but the problem still is: in the void event () i define 2 dynamic keys (in a property) depending on the input parameter to the service after i have done this i use the keys in the other method before calling the service again to retrive two other keys. but the methodcall_x(keys) is executed before the event is triggered and keys = null so i can't call the service again. class x { MAIN{ Servicecall() methodcall_x(keys) } viod the event(){save result to a property} }
What you need to do is to use an Action to return to MAIN once event() method is executed. Move the methodcall_X(keys) in this Action's handler. For more info on Actions, check out MSDN.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick
-
What you need to do is to use an Action to return to MAIN once event() method is executed. Move the methodcall_X(keys) in this Action's handler. For more info on Actions, check out MSDN.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick