Blog Archives

The Windows Phone 7.8 Update

windows-phone-7.8-start-screen

The Windows phone summit just ended a few hours ago. As expected the summit was dedicated to present Microsoft’s new Windows Phone OS : the Windows Phone 8.

Like many of you out there, I was so excited about the summit and I wanted to know about the new features in Windows Phone8 , but  I also wanted to know if the current windows phone devices would be upgraded to WP8 ? The answer is no .

Greg Sullivan explained that the reason behind this decision is the HARDWARE .He said:  “ the nature of the investment [in Windows Phone 8] is primarily in areas that are not exploitable by existing hardware.”

But the current devices will get another update , it is the Windows Phone 7.8.

Basically, Windows Phone 7.8 is a Windows Phone 8 without the hardware part. It will have  the new start screen with the customizable tiles. Tiles will have three sizes just like in Windows Phone 8 . It is up to the user to choose the size that suits him best. Tiles will also have new colors.

Although it is very realistic that the current devices will not be upgraded to Windows Phone 8 because of the hardware’s big changes , users ( at least those on my Twitter Timeline ) aren’t very happy with  the  fact that they will have to get new devices if they want to have the Windows Phone 8 ,  especially those who have Nokia Lumia 900 phones.

Cheer up Windows Phone users , you will have nearly the same experience as the Windows Phone 8 Clignement d'œil

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