<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tom&#039;s Blog</title>
	<atom:link href="http://blog.thomaslebrun.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thomaslebrun.net</link>
	<description>&#34;They did not know it was impossible, so they did it !&#34; - Mark Twain</description>
	<lastBuildDate>Mon, 06 May 2013 08:20:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>[Windows 8] How to launch an app using NFC tags?</title>
		<link>http://blog.thomaslebrun.net/2013/05/windows-8-how-to-launch-an-app-using-nfc-tags/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-how-to-launch-an-app-using-nfc-tags</link>
		<comments>http://blog.thomaslebrun.net/2013/05/windows-8-how-to-launch-an-app-using-nfc-tags/#comments</comments>
		<pubDate>Mon, 06 May 2013 08:20:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/05/windows-8-how-to-launch-an-app-using-nfc-tags/</guid>
		<description><![CDATA[Here is a quick (but quite useful) tip for anyone who want to use NFC tags on its application. NFC tags can be used on Windows (Phone) to open Internet links but they can also be used to open a particular application on your system. For that, you just need to use/create a LaunchApp message &#8230; <a href="http://blog.thomaslebrun.net/2013/05/windows-8-how-to-launch-an-app-using-nfc-tags/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a quick (but quite useful) tip for anyone who want to use NFC tags on its application.</p>
<p>NFC tags can be used on Windows (Phone) to open Internet links but they can also be used to open a particular application on your system.</p>
<p>For that, you just need to use/create a LaunchApp message that will be written on the tag:</p>
<pre class="csharpcode">var proximityDevice = Windows.Networking.Proximity.ProximityDevice.getDefault();
<span class="kwrd">if</span> (proximityDevice) {
    proximityDevice.ondevicearrived = function(device) {
        var launchArgs = <span class="str">"user=Thomas LEBRUN"</span>;

        <span class="rem">// Package.manifest -&gt; View XML Source -&gt; &lt;Application Id="..."&gt;</span>
        var appId = <span class="str">"App"</span>;

        var appName = Windows.ApplicationModel.Package.current.id.familyName + <span class="str">"!"</span> + appId;

        var launchAppArgs = launchArgs + <span class="str">"\tWindows\t"</span> + appName;

        var dataWriter = <span class="kwrd">new</span> Windows.Storage.Streams.DataWriter();
        dataWriter.unicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.utf16LE;
        dataWriter.writeString(launchAppArgs);

        var launchAppId = proximityDevice.publishBinaryMessage(<span class="str">"LaunchApp:WriteTag"</span>, dataWriter.detachBuffer());
       proximityDevice.stopPublishingMessage(launchAppId);
   };
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The content of the tag is a string, where all the items are separated by “\t”:</p>
<ol>
<li>Some arguments that you want to use when the app starts</li>
<li>The plateform (in our case, we need to specify “Windows”)</li>
<li>The application name, which contains:</li>
<ol>
<li>The application id (this one can be found in the manifest file, under the attribute <strong>Id</strong> of the tag <em>Application</em>)</li>
<li>The current package family name</li>
</ol>
</ol>
<p>Using this parameters, we can publish a particular message: <strong>LaunchApp:WriteTag</strong>. This tag/message will be recognize by the platform which will then ask for the user to open the dedicated application.</p>
<p>So you can easily imagine use this technique to create an new kind of authentification in your application (at least to provide the username).</p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/05/windows-8-how-to-launch-an-app-using-nfc-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8] How to perform horizontal scrolling with mouse wheel in Webview for Windows Store apps?</title>
		<link>http://blog.thomaslebrun.net/2013/04/windows-8-how-to-perform-horizontal-scrolling-with-mouse-wheel-in-webview-for-windows-store-apps/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-how-to-perform-horizontal-scrolling-with-mouse-wheel-in-webview-for-windows-store-apps</link>
		<comments>http://blog.thomaslebrun.net/2013/04/windows-8-how-to-perform-horizontal-scrolling-with-mouse-wheel-in-webview-for-windows-store-apps/#comments</comments>
		<pubDate>Mon, 15 Apr 2013 08:39:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinJS]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/04/windows-8-how-to-perform-horizontal-scrolling-with-mouse-wheel-in-webview-for-windows-store-apps/</guid>
		<description><![CDATA[Scrolling in Windows Store applications is mostly done in horizontal mode. This is something quite easy to do with the GridView which support scrolling with mouse wheel but this can be a quite more complicated to do in Webview. Indeed, in the Webview control, the mouse wheel scroll is done in vertical mode so here &#8230; <a href="http://blog.thomaslebrun.net/2013/04/windows-8-how-to-perform-horizontal-scrolling-with-mouse-wheel-in-webview-for-windows-store-apps/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Scrolling in Windows Store applications is mostly done in horizontal mode. This is something quite easy to do with the GridView which support scrolling with mouse wheel but this can be a quite more complicated to do in Webview.</p>
<p>Indeed, in the Webview control, the mouse wheel scroll is done in vertical mode so here is a quick fix to perform the same scroll in horizontal mode.</p>
<p>To do this, you can use a JQuery plugin like JQuery.MouseWheel: <a title="https://github.com/brandonaaron/jquery-mousewheel" href="https://github.com/brandonaaron/jquery-mousewheel">https://github.com/brandonaaron/jquery-mousewheel</a></p>
<p>In your Webview, load JQuery and this plugin:</p>
<pre class="csharpcode">var scriptJQuery = <span class="str">"&lt;script type='text/javascript' src='http://code.jquery.com/jquery-1.7.js'&gt;&lt;/script&gt;"</span>;
var scriptJQueryMouseWheel = <span class="str">"&lt;script type='text/javascript' src='ms-appx-web:///Views/web/jquery.mousewheel.js'&gt;&lt;/script&gt;"</span>;

var content = <span class="str">"&lt;!doctype html&gt;&lt;html lang=\"fr\"&gt;&lt;head&gt;&lt;link rel=\"stylesheet\" href=\"ms-appx-web:///Views/web/web.css\" type=\"text/css\" media=\"screen\" /&gt;"</span> scriptJQuery + scriptJQueryMouseWheel + <span class="str">"&lt;/head&gt;"</span> +
    <span class="str">"&lt;div id=\"articleContent\"&gt;&lt;font id=\"article\" face=\"Segoe UI\"&gt;"</span> +
        SelectedNews.Description +
    <span class="str">"&lt;/div&gt;&lt;/font&gt;"</span> +
<span class="str">"&lt;/html&gt;"</span>;

webView.NavigateToString(content);</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Once this is done, we can just add a small JavaScript function to handle the “MouseWheel” event:</p>
<pre class="csharpcode">var mouseWheelScript = <span class="str">"&lt;script type=\"text/javascript\"&gt;"</span> +
                        <span class="str">"$(function() {"</span> +
                            <span class="str">"$('html, body').mousewheel(function(event, delta) {"</span> +
                                <span class="str">"this.scrollLeft -= (delta * 50);"</span> +
                                <span class="str">"event.preventDefault();"</span> +
                            <span class="str">"});"</span> +
                        <span class="str">"});"</span> +
                    <span class="str">"&lt;/script&gt;"</span>;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>So the complete code is the following one:</p>
<pre class="csharpcode">var scriptJQuery = <span class="str">"&lt;script type='text/javascript' src='http://code.jquery.com/jquery-1.7.js'&gt;&lt;/script&gt;"</span>;
var scriptJQueryMouseWheel = <span class="str">"&lt;script type='text/javascript' src='ms-appx-web:///Views/web/jquery.mousewheel.js'&gt;&lt;/script&gt;"</span>;

var mouseWheelScript = <span class="str">"&lt;script type=\"text/javascript\"&gt;"</span> +
                        <span class="str">"$(function() {"</span> +
                            <span class="str">"$('html, body').mousewheel(function(event, delta) {"</span> +
                                <span class="str">"this.scrollLeft -= (delta * 50);"</span> +
                                <span class="str">"event.preventDefault();"</span> +
                            <span class="str">"});"</span> +
                        <span class="str">"});"</span> +
                    <span class="str">"&lt;/script&gt;"</span>;

var content = <span class="str">"&lt;!doctype html&gt;&lt;html lang=\"fr\"&gt;&lt;head&gt;&lt;link rel=\"stylesheet\" href=\"ms-appx-web:///Views/web/web.css\" type=\"text/css\" media=\"screen\" /&gt;"</span> + scriptResize + scriptVideo + scriptJQuery + scriptJQueryMouseWheel + mouseWheelScript + <span class="str">"&lt;/head&gt;"</span> +
    <span class="str">"&lt;div id=\"articleContent\"&gt;&lt;font id=\"article\" face=\"Segoe UI\"&gt;"</span> +
        SelectedNews.Description +
    <span class="str">"&lt;/div&gt;&lt;/font&gt;"</span> +
<span class="str">"&lt;/html&gt;"</span>;

webView.NavigateToString(content);</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Now, each time the Webview will get the focus, user will be able to perform a horizontal scrolling using the mousewheel.</p>
<p>Pretty simple when you know!</p>
<p>Please note that the plugin’s file is loaded from ms-appx-web to allow Webview to load it correctly.</p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/04/windows-8-how-to-perform-horizontal-scrolling-with-mouse-wheel-in-webview-for-windows-store-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8] Insert a local CSS/JS file in the HTML of a Webview</title>
		<link>http://blog.thomaslebrun.net/2013/04/windows-8-insert-a-local-cssjs-file-in-the-html-of-a-webview/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-insert-a-local-cssjs-file-in-the-html-of-a-webview</link>
		<comments>http://blog.thomaslebrun.net/2013/04/windows-8-insert-a-local-cssjs-file-in-the-html-of-a-webview/#comments</comments>
		<pubDate>Wed, 10 Apr 2013 12:35:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinJS]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/04/windows-8-insert-a-local-cssjs-file-in-the-html-of-a-webview/</guid>
		<description><![CDATA[Here is a problem we met recently with my colleague Jonathan. Indeed, in one of the Windows 8 applications we are working, we have a Webview that is loaded thanks to the method NavigateToString: WebviewNews.NavigateToString(content); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode &#8230; <a href="http://blog.thomaslebrun.net/2013/04/windows-8-insert-a-local-cssjs-file-in-the-html-of-a-webview/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a problem we met recently with my colleague <a href="http://www.jonathanantoine.com" target="_blank">Jonathan</a>. </p>
<p>Indeed, in one of the Windows 8 applications we are working, we have a Webview that is loaded thanks to the method NavigateToString:</p>
<pre class="csharpcode">WebviewNews.NavigateToString(content);</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>(where content is the HTML fragment that will be displayed in the Webview).</p>
<p>On that HTML, we wanted to insert a custom CSS file so we tried the following:</p>
<pre class="csharpcode"> var content =
    <span class="str">"&lt;html&gt;&lt;head&gt;&lt;link rel=\"stylesheet\" href=\"ms-appx:///Views/web/web.css\" type=\"text/css\" media=\"screen\" /&gt;&lt;/head&gt;"</span> +
         <span class="str">"&lt;font face=\"Segoe UI\"&gt;"</span> +
             NewsDetailPageViewModel.SelectedNews.Description +
         <span class="str">"&lt;/font&gt;"</span> +
     <span class="str">"&lt;/html&gt;"</span>;
 WebviewNews.NavigateToString(content);</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Unfortunately, this does not work: the code is correct but the CSS rules were not applied. </p>
<p>After a quick look, it appears that the fix is simple: instead of using ms-appx, we needed to use <strong>ms-appx-web</strong>. Content referenced via this scheme is loaded from the local package, but runs with the abilities and restrictions of the web context.</p>
<p>The correct code was:</p>
<pre class="csharpcode"> var content =
    <span class="str">"&lt;html&gt;&lt;head&gt;&lt;link rel=\"stylesheet\" href=\"ms-appx-web:///Views/web/web.css\" type=\"text/css\" media=\"screen\" /&gt;&lt;/head&gt;"</span> +
         <span class="str">"&lt;font face=\"Segoe UI\"&gt;"</span> +
             NewsDetailPageViewModel.SelectedNews.Description +
         <span class="str">"&lt;/font&gt;"</span> +
     <span class="str">"&lt;/html&gt;"</span>;
 WebviewNews.NavigateToString(content);</pre>
<p>Using this syntax, the CSS rules were correctly loaded and the HTML content was correctly modified according to our CSS rules.</p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/04/windows-8-insert-a-local-cssjs-file-in-the-html-of-a-webview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8 / TFS] Building and Validating Windows Store Apps with Team Foundation Service</title>
		<link>http://blog.thomaslebrun.net/2013/04/windows-8-tfs-building-and-validating-windows-store-apps-with-team-foundation-service/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-tfs-building-and-validating-windows-store-apps-with-team-foundation-service</link>
		<comments>http://blog.thomaslebrun.net/2013/04/windows-8-tfs-building-and-validating-windows-store-apps-with-team-foundation-service/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 08:51:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinJS]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/04/windows-8-tfs-building-and-validating-windows-store-apps-with-team-foundation-service/</guid>
		<description><![CDATA[I’m glad to announce that my first MSDN article (Building and Validating Windows Store Apps with Team Foundation Service) is now available ! It’s a topic I’ve already covered on my blog but I hope you’ll get more information and details in the new and revisited version! The article is available here: http://msdn.microsoft.com/en-us/magazine/dn166931.aspx Happy coding &#8230; <a href="http://blog.thomaslebrun.net/2013/04/windows-8-tfs-building-and-validating-windows-store-apps-with-team-foundation-service/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’m glad to announce that my first MSDN article (<strong><a href="http://msdn.microsoft.com/en-us/magazine/dn166931.aspx" target="_blank">Building and Validating Windows Store Apps with Team Foundation Service</a></strong>) is now available !</p>
<p>It’s a topic I’ve already covered on my blog but I hope you’ll get more information and details in the new and revisited version!</p>
<p>The article is available here: <a title="http://msdn.microsoft.com/en-us/magazine/dn166931.aspx" href="http://msdn.microsoft.com/en-us/magazine/dn166931.aspx">http://msdn.microsoft.com/en-us/magazine/dn166931.aspx</a></p>
<p>Happy coding (and building) !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/04/windows-8-tfs-building-and-validating-windows-store-apps-with-team-foundation-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8] Using a custom font in your Windows Store apps</title>
		<link>http://blog.thomaslebrun.net/2013/04/windows-8-using-a-custom-font-in-your-windows-store-apps/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-using-a-custom-font-in-your-windows-store-apps</link>
		<comments>http://blog.thomaslebrun.net/2013/04/windows-8-using-a-custom-font-in-your-windows-store-apps/#comments</comments>
		<pubDate>Tue, 02 Apr 2013 07:01:16 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Windows 8]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/04/windows-8-using-a-custom-font-in-your-windows-store-apps/</guid>
		<description><![CDATA[A small tip for anyone who look for the information. Using a custom font in any Windows Store apps (C# / XAML) is easy and the same as you can do in WPF or Silverlight application. Indeed, the first step is to add the font file to your solution and mark it as “Content” (on &#8230; <a href="http://blog.thomaslebrun.net/2013/04/windows-8-using-a-custom-font-in-your-windows-store-apps/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A small tip for anyone who look for the information.</p>
<p>Using a custom font in any Windows Store apps (C# / XAML) is easy and the same as you can do in WPF or Silverlight application.</p>
<p>Indeed, the first step is to add the font file to your solution and mark it as “<strong>Content</strong>” (on the file’s properties). Then, when you want to use your new font, just set the <strong>FontFamily</strong> property:</p>
<pre class="csharpcode"> <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">="u"</span>
                    <span class="attr">FontSize</span><span class="kwrd">="72"</span>
                    <span class="attr">Foreground</span><span class="kwrd">="Red"</span>
                    <span class="attr">FontFamily</span><span class="kwrd">="Assets/MyNewFont.ttf#My Font Name"</span><span class="kwrd">/&gt;</span></pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>As you can see, you just need to point to the right file and add the font name after the # character (this is because a single file can contains multiple fonts so using this syntax, you know exactly which font will be used).</p>
<p>Note that Visual Studio and Expression Blend both support the feature so you’ll be able to see the change directly in the designers.</p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/04/windows-8-using-a-custom-font-in-your-windows-store-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8] How to transcode an audio/video file?</title>
		<link>http://blog.thomaslebrun.net/2013/03/windows-8-how-to-transcode-an-audiovideo-file/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-how-to-transcode-an-audiovideo-file</link>
		<comments>http://blog.thomaslebrun.net/2013/03/windows-8-how-to-transcode-an-audiovideo-file/#comments</comments>
		<pubDate>Fri, 01 Mar 2013 09:11:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/03/windows-8-how-to-transcode-an-audiovideo-file/</guid>
		<description><![CDATA[Windows 8 provide a new Transcoding API that can help you to transcode an audio or video file from one format to another one. The API is really simple to use and consist of two majors classes: MediaEncodingProfile, which contains the settings that will determine how the destination file will be transcoded MediaTranscoder, which will &#8230; <a href="http://blog.thomaslebrun.net/2013/03/windows-8-how-to-transcode-an-audiovideo-file/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Windows 8 provide a new <strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.transcoding.aspx" target="_blank">Transcoding</a></strong> API that can help you to transcode an audio or video file from one format to another one.</p>
<p>The API is really simple to use and consist of two majors classes:</p>
<ol>
<li><strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.mediaproperties.mediaencodingprofile.aspx" target="_blank">MediaEncodingProfile</a></strong>, which contains the settings that will determine how the destination file will be transcoded</li>
<li><strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.transcoding.mediatranscoder.aspx" target="_blank">MediaTranscoder</a></strong>, which will perform the transformation</li>
</ol>
<p>First, you need to create a profile to indicate how to transcode the file:</p>
<pre class="csharpcode"><span class="kwrd">var</span> encodingProfile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.HD1080p);</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p><strong>MediaEncodingProfile</strong> contains factory methods like <strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.mediaproperties.mediaencodingprofile.createmp4.aspx" target="_blank">CreateMp4</a></strong> or <strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.mediaproperties.mediaencodingprofile.createwmv.aspx" target="_blank">CreateWmv</a></strong>. The parameter of the methods gives the target resolution (in our case <em>1080p</em>).</p>
<p>Next, you can call <strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.transcoding.mediatranscoder.preparefiletranscodeasync.aspx" target="_blank">PrepareFileTranscodeAsync</a></strong> to transcode the file (after checking if the source can really be transcoded):</p>
<pre class="csharpcode"><span class="kwrd">var</span> prepareTranscodeResult = await transcoder.PrepareFileTranscodeAsync(sourceFile, destinationFile, encodingProfile);

<span class="kwrd">if</span> (prepareTranscodeResult.CanTranscode)
{
    await prepareTranscodeResult.TranscodeAsync();
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>And voila! Again, you can see that the API is very simple and flexible (you can, if you want, load a profile from a file or trim the destination file using the properties <strong><a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.transcoding.mediatranscoder.trimstarttime.aspx" target="_blank">TrimStartTime</a></strong> and <a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.transcoding.mediatranscoder.trimstoptime.aspx" target="_blank"><strong>TrimStopTime</strong></a>!).</p>
<p>For my tests, I’ve worked with a WMV file of 30 seconds for 25Mb. After converted it in MP4 (1080p), the result file was 65Mb (more bigger for more quality) and another conversion to VGA gave a file of 11Mb: as you can see, the result file depend of the quality you decide to use.</p>
<p>So now, you’re ready to create you own audio/video editor in a cool Windows Store app!</p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/03/windows-8-how-to-transcode-an-audiovideo-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8] How to get animated Live Tiles with Windows Azure Mobile Services?</title>
		<link>http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-animated-live-tiles-with-windows-azure-mobile-services/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-how-to-get-animated-live-tiles-with-windows-azure-mobile-services</link>
		<comments>http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-animated-live-tiles-with-windows-azure-mobile-services/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 09:14:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Mobile Services]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-animated-live-tiles-with-windows-azure-mobile-services/</guid>
		<description><![CDATA[Windows Azure Mobile Services is a awesome product that will help you to deliver great apps using a Windows Azure backend. One of the feature I like is the possibility to send push notifications to modify tiles in just few lines of code. There is just a small drawback to this technique: as the queue &#8230; <a href="http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-animated-live-tiles-with-windows-azure-mobile-services/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://www.windowsazure.com/en-us/develop/mobile/" target="_blank">Windows Azure Mobile Services</a></strong> is a awesome product that will help you to deliver great apps using a Windows Azure backend.</p>
<p>One of the feature I like is the possibility to send push notifications to modify tiles in just few lines of code. There is just a small drawback to this technique: as the queue notification must be enable from the client code, you won’t be able to get animated tiles.</p>
<p>But (as there is always a “but” ;), the next part of this post will provide you a simple but useful technique to get animated tiles for you Windows Store app.</p>
<p>In fact, instead of of send a classic notification, we’ll use the sendRaw method of the wns object to send a Raw notification. As a reminder, a raw notification is a notification that’s not displayed on the screen: as a developer, your code is notified that the notification is coming and you have to perform what you want/need.</p>
<p>So first, you have to create your server script (here is mine as an example):</p>
<pre class="csharpcode"><span class="kwrd">var</span> LASTEST_QUOTES_NUMBER = 5;

<span class="kwrd">var</span> payload;
<span class="kwrd">var</span> idx;

<span class="kwrd">function</span> cleanChannels(callback) {
    <span class="kwrd">var</span> channelsTable  = tables.getTable(<span class="str">'Channel'</span>);

    channelsTable.read({
        success: <span class="kwrd">function</span>(channels) {
            <span class="kwrd">if</span>(channels.length &gt; 0) {
                channels.forEach(<span class="kwrd">function</span>(channel){
                    <span class="kwrd">if</span>(channel.expirationTime &lt; <span class="kwrd">new</span> Date()){
                        channelsTable.del(channel.id);
                    }
                })
            }

            <span class="kwrd">if</span>(callback) {
                callback();
            }
        }
    })
}

<span class="kwrd">function</span> preparePayload(movie, quote){
     payload += <span class="str">"&lt;QuoteWithMovie&gt;"</span> +
                    <span class="str">"&lt;Movie Title=\""</span> + movie.title + <span class="str">"\" FrontCover=\""</span> + movie.poster_path + <span class="str">"\" BackCover=\""</span> + movie.backdrop_path + <span class="str">"\" /&gt;"</span> +
                    <span class="str">"&lt;Quote Text=\""</span> + quote.text.substring(100) + <span class="str">"\" /&gt;"</span> +
                <span class="str">"&lt;/QuoteWithMovie&gt;"</span>;

    idx++;

    <span class="kwrd">if</span>(idx == LASTEST_QUOTES_NUMBER) {

        payload += <span class="str">"&lt;/Results&gt;"</span>;

        cleanChannels(<span class="kwrd">function</span>() {
            <span class="kwrd">var</span> channelsTable  = tables.getTable(<span class="str">'Channel'</span>);

            channelsTable.read({
                success: <span class="kwrd">function</span>(channels) {
                    <span class="kwrd">if</span>(channels.length &gt; 0) {
                        <span class="kwrd">for</span> (<span class="kwrd">var</span> i = 0; i &lt; channels.length; i++) {
                            <span class="kwrd">var</span> channel = channels[i];

                            push.wns.sendRaw(channel.uri, payload);
                        }
                    }
                }
            });
        });
    }
}

<span class="kwrd">function</span> sendLatestQuotes() {

    payload = <span class="str">""</span>;
    idx = 0;

    <span class="kwrd">var</span> moviesTable = tables.getTable(<span class="str">'Movie'</span>);
    <span class="kwrd">var</span> quotesTable = tables.getTable(<span class="str">'Quote'</span>);

    quotesTable.where({ ispublished: <span class="kwrd">true</span> })
    .orderBy(<span class="str">'date'</span>)
    .take(LASTEST_QUOTES_NUMBER)
    .read({
        success: <span class="kwrd">function</span>(latestQuotes) {
            payload += <span class="str">"&lt;Results&gt;"</span>;

            latestQuotes.forEach(<span class="kwrd">function</span>(quote) {
                moviesTable.where({ movieid: quote.movieid })
                .read({
                    success: <span class="kwrd">function</span>(movies) {
                       preparePayload(movies[0], quote);
                    }
                })
            })
        }
    })
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>As you can see, the code is pretty simple: a XML payload is construct from some database records and, when I have the number of notification I want (5 because notification queuing allow you to switch up to 5 notifications), I send a raw notification, using the payload constructed before.</p>
<p>On the client side, the code use the <strong>PushNotificationReceived</strong> event to be notified and, if a raw notification is coming, the code use the content (the XML payload) to update the tile:</p>
<pre class="csharpcode"> var currentChannel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
currentChannel.PushNotificationReceived += async (sender, args) =&gt;
{
    <span class="kwrd">if</span> (args.NotificationType == PushNotificationType.Raw &amp;&amp; args.RawNotification != <span class="kwrd">null</span>)
    {
        await MainTileUpdateTask.UpdateMainTileAsync(args.RawNotification.Content);

        <span class="rem">// The raw notification should not be passed to its background task</span>
        args.Cancel = <span class="kwrd">true</span>;
    }
};</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The code to update the tile and animate it is dedicated to your application but, for you records, here is the one I’m using:</p>
<pre class="csharpcode"><span class="kwrd">internal</span> <span class="kwrd">static</span> async Task UpdateMainTile(<span class="kwrd">string</span> content)
{
    _isUpdatingTile = <span class="kwrd">true</span>;

    var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
    tileUpdater.EnableNotificationQueue(<span class="kwrd">true</span>);

    tileUpdater.Clear();

    var xElement = XElement.Parse(content);
    var quotesWithMovies = from q <span class="kwrd">in</span> xElement.Elements(<span class="str">"QuoteWithMovie"</span>)
                                            let movie = q.Element(<span class="str">"Movie"</span>)
                                            let quote = q.Element(<span class="str">"Quote"</span>)
                                            select <span class="kwrd">new</span> QuoteWithMovie
                                            {
                                                  MovieTitle = movie.Attribute(<span class="str">"Title"</span>).Value,
                                                  FrontCover = movie.Attribute(<span class="str">"FrontCover"</span>).Value,
                                                  BackCover = movie.Attribute(<span class="str">"BackCover"</span>).Value,
                                                  Text = quote.Attribute(<span class="str">"Text"</span>).Value
                                            };

    var quoteWithMovies = quotesWithMovies <span class="kwrd">as</span> IList&lt;QuoteWithMovie&gt; ?? quotesWithMovies.ToList();
    <span class="kwrd">if</span> (quoteWithMovies.Any())
    {
        <span class="kwrd">for</span> (<span class="kwrd">int</span> index = 0; index &lt; quoteWithMovies.Count; index++)
        {
            var quote = quoteWithMovies[index];

            var frontCoverFileFullUrl =
            await MoviesService.Current.GetFullCoverImageUrlAsync(quote.FrontCover, <span class="str">"w154"</span>);
            var backCoverFileFullUrl =
            await MoviesService.Current.GetFullCoverImageUrlAsync(quote.BackCover, <span class="str">"w300"</span>);

            var squareImageFilename = <span class="kwrd">string</span>.Format(<span class="str">"Square_{0}.jpg"</span>, index);
            var wideImageFilename = <span class="kwrd">string</span>.Format(<span class="str">"Wide_{0}.jpg"</span>, index);

            FileHelpers.DownloadFile(ApplicationData.Current.LocalFolder, squareImageFilename,
            frontCoverFileFullUrl);

            FileHelpers.DownloadFile(ApplicationData.Current.LocalFolder, wideImageFilename,
            backCoverFileFullUrl);

            var wideTile = Core.UI.Notifications.TileContentFactory.CreateTileWideImageAndText01();
            wideTile.Branding = TileBranding.None;
            wideTile.RequireSquareContent = <span class="kwrd">false</span>;
            wideTile.Image.Src = <span class="kwrd">string</span>.Format(<span class="str">"ms-appdata:///local/{0}"</span>, wideImageFilename);
            wideTile.Image.Alt = quote.MovieTitle;
            wideTile.TextCaptionWrap.Text = quote.Text;

            var squareTile = Core.UI.Notifications.TileContentFactory.CreateTileSquareImage();
            squareTile.Branding = TileBranding.None;
            squareTile.Image.Src = <span class="kwrd">string</span>.Format(<span class="str">"ms-appdata:///local/{0}"</span>, squareImageFilename);
            squareTile.Image.Alt = quote.MovieTitle;

            var wideTileNotification = wideTile.CreateNotification();
            var squareTileNotification = squareTile.CreateNotification();

             tileUpdater.Update(wideTileNotification);
             tileUpdater.Update(squareTileNotification);
         }
    }

    _isUpdatingTile = <span class="kwrd">false</span>;
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The might be others techniques to perform the same results but I like this one for one reason: raw notification can be received by BackgroundTask!</p>
<p>So if you add a BackgroundTask (which set its trigger to <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.background.pushnotificationtrigger" target="_blank"><strong>PushNotificationTrigger</strong></a>) and put you server code in a Mobile Services Scheduler, you’ll be able to update the tile even if the app is not running!</p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-animated-live-tiles-with-windows-azure-mobile-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Student looking for internship? We want you!</title>
		<link>http://blog.thomaslebrun.net/2013/01/student-looking-for-internship-we-want-you/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=student-looking-for-internship-we-want-you</link>
		<comments>http://blog.thomaslebrun.net/2013/01/student-looking-for-internship-we-want-you/#comments</comments>
		<pubDate>Tue, 15 Jan 2013 06:49:37 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Divers]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/01/student-looking-for-internship-we-want-you/</guid>
		<description><![CDATA[If you are a student looking for an internship, here is a very great opportunity for you! Indeed, Infinite Square, the company I’m currently working on, is looking for some interns to work on very cool projects using the following technologies: Windows 8 Windows Phone 8 Kinect ASP.NET MVC And more! So, if you are &#8230; <a href="http://blog.thomaslebrun.net/2013/01/student-looking-for-internship-we-want-you/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are a student looking for an internship, here is a very great opportunity for you!</p>
<p><img src="http://blog.thesage.com/wp-content/uploads/uncle-sam-we-want-you1.jpg" width="235" height="175"></p>
<p>Indeed, <strong><a href="http://www.infinitesquare.com/" target="_blank">Infinite Square</a></strong>, the company I’m currently working on, is looking for some interns to work on very cool projects using the following technologies:</p>
<ol>
<li>Windows 8</li>
<li>Windows Phone 8</li>
<li>Kinect</li>
<li>ASP.NET MVC</li>
<li>And more!</li>
</ol>
<p>So, if you are interested and you already know one of those technology (or want to learn it), just <a href="mailto:tlebrun@infinitesquare.com" target="_blank">drop me a line</a>!</p>
<p>Note: The internship is based on Paris, France.</p>
<p>&nbsp;</p>
<p>Happy coding ! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/01/student-looking-for-internship-we-want-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows 8] How to get the size of a StorageFile item ?</title>
		<link>http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-the-size-of-a-storagefile-item/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-how-to-get-the-size-of-a-storagefile-item</link>
		<comments>http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-the-size-of-a-storagefile-item/#comments</comments>
		<pubDate>Thu, 10 Jan 2013 16:44:31 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-the-size-of-a-storagefile-item/</guid>
		<description><![CDATA[Indeed, there are no Size or Length properties exposed by the StorageFile class. So a simple but useful trick is to read the content of the file as a Buffer and access to the Length property to access the basic properties of the file and use the Size property: public async static Task&#60;ulong&#62; GetFileSizeAsync(this IStorageFile &#8230; <a href="http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-the-size-of-a-storagefile-item/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Indeed, there are no Size or Length properties exposed by the <strong>StorageFile</strong> class. So a simple but useful trick is <strike>to read the content of the file as a Buffer and access to the <strong>Length</strong> property</strike> to access the basic properties of the file and use the <strong>Size</strong> property:</p>
<pre class="csharpcode"><span class="kwrd">public</span> async <span class="kwrd">static</span> Task&lt;<span class="kwrd">ulong</span>&gt; GetFileSizeAsync(<span class="kwrd">this</span> IStorageFile file)
{
    var properties = await file.GetBasicPropertiesAsync();

    <span class="kwrd">return</span> properties.Size;
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Happy coding !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/01/windows-8-how-to-get-the-size-of-a-storagefile-item/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Azure] Working with Boolean values in Windows Azure Mobile Services queries</title>
		<link>http://blog.thomaslebrun.net/2013/01/azure-working-with-boolean-values-in-windows-azure-mobile-services-queries/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=azure-working-with-boolean-values-in-windows-azure-mobile-services-queries</link>
		<comments>http://blog.thomaslebrun.net/2013/01/azure-working-with-boolean-values-in-windows-azure-mobile-services-queries/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 08:01:23 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Mobile Services]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://blog.thomaslebrun.net/2013/01/azure-working-with-boolean-values-in-windows-azure-mobile-services-queries/</guid>
		<description><![CDATA[During my last holidays, I’ve started to work on a new Windows 8 project (more details on that later) that use Windows Azure Mobile Services as a backend. During the development, I’ve encountered the following issue which, I suppose, is a bug that will be fixed later. On my application, I used the following code: &#8230; <a href="http://blog.thomaslebrun.net/2013/01/azure-working-with-boolean-values-in-windows-azure-mobile-services-queries/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>During my last holidays, I’ve started to work on a new Windows 8 project (more details on that later) that use Windows Azure Mobile Services as a backend.</p>
<p>During the development, I’ve encountered the following issue which, I suppose, is a bug that will be fixed later.</p>
<p>On my application, I used the following code:</p>
<pre class="csharpcode">var allItems = await ServiceClient.GetTable&lt;Items&gt;().Where(i =&gt; i.IsPublished).ToListAsync();

return allItems;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Unfortunately, this code thrown, every time, the following error:</p>
<p><a href="http://blog.thomaslebrun.net/wp-content/uploads/2013/01/image28.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blog.thomaslebrun.net/wp-content/uploads/2013/01/image_thumb28.png" width="503" height="326"></a></p>
<p>After taking a look in Fiddler, I found the problem:</p>
<p><a href="http://blog.thomaslebrun.net/wp-content/uploads/2013/01/image29.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blog.thomaslebrun.net/wp-content/uploads/2013/01/image_thumb29.png" width="407" height="46"></a></p>
<p>As you may know, Mobile Services use REST to access data on the server and the following REST query does not seem to be valid because there is no query operator (like eq for equal, etc.) and no value. So, I’ve tried to modify my code like this:</p>
<pre class="csharpcode">var allItems = await ServiceClient.GetTable&lt;Items&gt;().Where(i =&gt; i.IsPublished == true).ToListAsync();

return allItems;</pre>
<p>As you can see, I’ve just append “<em>== true</em>” to the Where clause and all seems to work like a charm. Indeed, no exception was rise and, looking at the REST query, we can see that all is OK:</p>
<p><a href="http://blog.thomaslebrun.net/wp-content/uploads/2013/01/image30.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blog.thomaslebrun.net/wp-content/uploads/2013/01/image_thumb30.png" width="495" height="49"></a></p>
<p>&nbsp;</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomaslebrun.net/2013/01/azure-working-with-boolean-values-in-windows-azure-mobile-services-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
