I need you !

Microsoft France and the website siteduzero.com organizes a Windows Phone development contest. I proposed to the contest my new application: Western, it's a new cool game where you have to shoot the bad guys :)

To win the contest, I need a maximum of facebook like for the page  http://www.windowsphone.com/fr-FR/apps/b3e98240-2747-46a6-ae96-2d6479dd8ce7

To like the app, you have just to click on this shortcut :  

 

Thanks for your help !

HttpVerbs as string in the .net framework

If your are looking for the Http vers like GET, POST, ... as string in the .net framework, you will search it for a long time... because it does'nt exist !!! Don't ask me why...

Fortunately, you can grab this piece of code:

public class HttpVerbs
{
    public const string UNPARSED = "Unparsed";
    public const string UNKNOWN = "Unknown";
    public const string INVALID = "Invalid";
    public const string OPTIONS = "OPTIONS";
    public const string GET = "GET";
    public const string HEAD = "HEAD";
    public const string POST = "POST";
    public const string PUT = "PUT";
    public const string DELETE = "DELETE";
    public const string TRACE = "TRACE";
    public const string CONNECT = "CONNECT";
    public const string TRACK = "TRACK";
    public const string MOVE = "MOVE";
    public const string COPY = "COPY";
    public const string PROPFIND = "PROPFIND";
    public const string PROPPATCH = "PROPPATCH";
    public const string MKCOL = "MKCOL";
    public const string LOCK = "LOCK";
    public const string UNLOCK = "UNLOCK";
    public const string SEARCH = "SEARCH";
    public const string MAXIMUM = "Maximum";
}

Enjoy !

.NET 4.5 and ASP.NET MVC 4 in Windows Azure

If you are looking for how to deploy .NET 4.5 and ASP.NET MVC 4 in Windows Azure, you can follow the excellent work of Magnus Mårtensson on his blog:

http://www.magnusmartensson.com/post/2012/04/02/howto_put_net45_beta_and_aspnetmvc4_beta_on_windowsazure.aspx

E-Camp: OAuth - la clef de l'utilisation des réseaux sociaux dans votre application: Video disponible !

 

La video de l'E-Camp est disponible.

 Les slides et les sources des demos restent disponibles ici.

Send email from your Windows Azure

As you may be know, Windows Azure doesn't provide of any email service such as a smtp server or email web service. As workaround, you can found multiple solutions on the web (like using Office 365, installing your own smtp server, ...) but you propably did not know (like me :) ) that Microsoft as a partnership with sendgrid.

SendGrid offers 25.000 email per month for each Windows Azure subscriber !!!

You can find more informations here: http://www.windowsazure.com/en-us/develop/net/how-to-guides/sendgrid-email-service/

E-Camp: OAuth - la clef de l'utilisation des réseaux sociaux dans votre application: PowerPoint et sources disponibles !

Les sources et la présentation powerpoint de la session E-Camp "OAuth - la clef de l'utilisation des réseaux sociaux dans votre application" sont disponibles. Le webcast sera bienôt publié sur le portail MSDN.

 

 

Avant de pouvoir utiliser les démos, il vous faudra obtenir les tokens d'application auprès de Facebook / twitter / foursquare / .... Pour cela, rendez vous sur http://developer.facebook.com http://dev.twitter.comhttps://developer.foursquare.com/

La solution Visual Studio 2010 est disponible au téléchargement:Demo Fan2Donuts Techdays 2012.7z (2.95 mb)

 

Metro loading gif

If you are looking for an animated loading gif with metro theme. You can use this one !

Download it: animated_loader.gif (4.04 kb)

Include static JS / CSS / Images files from the IsolatedStorage in the WebBrowser control

Hi,

In your projet, you probably need to generate dynamicaly html, or to get html fragment from a web service and to display it in the WebBrowser control. In those cases, you would not load at any times the js, css or images from the network but you could include it in your application package (xap). To demonstrate how to do that, we will take an exemple that will get html code from a web service::

<div data-role='fieldcontain'>
 <fieldset data-role='controlgroup'>
  <legend>Do you agree to this request?</legend>
  <input type='checkbox' name='agree-1' id='agree-1' />
  <label for='agree-1'>I agree</label>
 </fieldset>
</div>

As you see, this html calls data-role from jquery Mobile. In our demo, we will include jqueryMobile js and css files in our xap package.

The fist step is to add your files in a directory, for exemple: html and to set the "Build Action" to "Content".

The next step, is to concat the html received from the WebService with the our html body. For that, we will write a method BuildHTML

public string BuildHTML(string htmlFromWS)
{
    StringBuilder html = new StringBuilder(@"<!DOCTYPE html>
                    <html class=""ui-mobile-rendering"">
                    <head>
                        <meta charset=""utf-8"" />
                        <meta name=""viewport"" content=""initial-scale=1.0; maximum-scale=1.0"" />
                        <link rel=""stylesheet"" type=""text/css"" href=""/html/jquery.mobile.structure-1.0.1.min.css"" />
                        <link rel=""stylesheet"" type=""text/css"" href=""/html/style.css"" />
                        <script type=""text/javascript"" src=""/html/jquery-1.7.1.min.js""></script>
                        <script type=""text/javascript"" src=""/html/jquery.mobile-1.0.1.min.js""></script>
                    </head>
                    <body style=""-webkit-user-select: none;"">
                        <div style=""padding:80px 0 0 0"" data-role=""page"">
                        <div data-role=""content"">");

    html.Append(htmlFromWS);
    html.Append("</div></div></body></html>");
    return html.ToString();
}

As you see, the css and the javascript is referenced with the url /html/... this means that the webbrowser will load the files from the isolatedstorage, with a relative Uri. Unfortunately, adding the files as Content in the solution, does'nt add them into the isolatedstorage. For that, we will write the method CopyContentToIsolatedStorage.

public static void CopyContentToIsolatedStorage(string file)
{
    // Obtain the virtual store for the application.
    IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();

    if (iso.FileExists(file))
        return;

    var fullDirectory = System.IO.Path.GetDirectoryName(file);
    if (!iso.DirectoryExists(fullDirectory))
        iso.CreateDirectory(fullDirectory);

    // Create a stream for the file in the installation folder.
    using (Stream input = Application.GetResourceStream(new Uri(file, UriKind.Relative)).Stream)
    {
        // Create a stream for the new file in isolated storage.
        using (IsolatedStorageFileStream output = iso.CreateFile(file))
        {
            // Initialize the buffer.
            byte[] readBuffer = new byte[4096];
            int bytesRead = -1;

            // Copy the file from the installation folder to isolated storage. 
            while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0)
            {
                output.Write(readBuffer, 0, bytesRead);
            }
        }
    }
}

and now, you can add these code in the beginning of you page:

CopyContentToIsolatedStorage("html/themes/images/ajax-loader.png");
CopyContentToIsolatedStorage("html/themes/images/icons-18-black.png");
CopyContentToIsolatedStorage("html/themes/images/icons-18-white.png");
CopyContentToIsolatedStorage("html/themes/images/icons-36-black.png");
CopyContentToIsolatedStorage("html/themes/images/icons-36-white.png");

CopyContentToIsolatedStorage("html/jquery-1.7.1.min.js");
CopyContentToIsolatedStorage("html/jquery.mobile-1.0.1.min.js");
CopyContentToIsolatedStorage("html/style.css");
CopyContentToIsolatedStorage("html/jquery.mobile.structure-1.0.1.min.css");

and then, we have just to concat the html and to send it to the WebBrowser control. But, be carefull, there is a tip, to force the WebBrowser to load the html and it's files ! You have to save an html file into the isolatedstorage in the root folder of your css/js files.

string htmlFromWS = ...;
// Concat our html
string html = BuildHTML(htmlFromWS);
var bytes = Encoding.UTF8.GetBytes(html);
// Get the iso store
IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();
// Write the html in the html/index.html
using (IsolatedStorageFileStream output = iso.CreateFile("html/index.html"))
{
    output.Write(bytes, 0, bytes.Length);
}
// navigate to the html/index.html
wb.Navigate(new Uri("html/index.html", UriKind.Relative));

 

And that's it, the WebBrowser control will load the css, js and your html from the isolatedstorage ! You can find the source code here : Demo.7z (87.66 kb)

Les slides et démos de ma session Techdays 2012

Bonjour,

Voici les slides et les démos de ma session sur les réseaux sociaux et les applications Windows Phone 7.

Avant de pouvoir utiliser les démos, il vous faudra obtenir les tokens d'application auprès de Facebook / twitter / foursquare / .... Pour cela, rendez vous sur http://developer.facebook.com, http://dev.twitter.comhttps://developer.foursquare.com/

La solution Visual Studio 2010 est disponible au téléchargement:Demo Fan2Donuts Techdays 2012.7z (2.95 mb)

Techdays 2012 - Live streaming

You can follow the keynote on live streaming tomorrow morning at 9h30( GMT+1).

Get Microsoft Silverlight

Hi there !

 

Specialized in .net technologies for many years, I am a technology fan in both asp.net and wpf/silverlight, using c# and .net 4.

Taking advantages of new opportunities offered by the Windows Azure platform and WP7, I develop applications for Windows 7 Phone, 2 of them are already available on the market place.


 

 

Month List