Category Archives: WP7

Windows Live SDK for Windows Phone: Calendaring #1

Windows Phone 7.5 codenamed Mango brought with it lots of new features.

One of the remarkable features is the “ Calendar & ToDos”.

On september 27th, 2011, pocketnow.com published a very detailed post about Mango’s new features.

Here is the video previewing what you can do with the calendar:

“ Tasks are back!! Not only do Exchange tasks now sync with the “To-Do’s” tab with-in the Calendar, but now Windows Live Hotmail To-Do’s sync there as well. Windows Live’s To-Do’s list never used to sync with anything. It seems strange to call them “Todos” since Outlook calls them tasks, but whatever… at least you can see, edit, and manage the things you have to do at work and in your personal life. Most other smartphones still don’t sync Exchange tasks, and it’s great to see this feature back in Windows Phone… and in full force with Windows Live Hotmail.”

However, not everything related to a consumer’s Live profile is available on the phone natively. So Microsoft released a new Windows Live SDK which allows access to Calendars, Contacts, Documents, and more.

In previous posts, we discussed how to use Skydrive in Windows Phone applications.

This time , we will see how to use the calendar.

As mentioned in MSDN, “ The Calendar object contains info about a user’s Hotmail calendar. The Live Connect REST API supports creating, reading, updating, and deleting calendars. Use the wl.calendars scope to read a user’s Calendar objects. Use the wl.calendars_update scope to create Calendar objects for a user. Use the wl.contacts_calendars scope to read a user’s friends’ Calendar objects.”

So before digging deeper in the code and in the case you did not install the necessary tools, here is what you need:

In the next post, we will learn how to read the calendar.

Stay Tuned Sourire

Advertisements

Using Skydrive in your Windows Phone applications: part2

This is part two on how to use Skydrive in your Windows Phone applications.  Part one was an introduction to how to sign in into Skydrive.

In this part, let’s try to read the Skydrive’s folders.

I will use the ApplicationBarIconButton to read from my Skydrive then put the result in a very simple list in another page.

So first, let’s create a new Windows Phone page , I’ll call it “ content.xaml”.

I’ll change the Application title to “ Skydrive” and the page title to “ Folders”. I will also add a listbox.

 1:
 2:         <!--TitlePanel contains the name of the application and page title-->
 3:         <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
 4:             <TextBlock x:Name="ApplicationTitle" Text="Skydrive" Style="{StaticResource PhoneTextNormalStyle}"/>
 5:             <TextBlock x:Name="PageTitle" Text="Folders" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
 6:         </StackPanel>
 7:
 8:         <!--ContentPanel - place additional content here-->
 9:         <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
 10:             <ListBox Name="list">
 11:                 <ListBox.ItemTemplate>
 12:                     <DataTemplate>
 13:                         <StackPanel Orientation="Horizontal">
 14:                             <TextBlock Name="folder" Text="{Binding Name}"/>
 15:                         </StackPanel>
 16:                     </DataTemplate>
 17:                 </ListBox.ItemTemplate>
 18:
 19:             </ListBox>
 20:         </Grid>

Now we need to fill that listBox.

In the MainPage.xaml, let’s add an ApplicationBarIconButton ( it is already there as a commented code):

 1: <phone:PhoneApplicationPage.ApplicationBar>
 2:        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
 3:            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Read " Click="ApplicationBarIconButton_Click" />
 4:        </shell:ApplicationBar>
 5:    </phone:PhoneApplicationPage.ApplicationBar>
 6: /phone:PhoneApplicationPage>

When you click on the button , you should be able to get your content from Skydrive if you are signed in and see it on that listbox we put in “content.xaml”

 1: private void ApplicationBarIconButton_Click(object sender, EventArgs e)
 2:        {
 3:            if (session == null)
 4:            {
 5:                infoTextBlock.Text = "You must sign in first.";
 6:            }
 7:            else
 8:            {
 9:                LiveConnectClient client = new LiveConnectClient(session);
 10:                client.GetCompleted +=
 11:                    new EventHandler<LiveOperationCompletedEventArgs>(getFolderProperties_Completed);
 12:                client.GetAsync("/me/skydrive/files");
 13:            }
 14:
 15:        }
 16:
 17:        void getFolderProperties_Completed(object sender, LiveOperationCompletedEventArgs e)
 18:        {
 19:            if (e.Error == null)
 20:            {
 21:                List<object> data = (List<object>)e.Result["data"];
 22:                foreach (IDictionary<string, object> content in data)
 23:                {
 24:                    SkyDriveContent skyContent = new SkyDriveContent();
 25:                    skyContent.Name = (string)content["name"];
 26:                    ContentList.Add(skyContent);
 27:                }
 28:                this.NavigationService.Navigate(new Uri("/content.xaml", UriKind.Relative));
 29:            }
 30:            else
 31:            {
 32:                infoTextBlock.Text = "Error calling API: " + e.Error.Message;
 33:            }
 34:
 35:        }

The result is stored in a “ SkydriveContent “ list :

 1: public static List<SkyDriveContent> ContentList = new List<SkyDriveContent>();

 

 1: public class SkyDriveContent
 2:    {   public string Name { get; set; }
 3:        public string Description { get; set; }
 4:    }

In the Content.xaml.cs , we will tell the listbox to get its items from the ContentList:

 1: public content()
 2:        {
 3:            InitializeComponent();
 4:            list.ItemsSource = MainPage.ContentList;
 5:        }

That is all you need to be able to read your Skydrive folders in your Windows Phone application.

There is also an interesting and helpful post in Silverlight Show by Samidip Basu about the usage of Skydrive with Windows Phone.

Using SkyDrive in your Windows Phone applications: part 1

Introduction

In case you don’t know what is Skydrive, on Wikipedia you will find that “ Windows Live SkyDrive, initially called Windows Live Folders, is a free-of-charge file hosting service that allows users to upload files to a cloud storage and then access them from a Web browser.”

that was true before the BUILD. Now, Microsoft released an SDK that enables us to write  third party applications running on Windows 7, Windows Developer Preview and Windows Phone, that interact with the whole Live services, SkyDrive among them in different languages : JavaScript, C# and REST.

It also released its official Skydrive application for both Windows Phone and iOS.

Get Ready

First of all you have to download ans install the Live SDK v5.0 . You would probably need to use the Live Interactive SDK to explore the APIs and learn how to use them.

The Live Connect should recognize your application, that’s why you should go to Live Connect App Management site and create a new app.

create

You will get a Client ID and Client Secret that you will be using later with your application.

clientbis

Demo : Sign In

Let’s see how it works now:

Create a Windows Phone Application and make sure to add the following references:

references

You should also add the SignIn Button to your toolbox :

toolbox

In the main page, the user should sign in :

Main

 1: <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
 2:             <TextBlock Height="55" HorizontalAlignment="Left" Margin="54,113,0,0"
 3:                        Name="textBlock1" Text="Please sign in to access your Skydrive"
 4:                        VerticalAlignment="Top" Width="336" />
 5:             <my:SignInButton Content="Button" ClientId="Your_Client_ID"
 6:                              Scopes="wl.signin wl.basic " Branding="Windows" SessionChanged="signInButton1_SessionChanged"
 7:                              Height="72" HorizontalAlignment="Left" Margin="138,268,0,0"
 8:                              Name="signInButton1" VerticalAlignment="Top" Width="160" />
 9:             <TextBlock Height="32" HorizontalAlignment="Left" Margin="12,372,0,0" Name="infoTextBlock" Text=""
 10:                        VerticalAlignment="Top" Width="419" />
 11:
 12:         </Grid>

In the MainPage.xaml, I added a SingInButton control, You should put your own Client ID. I only used wl.signin and wl.basic scopes at this point.

wl.basic : Allows access to a user’s basic info, such as his or her Hotmail contact list.

wl.signin : Allows user’s log in .

The “infoTextBlock “ will indicate either the user is signed in or not. That will be handled in the C# code.

 1: private void signInButton1_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
 2:         {
 3:             if (e.Status == LiveConnectSessionStatus.Connected)
 4:             {
 5:                 session = e.Session;
 6:                 client = new LiveConnectClient(session);
 7:                 infoTextBlock.Text = "Signed in.";
 8:             }
 9:             else
 10:             {
 11:                 infoTextBlock.Text = "Not signed in.";
 12:                 client = null;
 13:             }
 14:
 15:         }

Run the application , hit the sign in button and you should get this screen:

sign in

Summary

In this first part, we grabbed the tools and SDK needed in order to use Skydrive in our Windows Phone applications.

Then we learnt how to sign in into Skydrive storage without writing any code.

In part two, we will learn how to read/insert files into Skydrive. Stay Tuned Sourire

Windows Phone: From Where To Start ?

Windows Phone is attracting Lots of developers who want to start working with . And since I’ am getting this question alot ” What resources do you think I should start with in order to learn about Windows Phone?” , I have decided to collect some useful links and share them with you 🙂

You can also refer to some blogs :

Now, some people to follow on Twitter:

And finally, the best advice ever is : USE YOUR SEARCH ENGINE ! 😉

Mango – Baby Steps: Creating your first application

Mango – baby steps are a serie of posts to learn about Windows Phone 7.1 and you probably know that if you read the first post aiming to help you to set up the environment and know the requirements in order to start writing some rocking code.

Now everything is set , let’s start coding !!!!!

Open a new project

In visual Studio , from the menu in the top, click : File –> New –> Project

When you choose Silverlight for Windows Phone from the installed templates, you will get this window :

As you can notice, you have multiple choices:

  • Windows Phone Application : Generates a basic application with a single start page and header.
  • Windows Phone Databound Application: Generates an application in a Model/View/ViewModel (MVVM) style, with sample data exposed in ViewModel classes.
  • Windows Phone Class Library:  Enables you to create a collection of controls that you can reuse across several projects.
  • Windows phone Panorama Application: This template creates an application with the Panorama Control, which provides a multipage view of options with a parallax scrolling background.
  • Windows Phone Pivot Application:  The Pivot control is much like a Tab Control, but tuned for a gesture-based interface. This template creates an application with the Pivot as its primary navigation.
  • Windows Phone 3D Graphics Application: the application type used to invoke XNA content from a Silverlight application. The idea behind this application is to have a pre-built XAML page that has a game loop and that is calling an included XNA project. This can be considered a pure demo of Silverlight-XNA interop.
  • Windows Phone Audio Playback Agent: a non-UI project time that creates a class based on AudioPlayerAgent. Consider this some sort of a class library, but that will later be tied to a BackgroundAudioPlayer to handle custom events.
  • Windows Phone Audio PStreaming Agent: similar to the audio playback agent, this project is used to create a class that will be used with an application that implements a streaming mechanism coupled with a background player.
  • Windows Phone Task Scheduler Agent: a project that will create a class based on ScheduledTaskAgent that will allow developers to handle task invocation events for existing scheduled tasks.

Since it’s our first application, we will choose a simple Windows Phone Application template and call it ” Hello Mango”. Make sure you select ” Windows Phone 7.1″ version.

Add some controls to the application

Now that the project is created, we will get this window:

That doesn’t look so nice :S

We will change the application and page titles :

Before

After

In the XAML code, i changed :

  •  the text of the textblock named ” Application Title” from ” Application title” to ” Hello Mango” .
  • the text of the textblock named ” Page title” from ” page title” to ” Home page” .

Let’s add the Mango picture to the page:

In the  solution explorer, right click on the project : add –>  existing item

Then browse the location where you saved the image, selected and click add.

from the toolbox, drag and drop an ” image” control to the phone interface :

In order to see the image we added to the project, we need to give the “image” control a ” source” , to specify the path of the image to be visualized.

Run the application in the Emulator

Now let’s see the app in action and discover the emulator new features.

The Mango’s new emulator has some additional tools like the accelometer and location:

This is a first example, it aims to explain the templates and explore the elements in the window.

Please feel free to comment and give me your feedback 🙂

Mango-Baby Steps: Setting up the Environment

In my previous post , I wrote about Mango , its new features and the new capabilities for developers.

This time I will explore the Mango features and share what I ‘m learning with you 🙂

The Mango- Baby Steps are a serie of posts where we will learn EVERYTHING about Windows Phone 7.1 starting from setting up the environment till creating an app with the new live tiles and background agents …

Ready ? Let’s go

Mango is not available on phones yet so you can’t submit applications targeting Windows Phone 7.1 OS to the Marketplace . If you are interested in submitting apps to the Marketplace you should work with Windows Phone 7.0 .

System requirements

First you should know that  virtual machines, Windows Server and Windows XP are not supported !

You should have a Windows 7 (x86 / x64) or a Windows Vista (x86 / x64) with service pack 2 on your machine except Starter edition ( W7 or Vista) ,  4GB of free disk space on the system drive and  3 GB RAM to be able to have Mango.

Installation prerequisites

  • You don’t have Visual Studio on your machine !! No problem , you still can install the Windows Phone Developer Tools 7.1 Beta . Visual Studio 2010 Express for Windows Phone will be installed as part of the tools.
  • You can use Visual Studio Professional edition or higher ,if it’s already installed, after installing Windows Phone Developer Tools 7.1 Beta .
  • If you have Visual Studio RTM installed, you must install Service Pack 1 RTM before installing Windows Phone Developer Tools 7.1 Beta .
  • If you installed Visual Basic for Windows Phone Developer Tools 7.0 , you must uninstall it before having the Tools 7.1 Beta .
  • If you have a localized version of Windows Phone Developer Tools 7.0 installed, you must uninstall it before installing Windows Phone Developer Tools 7.1 Beta.
  • If you have a localized version of Expression Blend installed, you must uninstall it before installing Windows Phone Developer Tools 7.1 Beta.

Installation

System Requirements …checked ! Installation prerequisites…checked ! Time to install the Windows Phone Developer Tools 7.1 Beta 😀

you need to :

Easy !!! I know 🙂

Now to make sure that everything just went smooth , when you create a new Windows Phone application you should have those templates:

Congratulations Windows Phone Developer Tools 7.1 Beta is successfully installed on your machine 🙂

Digest Mango

If you are reading this post because you love eating Mango !! Sorry , wrong blog -_-

Mango is the codename for the new Windows Phone and you can call it also Windows Phone 7.1 .

Users have to wait for Mango, Joe Belfiore , Microsoft vice president and director of Windows Phone program Management, said that Mango will be available in fall 2011 and developers will probably get the Mango update in a month ! Yeahhh just another 4 weeks 😀

But you can test and explore the new Mango features ! The beta Windows Phone 7.1 developer tools were released on 24 May 2011 and you can download them from here .

Mango offers lots of new capabilities for developers , you can experience all the new developer features with the offline training course and the pre-release documentation .

Microsoft said that Mango contains about 500 new feature !!!! Let’s see the most important features:

  • Windows Live Messenger and Facebook chat integration.
  • Twitter , LinkedIn and Viadeo integration in the people hub.
  • Outlook tasks support.
  • Office 365 support with Skydrive and Sharepoint integration.
  • Microsoft Lync support.
  • Video uploads to Facebook.
  • Support for HTML5 video playback.
  • IE9 for Windows Phone.
  • 16 new languages supported

and more and more features , i will let you discover them by yourselves.

You probably want to take a look to those links for  a better digestion to Mango :

 

I hope that was helpful , more to come about Mango 🙂

 

If ,like me, you are going to take the WP7 beta exam

The beta exam 71-599 : Pro: Designing and Developing Windows Phone 7 Applications is finally available.

This beta aims to provide the Microsoft Certification Program with feedback about the content in order to improve it.

71-599: Pro: Designing and Developing Windows Phone 7 Applications counts as credit towards the following certification(s).

  • Microsoft Certified Professional Developer: Windows Phone 7, Developer

Registration for the beta exam 71-599 started March 29,2011 and the exam period runs April 19, 2011 – May 04, 2011

The Skills measured in this exam are:

*Designing Data Access Strategies (19%).

*Designing and Implementing Notification Strategies (17%).

*Working with Platform APIs, Tasks, and Choosers (21%).

*Designing the Application Architecture (21%).

*Designing the User Interface and User Experience (23%).

I decided to take the exam and i did registered for it, but then i start to wonder how to study and what materiels to use ?????? :S

And thanks to Twitter and Friends , i have now some good resources to start studying that i’m going to share with you : here you can find a serie of posts about the skills being measured in the exam. You can also take a look to the WP7 JumpStart on Channel 9 and read some books too ( Silverlight unleashed, Silverlight4 Data & Services Cookbook …)

Hurry up ! Register for the exam and start studying 🙂

Windows Phone announcements in the Mobile World Congress

Today at the Mobile World Congress, Microsoft CEO Steve Ballmer and Windows Phone Director Joe Belfiore revealed the Windows Phone’s features coming later this Year .

We heard a lot of rumors about updates coming on 2011 , mainly the copy and paste update . It was supposed to come on January 2011 but nothing till now. Today, they announced that it will arrive in the first two weeks of March.

besides the copy and paste update, the headline features of this update are Multitasking support for third party applications , a new Web browser based on Internet Explorer 9 and  Twitter will be part of the people hub.

One major big announce concerning Windows Phone also is the new partnership beetween Microsoft and Nokia . WP7 will be the main OS for Nokia’s mobile devices.

Cheer up Windows Phone developers 🙂

Windows Phone 7 for beginners #workshop1

Today i started with the first workshop about Windows phone 7 for DotNet+ Club in the Faculty of Sciences of Tunis.

As my audience is mainly students , some of them don’t know too much about Microsoft Technologies, I decided not to go deeper with development and focus on a WP7 overview.

My talk was devided into 5 parts:

1- Philosophy behind the WP7

2- The Design

3- The Experience

4- The Platform

5- Hello-WP7 Demo

You can find the slides and Demo  here.