-
Dec 19th, 2011, 08:02 AM
#1
Thread Starter
New Member
Newbee question
Hello,
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?
Thanks,
Ash
-
Dec 19th, 2011, 08:17 AM
#2
Re: Newbee question
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.
-tg
-
Dec 19th, 2011, 08:27 AM
#3
Thread Starter
New Member
Re: Newbee question
Thanks for confirming my suspisions,
No typing involved, the
dlgLoading.Show() is a wait icon,
src.LoginAsync loges the user as login in
its the same throughout the code and my fear is that in some instances the process 'may' complete before the relevant handlers have been added,
Right some changes to be made then
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|