As I’ve explained before, I’ll be presenting 3 sessions during the next TechDays in France.

One of the session is entitled “Améliorer votre productivité XAML en entreprise” and we are currently working on it. If you plan to attend to our session (or to TechDays), we want to learn from you: we give you the opportunity to let us know what you want to see in the session !

If you have any particular needs or if you have some subjects that you want to see covered in the session, let me know (in a comment) and we’ll try do our best !

Thanks and don’t forget: if you plan to come in TechDays 2012, feel free to come to see me.

 

Happy coding!

Next month (7, 8 and 9 February), Microsoft France will organize the most important IT event of the year in the country: the Microsoft TechDays 2012 !

During the event, I’ll be presenting 3 sessions:

  1. WPF 4.5 : Quoi de neuf pour les développeurs ? (RDA105)
  2. MVVM de A à Z (RDA106)
  3. Améliorer votre productivité XAML en entreprise ! (RDA201)

If you are in Paris and attending the event, feel free to come to meet me and talk about WPF, Silverlight, Windows Phone and other XAML stuff !

 

See you there!

It’s a common usage, these days, to develop applications that allow users to access their personal data and Windows Live (documents, pictures, etc.) is a good example of the kind of data someone might want to access from everywhere.

Until now, developers needed to develop custom systems to access the data on the cloud, when it was possible. But thanks to Microsoft and it’s Live SDK, it’s possible to access any Windows Live data from Windows Phone or Windows 8 application (HTML or XAML).

First thing to do is to create Client ID for the application you want to develop. This ID will be used to authenticate your application and ensure that user can trust it. To create your Client ID, go to https://manage.dev.live.com and create an application (simply provide its name and its language):

image

Once the application is created, don’t forget to edit its settings to indicate that it’s a mobile app and not a desktop app:

image

Now, it’s start to develop the Windows Phone application. Add a reference to the 2 DLLs provided in the SDK (C:\Program Files (x86)\Microsoft SDKs\Live\v5.0\Windows Phone\References):

  1. Microsoft.Live.Controls.dll
  2. Microsoft.Live.dll

Now, in your XAML file, add the following code, which will provide you a button to allow users to connect to their Live account:

<Live:SignInButton ClientId="XXXXXXX"
                   Scopes="wl.basic wl.photos wl.skydrive wl.offline_access wl.signin wl.skydrive_update"
                   RedirectUri="http://oauth.live.com/desktop"
                   Branding="Skydrive"
                   TextType="SignIn"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   SessionChanged="OnSessionChanged" />

There are a lot of properties that you can changed (you can see the whole documentation here: http://msdn.microsoft.com/en-us/library/hh243650.aspx) but the most important are:

  1. ClientId: This is the number that you’ve generated in the first part
  2. Scopes: The list of “features” that your application will be allowed to manipulate. In our example, the application will get access to basic data, photos, Skydrive, ability to reconnect, etc.

In the code-behind, add the following code, used to be notified when the user is connected and then, get access to its name:

private void OnSessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
{
    if(e.Error == null)
    {
        if (e.Status == LiveConnectSessionStatus.Connected)
        {
            this._currentSession = e.Session;

            var client = new LiveConnectClient(this._currentSession);
            client.GetCompleted += (o, args) =>
            {
                if (args.Error == null)
                {
                    MessageBox.Show(Convert.ToString(args.Result["name"]));
                }
            };
            client.GetAsync("me");
        }
    }
}

Now, when user execute your application, it get a button he can use to log on Windows Live:

image image

Once logged in, a page display which data the application will be able to use:

image

Then, the user is authenticated and the code to retrieved its name is executed:

image

Of course, this sample is pretty simple and it’s possible to perform more complex task such as upload/downloading pictures, etc.

 

Feel free to take a look by yourself!

 

Happy coding!

In Windows Phone 7.1, there are 3 new events that can be used by developers to know when users press the buttons of the camera:

  1. CameraButtons.ShutterKeyHalfPressed
  2. CameraButtons.ShutterKeyPressed
  3. CameraButtons.ShutterKeyReleased

Using this events is really simple, as you can see in the following code:

private PhotoCamera _camera;

private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    CameraButtons.ShutterKeyHalfPressed += CameraButtons_ShutterKeyHalfPressed;
    CameraButtons.ShutterKeyPressed += CameraButtons_ShutterKeyPressed;
    CameraButtons.ShutterKeyReleased += CameraButtons_ShutterKeyReleased;
}

private void CameraButtons_ShutterKeyHalfPressed(object sender, EventArgs e)
{
    if (_camera != null)
    {
        _camera.Focus();
    }
}

private void CameraButtons_ShutterKeyPressed(object sender, EventArgs e)
{
    if (_camera != null)
    {
        _camera.CaptureImage();
    }
}

private void CameraButtons_ShutterKeyReleased(object sender, EventArgs e)
{
    if (_camera != null)
    {
        _camera.CancelFocus();
    }
}

Simple but very useful !

 

Happy coding!

With one of my colleague (and friend), Jonathan ANTOINE, we have just release a new book, in French, on the MVVM Pattern. It targets WPF, Silverlight and Windows Phone technologies.

clip_image001[6]

Its title is “MVVM, De la découverte à la maitrise” and aims to help developers to understand all the principles of the pattern. It is available as an eBook from our publisher: http://www.digitbooks.fr/catalogue/mvvm-antoine-lebrun.html but you can also order it as a paper book !

We hope you’ll appreciate it! Oh and, by the way, don’t hesitate to share the information if you like it!

Thanks and happy coding !

Bonjour à tous,

J’y pensais depuis un moment, c’est maintenant chose faîte ! J’ai décidé de changer de plateforme de blog pour me lancer dans ma “propre” aventure.

Les activités prévues au programme seront les mêmes que sur mon précédent blog à savoir WPF, Silverlight,  Windows Phone, etc. mais en essayant de varier les plaisirs de temps en temps et surtout, en essayant de retrouver une activité un peu plus dense.

Je tiens à remercier la communauté de CodeS-SourceS, et notamment Nix et Cyril, pour m’avoir hébergé durant toutes ces années !

Vous remarqerez que le design de ce blog n’est, pour le moment, pas tout à fait abouti: j’espère que cela changera rapidement (si d’ailleurs vous souhaitez me filer un coup de main sur la partie  design/logo, n’hésitez pas à me le faire savoir, je risque d’en avoir besoin !)

 

A bientôt pour la suite !