I'm just starting work on a sliverlight project for the first time, its an existing project that has been worked on by a co-worker.
Right so I to on of the first sections which is this:
'Login the User and store the returned values
dlgLoading.Show()
src.LoginAsync(txtUserName.Text, txtPassword.Password)
AddHandler src.LoginCompleted, AddressOf LoginClient
Now my first through is that it should be this:
'Login the User and store the returned values
dlgLoading.Show()
AddHandler src.LoginCompleted, AddressOf LoginClient
src.LoginAsync(txtUserName.Text, txtPassword.Password)
as I would think that you would always want to add the handler for the thread before running it. the code work either way. Its the same throughout the project.
So my questions are:
1. Am I right?
2. Am I just being pedantic? Or could this course problems where the LoginCompleted event had been raised before the handler is added?
It's possible... but the user would have to be an extremely fast typist, so it's an "unlikely" scenario. The reason is because the call is done asynch... so the thread gets spun up and sent off to do it's thing, mean while the addhandler gets called.