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.

Kinect for Windows is available !

kinect

Oh yeah, as announced by Steve Ballmer at CES, Kinect for Windows SDK is now available for download.

The Kinect for Windows SDK will allow developers to create applications supporting gesture and voice recognition on computers running Windows 7 , Windows Embedded Standard 7 and Windows 8 developer preview .

You can download the SDK from KinectWindows.com where you can find the system requirements and the installation instructions.

More details are available on the Kinect for Windows Blog.

Mary-Jo Foley has also written a post about the new features on the Kinect for Windows.

Hurry up ! Install the SDK and happy coding Sourire

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

From University to real life with love …

Before reading this post, you should probably forget about the love part.

 

I am a fresh graduate software engineer, I left university six months ago.

I was very exited to finally get rid of homeworks and exams, and be part of the real world.

Well, the real world is not really the world I had in mind…

I honestly think that those people who brag about how easy they got into their jobs are just liars.

It’s not easy because there are rules and you need time to understand those rules.

In  university, you are surrounded by colleagues who are probably  friends too, and your only commitement is to you and to your family. Your ultimate goal is to succeed.

But, your job is someone else business, and you are commited to that someone to deliver good quality projects and before the deadlines.

Your goal is to please your superior, who’s goal is to please his superior…to finally have a happy  boss.

Buttom of line, you don’t have friends at work, some of your colleagues might be but it’s a rare case. So be professional , use formal ways to communicate with them.

And make sure you do the work correctly. You should play by the rules.

I finally understand what is meant by “experience”. In a world where we see a totally new technology everyday, I think technical knowledge is not the primary metric to mesure experience.

Experience is to learn how to work as a team player, how to deal with stress and anger, how to be strong and how to live by the rules.

[Note]: I would like to thank my boss Bruno Walther who teached me lots of what I am talking about in my post.

[Update] : One of my friends , my editor-in-chief says : 

you know, your post feels like a pissimistic view of work in the “real life”

This is not the point, I do not mean to make you affraid of work.

You should enjoy and love your work, I am just saying that you should be ready and professional  Sourire

2011 in review

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 6,100 times in 2011. If it were a NYC subway train, it would take about 5 trips to carry that many people.

Click here to see the complete report.

Notifications & Metro Style apps in Windows8 : Local Toast

As explained in the previous post about notifications in Windows8, notifications can be local or from the Cloud ( push ) .

In this post, we will be discussing the local notifications.

Start a new project

       Visual Studio 11 Developer Preview –> New Project –> JavaScript –> Blank Application

open

Define the notification

      In the ‘js’ folder, let’s add a new item: a javascript file called toast.

js folder

      You should first choose a template for your toast, you can refer to Toast Template Type.

      Back to the toast.js where we will write the following code :

toast code

“This example uses the ToastImageAndText01 template, which consists of a large image with, to its right, a single string wrapped across three lines of text.

To specify the content, we retrieve the collection of text elements then enumerates through that collection, assigning a string to each of those elements . It then retrieves the image element and assigns it an image and alt text.” Windows dev center – Metro Style apps

See the toast in action

    We need to let the application send the toast.

    In the ‘ default.html’ file, add a reference to the toast script :

    script

 

Voila ! Quick and easy Sourire

Notifications & Metro Style apps in Windows 8: Introduction

Did you play around with the Windows Developer Preview ? If so, you did probably notice that tiles are the primary presentation of an app on the start screen.

In order to make the start screen feel vibrant and allow the user to see at a glance what’s new ( which is one of the main purposes of the metro style), you can add notifications to those tiles or use them separately.

There are three types of notifications :

Tile Notifications

tile notification

Those are the information and notifications that you can see directly through the tile.

Tiles updates use pre-defined templates, and can cycle between five tiles.

Toast Notifications

toast notification

“A toast notification is a transient message to the user that contains relevant, time-sensitive information and provides quick access the subject of that content in an app. It can appear whether you are in another app, the Start screen, or on the desktop. Toasts are an optional part of the app experience and are intended to be used only when your app is not the active foreground app.” Dev center – Metro style apps website

Toast notifications deliver transient messages outside the app to get the user’s attention immediately.

Badges

badge

It’s a summary or status information concerning the app notification, on the top of the tile.

It supports square and wide tiles.

start screen

All those notifications can be :

Local notifications

  • Used only when application is running.
  • Most useful for updating tiles and badges.

Scheduled notifications

  • for toast notifications to be running at a precise time.

Push notifications

  • Update tiles, show badges and raise toasts from the cloud.
  • Work even if the application is not running.

This post is an introduction, in the coming posts I will be writing about each kind of notifications and how to implement them.

Stay tuned Smile

Like this on Facebook 

Share on Facebook


Add this anywhere

Exploring Visual Studio11 Express for Windows Developer Preview

With the pre-beta version of Windows8 , Microsoft also released Visual Studio11 Developer Preview available to MSDN subscribers at first and public starting today.

 

So what’s new in VS11 ?

Visual Studio11 Express for Windows Developer Preview allows you to create different types of applications. Either you are a HTML and Javascrip ninja , C# / VB.Net guru or C++ master, VS11 Express is the IDE you need to create a “ Blow Mind” Metro Style applications .

supported languages

Javascript templates:

When you click on Javascript , you have multiple choice :

js

  • Blank Application : comes with default.html page containing a blank body, default.js page and a CSS style sheet.
  • Fixed Layout Application: it’s a Blank Application with fixed layout.
  • Grid Application: it’s a a “multi page project for navigating multiple layers of content with item details details displayed on dedicated page”. If you are familiar with Windows phone, that would probably look for you like panorama and pivot apps.
  • Navigation Application: it’s a Metro Style Application with navigation support.
  • Split Application: it’s a “ project for navigating among a master list of items while viewing their details on the same page

Visual C# / Visual Basic templates:

c#VB

  • Application : blank application
  • Grid Application : same thing as the javascript templates.
  • Split Application: same thing as the javascript templates.
  • Class Library: allows you to create class library useful in other Metro Style Applications.
  • Unit Test Library

Visual C++ templates:

c

  • WinRT Component DLL : helps you create Metro Style server DLL.
  • DirectX Application: allows you to create a blank Metro Style Application using DirectX.

 

That was a quick Visual Studio11 Express for Developer Preview walkthrough, more details coming in the next posts !

Stay Tuned Sourire

Silverlight 5 RC is finally available !

The latest Microsoft Silverlight RC version was released 1st September 2011. Now, you can freely download Silverlight 5 RC from here.

This release, other than the features already existing in the beta, contains new features like :

  • P/Invoke support for calling native functions.
  • 64 bit support .
  • DataContextChanged event.
  • In-Browser Trusted Applications.
  • PivotViewer Control.

And a lot more, you can read about the new features in Pete Brown’s Blog and the Technical Features document.

You want to know more about Silverlight 5 ? here are a series of posts related to Silverlight 5 RC and its new features :

 

More posts to come about Silverlight5 ! Stay Tuned Smile