Click here to Skip to main content
15,899,025 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: background worker PinPopular
Ian Shlasko15-Feb-11 3:16
Ian Shlasko15-Feb-11 3:16 
GeneralRe: background worker Pin
musefan15-Feb-11 3:44
musefan15-Feb-11 3:44 
GeneralRe: background worker Pin
Ian Shlasko15-Feb-11 4:19
Ian Shlasko15-Feb-11 4:19 
GeneralRe: background worker Pin
musefan15-Feb-11 4:54
musefan15-Feb-11 4:54 
GeneralRe: background worker Pin
Ian Shlasko15-Feb-11 4:58
Ian Shlasko15-Feb-11 4:58 
GeneralRe: background worker Pin
Pete O'Hanlon15-Feb-11 5:19
mvePete O'Hanlon15-Feb-11 5:19 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 3:50
professionalTesic Goran16-Feb-11 3:50 
GeneralRe: background worker Pin
Ian Shlasko16-Feb-11 5:29
Ian Shlasko16-Feb-11 5:29 
I think you're a little confused as to the workings of an asynchronous operation. Here's what you're doing...

F: "Ok, client, I want you to go get all of those subsystem thingies."
Client: "Sure thing, boss... I'll be right back."
F: "Good, now let's put those subsystems in the tree--"
Client: "Hold on! I haven't even left yet!"
F: "Where's my list of subsystems?"
Client: "Give me a #(%*&#ing minute to get it!"
F: "Ok, I guess there aren't any... Now, Client... Oh good, you're here."
Client: "Of course I'm here... You haven't given me a chance to leave yet!"
F: "Now go grab all of those forms and actions, ok?"
Client: "Fine... But it's going to take a few minutes to--"
F: "Good, now let's put the forms and actions into--"
Client: "That's it! I quit! Get your own #(*%&#ing actions!"


Now, here's what you want to be doing...


F: "Ok, Client1, I want you to go get all of those subsystem thingies."
Client1: "Will do."
* Client1 goes off to do his job
F: "Great... Now, Client2, you're going to fetch all of those forms and actions."
Client2: "Yep, I'm on it, boss!"
* Client2 goes off to do his job
* F makes sure everyone is gone, and turns on the TV to check the latest scores...

* Client1 and Client2 both return
* Client1: "All done. Here's the results."
* Client2: "Me too... Here's mine.
* F turns off the TV, grumbling about how he has to actually do some work
* F: "Alright, you first... Let's put these things in the tree......"

So you see, when you send the clients off to do something, that's called an asynchronous operation... Because they can do something on their own, and you don't have to sit there waiting for them to finish. Sending them off is your RunAsync() operation, whatever you want to call it.

The trick is that you're trying to read the results as soon as you send them away, instead of doing that after they come back. When they return with the results, that's the "GetSubsystemsByTestRunIDCompleted" event, in your example. THAT's where you should be processing the resulting data... In the handler for that event.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

GeneralRe: background worker Pin
Tesic Goran16-Feb-11 21:37
professionalTesic Goran16-Feb-11 21:37 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 21:52
mvePete O'Hanlon16-Feb-11 21:52 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 7:38
mvePete O'Hanlon16-Feb-11 7:38 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 21:24
professionalTesic Goran16-Feb-11 21:24 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 21:50
mvePete O'Hanlon16-Feb-11 21:50 
QuestionMVVM Question Pin
_Maxxx_14-Feb-11 0:14
professional_Maxxx_14-Feb-11 0:14 
AnswerRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 0:22
mvePete O'Hanlon14-Feb-11 0:22 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 0:37
professional_Maxxx_14-Feb-11 0:37 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 0:42
mvePete O'Hanlon14-Feb-11 0:42 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 13:51
professional_Maxxx_14-Feb-11 13:51 
AnswerRe: MVVM Question Pin
lmoelleb14-Feb-11 1:47
lmoelleb14-Feb-11 1:47 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 5:13
mvePete O'Hanlon14-Feb-11 5:13 
GeneralRe: MVVM Question Pin
Mycroft Holmes14-Feb-11 13:36
professionalMycroft Holmes14-Feb-11 13:36 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 13:58
professional_Maxxx_14-Feb-11 13:58 
GeneralRe: MVVM Question Pin
Mycroft Holmes14-Feb-11 14:06
professionalMycroft Holmes14-Feb-11 14:06 
AnswerRe: MVVM Question Pin
SledgeHammer0114-Feb-11 15:03
SledgeHammer0114-Feb-11 15:03 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 17:03
professional_Maxxx_14-Feb-11 17:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.