Month: February 2012

Visual Studio 11 Beta is now available

visual_studio_logo

Today is a big day event for the Microsoft community, but not only for the developers. Microsoft have released early this morning Windows 8 Consumer Preview and the Visual Studio 11 Developer Preview. I installed it today on the Samsung tablet Microsoft provided to the BUILD attendees in September 2011. I didn’t find out how to install directly Windows 8 from the USB key, so I had to start it from the previous Windows 8 and then remove the old Windows. The installation is very fast, in less than 30 minutes, no manual action, I was on the new Metro interface. Yes I say new, because the interface is a bit different than the previous public version, it seems more smooth, clear.

Download Windows 8 Consumer Preview.

The next step was to install Visual Studio 11. It was, at my astonishment, a very fast installation, considering that Expression Blend 5 is part of the package. The first impression is, wow! On the tablet Windows 8, the theme of Visual Studio is very bright, and I don’t think I’ll like to develop anything on it.

VS11 LightIf you go to the menu Tools | Options, in the Environment part, you can set the theme you want to use for your interface. Basically you can choose between Light and Dark (I hope we will be able to add more theme in the final version). Let’s try to use the dark theme:

VS11 Dark

It looks like Expression Blend. What do you think? Live me you feeling about this new design of the interface. I like the dark theme so far, but if you look at the Solution Explorer, the icons are not very easy to distinguish. But I guess after using it more and more I’ll get used to it.

SolutionExplorer

The last screenshot I would like to show you is the interface of Expression Blend 5 that is included in the installer of Visual Studio 11.

Blend5BBlend5A

Skype beta is available on Windows Phone

Today, Monday February 27th, is the first day of the Mobile World Congress (MWC) in Barcelona, Spain. Every mobile constructors, integrators, software developer company are presenting their new products. Nokia announced few new Windows Phone, the Lumia 610 and the Lumia 900.

 

Microsoft presented the official application Skype beta for Windows Phone 7! The final release is planned for April of this year.

 Skype-5 Skype-4 Skype-3 Skype-2 Skype-1

 

 

Windows Phone SDK 7.1.1 Update CTP

Windows Phone logo

Microsoft has published yesterday an update for the Windows Phone SDK. This package contains an update for the current emulator, and a new one for the future Tango version of Windows Phone. Just a reminder, the Tango update will permit to have devices with less memory and features to get a very low cost than the high-end phones. So this emulator will allow you to test your applications for the 256MB Windows Phone devices.

This version does not contain the GO LIVE license, so it is forbidden to publish applications using this SDK!

Download the Windows Phone SDK 7.1.1 Update CTP.

Take a screenshot of a FrameworkElement on Windows Phone 7

Windows Phone logoIn my application Earthquakes, if you try it (and I’m sure you already did 🙂 ) you probably noticed that you can take a screenshot of the application and send it by email, by text… Anyway, it is not very tricky to take a screenshot on the current page in Windows Phone 7. Here is the code.

String tempJpeg = "TempJPEG.jpg";

try {
    // Capture the screen (this) and apply no transformation<>  WriteableBitmap bmp = new WriteableBitmap(this, null);

    // Get a virtual store file to temporarily store the image var store = IsolatedStorageFile.GetUserStoreForApplication();
    if (store.FileExists(tempJpeg))
        store.DeleteFile(tempJpeg);

    // Create the file in the store     IsolatedStorageFileStream myFileStream = myStore.CreateFile(tempJpeg);

    // Save the WriteableBitmap into JPEG stream and place into isolated storage file. bmp.SaveJpeg(myFileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
    myFileStream.Close();

    // Create a new file stream. myFileStream = myStore.OpenFile(tempJpeg, FileMode.Open, FileAccess.Read);

    // Put the JPEG file to the photos library on the device. using (MediaLibrary library = new MediaLibrary())
    {
        library.SavePicture("image.jpg", myFileStream);
    }
    myFileStream.Close();
}
catch (Exception) { }

If you want to save only a FrameworkElement instead of the whole page, you can just change this in the first line and use the object you want.

However, a user of the application (thanks to him) noticed a big issue with in my application. If you use the light theme and try to take a screenshot to share, the screenshot appears to be black with only the Bing map. All the text disappears. The problem is that the background of the PhoneApplicationPage is not used in the render of the bitmap, Black is used instead. So in order to fix this problem, you have to define the background on your main container, in the example below I define the Background on the Grid and use the resource PhoneBackgroundBrush.

<phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            x:Class="Demo.Screenshot"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            mc:Ignorable="d"
                            d:DesignHeight="696"
                            d:DesignWidth="480"
                            shell:SystemTray.IsVisible="True">

    <!-- You must define here the background with the resource PhoneBackgroundBrush instead of Transparent -->
    <Grid Background="{StaticResource PhoneBackgroundBrush}">

    </Grid>

</phone:PhoneApplicationPage>

And after that, it works very well!

Wp7EarthquakeLight Wp7EarthquakeDark

Now, please try Earthquakes for Windows Phone 7, it’s free!

 

Windows Phone 7 Applications Requests

Windows Phone logo

Around me, a lot of people complain about Windows Phone 7 and its lack of applications if you compare to the iPhone AppStore or the Android Market. In order to help to change that, the Microsoft MVP Scott Dorman has created a forum on UserVoice to list all applications that will be great to have on the Microsoft Market Place. There are 60,000 applications available today for the Windows Phone 7, it’s nothing compare to the 725,000 available on the Apple AppStore (source Wikipedia), and the 400,000 on the Android Market (source Wikipedia). This website will help companies to see the need of an application for the Microsoft mobile OS, but also for the developers without idea (like I am…).

I suggest that you have a look at the Marketplace Requests website today.

image_7

Codeplex OAuth providers for .NET Framework 4.0 and Windows Phone 7

File:Oauth logo.svg

The project

I started few weeks ago, a new project that allows me to do trading using the APIs provided by E*Trade. The authorization system used is OAuth. My first idea was to create a Windows Phone 7 application for E*Trade, what I started to do. Did you already try to debug web services that you don’t control? Especially when the documentation is not very good. When you send a bad request to the server, you always get the same answer:  The remote server returned an error: NotFound. But what does it mean? Basically everything. That’s why I created a new WPF project to have the full .NET Framework in order to get more information and help me to debug the Web service calls.

What libraries I use

I’m using the Reactive Extensions (Rx) to “wrap” my asynchronous event into observable objects. Then, because E*Trade APIs are based on OAuth protocol for the authorization of the users, I needed an library that helps me to send queries to the server. I’m using the project ReactiveOAuth because it is one of the best I found. I just had to use the source code and modify it, because it was originally created for Twitter, and it seems that every single OAuth provider does not respect the standards.

What’s next

I decided to publish the full source code of my project via CodePlex under the name OAuth Providers. I currently published an updated version of ReactiveOAuth and a basic SDK for E*Trade. I also included an example using WPF that connect to E*Trade and download some stocks information. I’ll publish soon an update of the SDK that will contain more API support.

My next objective is to publish more and more SDK for OAuth providers like Twitter, Facebook, LinkedIn, Foursquare…

Download the SDK