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

marzo 2013 Blog Posts

Retrieving RSS feeds for Twitter and Facebook

You might need to analyze RSS feeds from different pages in order to get information and latest news from a channel. Facebook and Twitter are probably the most interesting, but there's no easy specific API. Fortunately it is possible to retrieve the RSS feed 2.0, that is XML, in a pretty easy way. The following URL allows retrieving the RSS feed of a Facebook page (not user profile): Where pageidnumber is the id of the desired page. For instance, the Facebook address for my VB community in Italy is the following: About Twitter, you can retrieve a feed like this: Where username is the account name of the person...

posted @ giovedì 14 marzo 2013 10:32 | Feedback (0) | Filed Under [ Misc ]

Windows Phone: picking up contacts in code

In Windows Phone apps, you can easily pick up contacts from the contact list in code. You simply need to use a chooser called Microsoft.Phone.Tasks.AddressChooserTask. You define an instance:     Private contattoSelezionato As String     Dim WithEvents addressChooser As AddressChooserTask     Public Sub New()         InitializeComponent()         Me.addressChooser = New AddressChooserTask    End Sub Then you invoke Show to start the chooser: addressChooser.Show() To determine the returned contact, you handle the Completed event and you read the value only if the user has confirmed her choice (the TaskResult.OK value from the TaskResult enum):     Private Sub addressChooser_Completed(sender As Object, e As AddressResult) Handles addressChooser.Completed         If e.TaskResult = TaskResult.OK Then             Me.contattoSelezionato = e.DisplayName         End If     End Sub Other than the DisplayName you can also retrieve the Address , which is actually the value that determines the difference between contacts with the same name or between elements belonging to the same contact. Alessandro

posted @ giovedì 14 marzo 2013 10:25 | Feedback (0) | Filed Under [ Silverlight/Windows Phone ]

A VS2012 extension to use the WinRT APIs in desktop apps

Anyone who has ever built for Windows 8 and the Windows Runtime probably wondered how it is possible to use WinRT in desktop applications. Even though with some limitations, this is possible and requires some manual steps so that a project can reference Windows 8's libraries. Lucian Wischik  has published an interesting extension for Visual Studio 2012, which adds a Console app project template which is ready to take advantage of WinRT. Such an extension is available from the Visual Studio Gallery at this address, where you will also find hints for the usage. Lucian has also published an article on CodeProject, where he provides detailed information about this scenario. Remember that...

posted @ giovedì 14 marzo 2013 10:20 | Feedback (0) | Filed Under [ Windows 8 & WinRT Visual Studio 2012 ]

WinRT: ho to solve if ListView and GridView lose their way

In a Windows Store App I've been working on, I had to face a particular problem. It is a problem that can randomly occur with the GridView and ListView controls and it probably depends on the DataTemplate you use. Consider the following GridView:                 <GridView Name="MyView" ItemsSource="{Binding}" Margin="0,15,0,0" HorizontalAlignment="Left">                     <GridView.ItemTemplate>                         <DataTemplate>                             <!-- custom DataTemplate -->                         </DataTemplate>                     </GridView.ItemTemplate>                 </GridView> In this page I have this object; then I navigate to a secondary page. From the secondary page, I navigate back to the page where I have the GridView. As a result, instead of showing items horizontally (as required), the control shows them vertically losing the original orientation. I searched on the Internet but the only one taling about...

posted @ giovedì 14 marzo 2013 10:14 | Feedback (0) | Filed Under [ Windows 8 & WinRT ]

Playing media contents in loop with the MediaElement control

The MediaElement control is used to play media contents in Technologies like WPF, Silverlight, WinRT and Windows Phone. You might have the need to play a content forever, with a loop. A very easy way to accomplish this is Handling the MediaEnded and restart from there. For example, we declare a boolean variable to store the loop state (enabled/disabled): Private isLoop As Boolean = False This can be useful if we associate the state of the loop to a button, which is just responsible to change its value:     Private Sub LoopButton_Click(sender As Object, e As EventArgs)         isLoop = Not isLoop     End Sub Somewhere else we'll start playing the content; the important thing is how we handle the event, like in the following example:     Private Sub Media1_MediaEnded(sender As Object, e As RoutedEventArgs) Handles Media1.MediaEnded         If isLoop = True Then             Me.Media1.Position = New TimeSpan(0)             Me.Media1.Play()         End If     End Sub Basically the code...

posted @ giovedì 14 marzo 2013 10:04 | Feedback (0) | Filed Under [ Silverlight/Windows Phone Windows Presentation Foundation Windows 8 & WinRT ]

My first eBook: "Hidden WPF"

A few days ago, we have released my first eBook called "Hidden WPF: Secrets for creating great applications in WPF": Published by InformIT (the online division of my publisher SAMS/Pearson), this is a different publication. It's a very small book, 99 pages, produced and thought for mobile devices. Here you will find tons of tips & tricks, suggestions, and real world implementations that I collected in my daily work, building applications with Windows Presentation Foundation. Price is $ 7,99. You will find many info about working with PDF and XPS documents, suggestions to get the most out of the Visual Studio IDE with WPF, enhancing...

posted @ giovedì 14 marzo 2013 09:58 | Feedback (0) | Filed Under [ Windows Presentation Foundation ]

Windows Phone: the SaveAppointmentTask class

The Windows Phone 8 SDK introduces new launchers, which are tasks on the phone that you can interact with via managed code. Among the Others, the new Microsoft.Phone.Tasks.SaveAppointmentTask class allows saving an appointment in the calendar or an activity in the specified time interval. For instance, the following code creates an appointment in the calendar:         Dim appointmentTask As New SaveAppointmentTask         With appointmentTask             .AppointmentStatus = Microsoft.Phone.UserData.AppointmentStatus.OutOfOffice             .Details = "Going on vacations"             .StartTime = New Date(2013, 7, 1)             .EndTime = New Date(2013, 7, 18)             .Location = "Seaside"             .Reminder = Reminder.OneDay             .Subject = "I'm not available"             .Show()         End With Properties are pretty self-explanatory, in particular focus on the AppointmentStatus one which allows chosing how we should appear to our contacts, by selecting a value from the Microsoft.Phone.UserData.AppointmentStatus. We can chose among OutOfOffice, Busy, Free, Tentative . The Reminder property instead allows selecting a...

posted @ giovedì 14 marzo 2013 09:50 | Feedback (0) | Filed Under [ Silverlight/Windows Phone ]

Powered by:
Powered By Subtext Powered By ASP.NET