Alessandro Del Sole's Blog

/* A programming space about Microsoft® .NET® */
posts - 159, comments - 0, trackbacks - 0

My Links


Your host

This is me! This space is about Microsoft® .NET® and Microsoft® Visual Basic development. Enjoy! :-)

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.

Microsoft MVP

My MVP Profile

I'm a VB!

Watch my interview in Seattle

My new book on VB 2015!

Pre-order VB 2015 Unleashed Pre-order my new book "Visual Basic 2015 Unleashed". Click for more info!

My new book on LightSwitch!

Visual Studio LightSwitch Unleashed My book "Visual Studio LightSwitch Unleashed" is available. Click the cover!

Your visits

Follow me on Twitter!

CodePlex download Download my open-source projects from CodePlex!

Article Categories


Post Categories

.NET Framework


Help Authoring

Microsoft & MSDN

Setup & Deployment

Visual Basic 2005/2008/2010

giugno 2011 Blog Posts

Scaling code in Windows Phone 7 with the Thread Pool

Whichever technology you use to develop your applications, one sentence is always in your mind: don't block the UI thread. Of course this state of mind is important when you also build apps for Windows Phone 7. It is not unusual for a Windows Phone app to download information from the Internet and display long lists of data. Although the cpu in this kind of devices is quite fast, there are some factors that can bring negative performances, such as slowness of the internet connection, rendering long list of items with complex data templates and so on. So you need a...

posted @ giovedì 23 giugno 2011 15:54 | Feedback (0) | Filed Under [ Visual Basic ]

Using statement lambdas in Visual Basic with Windows Phone 7

I have written several apps for Windows Phone 7 with Visual Basic 2010, and I made an intensive usage of statement lambdas. Some of my apps require downloading RSS feeds from the Internet and this is accomplished by instantiating the WebClient class. For instance, consider the following code that retrieves some string content from the Internet and loads the content into an XDocument:          Dim wclient As New WebClient()            'The statement lambda is a replacement for AddressOf         AddHandler wclient.OpenReadCompleted, Sub(sender As Object, e As OpenReadCompletedEventArgs)                                                   If e.Error IsNot Nothing Then                                                       MessageBox.Show(e.Error.Message)                                                       RaiseEvent ErrorThrown()                                                       Exit Sub                                                   End If                                                   Dim str As IO.Stream = e.Result                                                   Dim xdoc As XDocument = XDocument.Load(str)                                                   ' Process your xdoc here...                                                   ' close                                                   str.Close()                                                   ' add results to listbox                                                   panoramaElement.DataContext = rssFeedsItems                                               End Sub         wclient.OpenReadAsync(rssUri) Instead of writing a dedicated event handler, I wrote a statement lambda directly in the AddHandler clause in place of the AddressOf pointing to a delegate. Also notice how the lambda receives arguments of the...

posted @ giovedì 23 giugno 2011 15:31 | Feedback (0) | Filed Under [ Visual Basic ]

Powered by:
Powered By Subtext Powered By ASP.NET