×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    523

    Re: Making a synchronous web request from UI thread.

    If you await a call in the initializer and meanwhile display a progress indicator this won't block the UI thread and initialization of the page is treated as being finished (if you look at what happens behind the scenes it actually is - methods get split up into separate methods at each await call and simply invoke the next part of the method as soon as the asynchronous operation completes). So if you use the OnNavigatedTo to show the indicators and then await the ServiceRequest at that point initialization is finished as far as the Watchdog and the Framework are concerned.

  2. #17
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    572

    Re: Making a synchronous web request from UI thread.

    Quote Originally Posted by SB Dev View Post
    If you await a call in the initializer and meanwhile display a progress indicator this won't block the UI thread and initialization of the page is treated as being finished (if you look at what happens behind the scenes it actually is - methods get split up into separate methods at each await call and simply invoke the next part of the method as soon as the asynchronous operation completes). So if you use the OnNavigatedTo to show the indicators and then await the ServiceRequest at that point initialization is finished as far as the Watchdog and the Framework are concerned.
    True, I was mentioning it 'just in case', I see people get caught by the issue from time to time.

  3. #18
    Regular Contributor
    Join Date
    Dec 2012
    Posts
    66

    Re: Making a synchronous web request from UI thread.

    Hi
    Quote Originally Posted by theothernt View Post
    True, I was mentioning it 'just in case', I see people get caught by the issue from time to time.
    Absolutely.! Very easy to overlook the case. Thanks SB Dev for pointing this out.

    Regards

  4. #19
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Re: Making a synchronous web request from UI thread.

    Quote Originally Posted by theothernt View Post
    And here's a tutorial on how to make a Splash Screen...

    http://www.geekchamp.com/articles/al...-splash-screen
    Here are a few more from the wiki: Custom_splash_screen_page_for_Windows_Phone_applications, Custom_splash_screen_with_progress_bar_for_Windows_Phone_applications

  5. #20
    Regular Contributor
    Join Date
    Dec 2012
    Posts
    66

    Re: Making a synchronous web request from UI thread.

    Hi Hamish,
    As the final answer there are two approaches for this problem.

    1. Use the approach i provided here here (for using a splash screen just replace "progress bar" display/hide logic with "splash/screen popup" display/hide logic in the answer.)
    2. Use async/wait directly on UI thread.

    But since async/wait functionality is natively available only on windows phone 8 you have to do some extra wprk for using async/wait on windows phone 7. Look here for info on using async/wait in windows phone 7.

    Regards,
    Vinay

  6. #21
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: Making a synchronous web request from UI thread.

    You can use async/await in Windows Phone 7.
    For Visual Studio 2010 use Async CTP Pack 3.
    For Visual Studio 2012 use Microsoft.Bcl.Async.

Similar Threads

  1. Replies: 3
    Last Post: 2009-08-20, 12:20
  2. how to reissue gprs request while making outgoing or incoming calls
    By ash_21 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2009-05-12, 12:38
  3. Making Multiple Thread
    By jitendra_bhuyan in forum Symbian
    Replies: 0
    Last Post: 2007-11-16, 16:10
  4. Making a http request
    By vooi1966 in forum Symbian
    Replies: 0
    Last Post: 2004-09-23, 03:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×