<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Infinite Codex</title>
    <description>Unlimited Possibilities through Code</description>
    <link>http://infinitecodex.com/infinitecodex/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 2.5.0.5</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://infinitecodex.com/infinitecodex/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Jason Short</dc:creator>
    <dc:title>Infinite Codex</dc:title>
    <geo:lat>47.370000</geo:lat>
    <geo:long>122.200000</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/InfiniteCodex" /><feedburner:info uri="infinitecodex" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Minimal Virtualized Data List for WP7</title>
      <description>&lt;p&gt;I recently gave a talk about data management on Windows Phone 7 for &lt;a href="http://research.microsoft.com/apps/video/dl.aspx?id=152374" target="_blank"&gt;XapFest&lt;/a&gt; and I put in a slide about virtualizing your data for data bound objects.&amp;nbsp; I didn&amp;rsquo;t really think it was that big of a topic when I was putting together the talk, but it generated a lot of interest from attendees.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am going to demonstrate the minimal virtualized data collection object you can easily create for data binding with a Listbox.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For this example I am using a simple class named FeedItemDataModel.&amp;nbsp; This represents a class that holds a single item from an RSS Feed.&amp;nbsp; In this simple implementation the values are simple and set in the constructor.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infinitecodex.com/pics/6dca3bb654bb_111EF/image.png"&gt;&lt;img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://infinitecodex.com/pics/6dca3bb654bb_111EF/image_thumb.png" alt="image" width="200" height="130" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The sample application shows a UI with a collection of this object databound to the UI and lets you jump to a specific index in the list.&amp;nbsp; The red text you see is a memory watcher class that shows memory usage within your app.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infinitecodex.com/pics/6dca3bb654bb_111EF/VirtualizedData.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="VirtualizedData" src="http://infinitecodex.com/pics/6dca3bb654bb_111EF/VirtualizedData_thumb.png" alt="VirtualizedData" width="292" height="484" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Silverlight handles the UI part&lt;/h2&gt;
&lt;p&gt;To be clear, Silverlight handles the xaml part of this for you.&amp;nbsp; If you have a list with one million objects only the number that fit on screen are built up for the xaml display (from your DataTemplate most likely).&amp;nbsp; The runtime is smart enough to realize that the listitem is offscreen and recycle it for you.&amp;nbsp; This is a huge performance boost, but what about the data behind that databound collection?&amp;nbsp; If you bind one million objects they are all loaded into that collection by default!&amp;nbsp; If you want to only load those that are on screen you have to handle that yourself.&amp;nbsp; But it really is not that hard to do for most data objects.&lt;/p&gt;
&lt;h2&gt;Three &amp;ldquo;must have&amp;rdquo; parts&lt;/h2&gt;
&lt;p&gt;You don&amp;rsquo;t need to implement a lot of things to make data binding work against a custom object, but you must implement the following three things.&amp;nbsp; The below code snippet excludes a bunch of stuff you have to implement due to the interface, but you can just throw a not implemented exception.&amp;nbsp; You don&amp;rsquo;t need them to be completely implemented for this to work.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IndexOf&lt;/strong&gt; &amp;ndash; So the data binding can lookup a specific object and return it as the selected item.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Count&lt;/strong&gt; &amp;ndash; How many total items are in the collection. Listboxes need this to show the correct size scroll bar.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;this[]&lt;/strong&gt; &amp;ndash; Go get the item, this could be from disk or from a cache.&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MinVirtualizedList : IList
{
&lt;span class="rem"&gt;// Total items to show in the list&lt;/span&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; TotalItems = 1000000;

&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Count returns the total items in the list.&lt;/span&gt;
&lt;span class="rem"&gt;/// Important for the scrollbar to have a scale that matches the data&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Count
{
    get { &lt;span class="kwrd"&gt;return&lt;/span&gt; TotalItems; }
}

&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Find the index of an object in the data list.&lt;/span&gt;
&lt;span class="rem"&gt;/// Important to allow quick seek access to the data position&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; IndexOf(&lt;span class="kwrd"&gt;object&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;)
{
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;value&lt;/span&gt; == &lt;span class="kwrd"&gt;null&lt;/span&gt;)
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; -1;
    }

    FeedItemDataModel item = (FeedItemDataModel)&lt;span class="kwrd"&gt;value&lt;/span&gt;;
    &lt;span class="kwrd"&gt;return&lt;/span&gt; item.FeedItemId;
}

&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Indexer for the list - this is where Silverlight will call back for each item that is&lt;/span&gt;
&lt;span class="rem"&gt;/// needed to fill the virtualized UI elements&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;param name="index"&amp;gt;The index of the item to get&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;The item&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;[&lt;span class="kwrd"&gt;int&lt;/span&gt; index]
{
    get
    {
        &lt;span class="rem"&gt;// If using SterlingDB you would simple have to Load&amp;lt;FeedItemDataModel&amp;gt;(index)&lt;/span&gt;
        FeedItemDataModel loadedItem = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
        loadedItem = &lt;span class="kwrd"&gt;new&lt;/span&gt; FeedItemDataModel { FeedItemId = index, FeedTitle = &lt;span class="str"&gt;"Title "&lt;/span&gt; };
        &lt;span class="kwrd"&gt;return&lt;/span&gt; loadedItem;
    }
    set
    {
        &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; NotImplementedException();
    }
}  // See code on bitbucket for complete implementation with stubbed out methods&lt;/pre&gt;
&lt;h2&gt;Load on Demand&lt;/h2&gt;
&lt;p&gt;You may be able to get away with always loading on demand if your objects are small.&amp;nbsp; I may update this sample later to include on demand loading using SterlingDB.&amp;nbsp; It would be really easy to implement, and I think there is value in having such a sample in the community.&lt;/p&gt;
&lt;h2&gt;Don&amp;rsquo;t be greedy&lt;/h2&gt;
&lt;p&gt;Only load the items you need.&amp;nbsp; If the user rarely scrolls down, don&amp;rsquo;t load anything beyond what a single screen can show (maybe a couple extra for the first part of the scroll).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Most apps may need a hybrid approach to this.&amp;nbsp; Either build a fa&amp;ccedil;ade around your object and only load the parts that are needed for the UI, or load the smallest subset you expect the user to realistically consume.&lt;/p&gt;
&lt;h2&gt;Doesn&amp;rsquo;t IObservableCollection handle this?&lt;/h2&gt;
&lt;p&gt;I think this is a common misconception. ObservableCollections are for handling the change notifications to the UI. You only have to databind them one time, and when the collection is changed the UI gets updated. You could probably use the same technique here, but you would have to derive your own custom class.&lt;/p&gt;
&lt;h2&gt;Sample Code on BitBucket&lt;/h2&gt;
&lt;p&gt;I put the complete sample up on BitBucket, click the link to go direct to the source.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bitbucket.org/jasonshortphd/virtualizeddatawp7/src" target="_blank"&gt;VirtualizedDataWP7 BitBucket Page&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Cache in the collection&lt;/h2&gt;
&lt;p&gt;Another optimization would be to cache the objects in the collection.&amp;nbsp; This would be pretty easy to implement an MRU (most recently used) cache.&amp;nbsp; Sounds like another future blog post.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/ORPB49yZq6A" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/ORPB49yZq6A/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2012/02/20/Minimal-Virtualized-Data-List-WP7.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=c7e6636d-c007-421e-aac9-cade69a93551</guid>
      <pubDate>Mon, 20 Feb 2012 12:00:00 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=c7e6636d-c007-421e-aac9-cade69a93551</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=c7e6636d-c007-421e-aac9-cade69a93551</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2012/02/20/Minimal-Virtualized-Data-List-WP7.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=c7e6636d-c007-421e-aac9-cade69a93551</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=c7e6636d-c007-421e-aac9-cade69a93551</feedburner:origLink></item>
    <item>
      <title>Create a file from a resource on WP7</title>
      <description>&lt;p&gt;I got an email from someone today asking about how to take a resource from their XAP (which is read only), and put it in a location where they can update the file.&amp;#160; &lt;/p&gt;  &lt;h2&gt;Initial Data Load&lt;/h2&gt;  &lt;p&gt;I highly recommend this approach for getting an initial data load for your application.&amp;#160; Give the application a base of files to work with rather than requiring an initial round trip to a server for those files.&amp;#160; It is fine to need to update them almost immediately.&amp;#160; Think about the scenario where the user has no network access (a first run of the app this is really vital).&amp;#160; Does the user get an error that no data is available, or do they get a nice default experience?&amp;#160; Even if you just put in data that says “no data here yet”, that is better than a blank screen to the user.&lt;/p&gt;  &lt;h2&gt;Create File From Resource&lt;/h2&gt;  &lt;p&gt;I put this in a utilities class as a static method since it doesn’t really need any state.&amp;#160; One thing to ensure you do is put a using() block around the objects that are disposable.&amp;#160; This ensures they are cleaned up and released as quickly as possible.&amp;#160; I think this is a common reason why people think they need to GC.Collect, they are not cleaning up memory.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FileUtilities
{
&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Given a resource name, create a file in the isolated storage.&lt;/span&gt;
&lt;span class="rem"&gt;/// Resources are read only, but copying them to the isolated store means you can edit them.&lt;/span&gt;
&lt;span class="rem"&gt;/// Useful for including a starter file in your XAP, and then copying it out to storage&lt;/span&gt;
&lt;span class="rem"&gt;/// for editing it at runtime.&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;param name=&amp;quot;resourceName&amp;quot;&amp;gt;The name of the resource&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;param name=&amp;quot;fileName&amp;quot;&amp;gt;Optional param for the name of the file, &lt;br /&gt;///       &lt;/span&gt;&lt;span class="rem"&gt;by default uses the same name as the resource&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateFileFromResource(&lt;span class="kwrd"&gt;string&lt;/span&gt; resourceName, &lt;span class="kwrd"&gt;string&lt;/span&gt; fileName = &lt;span class="kwrd"&gt;null&lt;/span&gt;)
{
    &lt;span class="rem"&gt;// Find the resource and get the stream&lt;/span&gt;
    &lt;span class="rem"&gt;// Note the using() block to ensure this gets cleaned up when we are done&lt;/span&gt;
    &lt;span class="kwrd"&gt;using&lt;/span&gt; (var resourceStream = Application.GetResourceStream(&lt;br /&gt;                                  &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(resourceName, UriKind.Relative)).Stream)
    {
        &lt;span class="rem"&gt;// Get the location where we can write files&lt;/span&gt;
        &lt;span class="kwrd"&gt;using&lt;/span&gt; (var userStorage = IsolatedStorageFile.GetUserStoreForApplication())
        {
            &lt;span class="rem"&gt;// Use the filename (if given) or the resource name&lt;/span&gt;
            &lt;span class="kwrd"&gt;using&lt;/span&gt; (var newFile = userStorage.CreateFile(fileName ?? resourceName))
            {
                &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] byteBuffer = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[4096];
                &lt;span class="kwrd"&gt;int&lt;/span&gt; bytesRead = -1;
                &lt;span class="kwrd"&gt;while&lt;/span&gt; ((bytesRead = resourceStream.Read(&lt;br /&gt;                                     byteBuffer, 0, byteBuffer.Length)) &amp;gt; 0)
                {
                    newFile.Write(byteBuffer, 0, bytesRead);
                }
            }
        }
    }
}}&lt;/pre&gt;
&lt;style type="text/css"&gt;


.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; }&lt;/style&gt;

&lt;p&gt;&lt;em&gt;Please forgive the formatting above, trying to make it fit on a smaller size screen.&lt;/em&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/IHcdFRk6-sg" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/IHcdFRk6-sg/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2012/02/17/Create-a-file-from-a-resource-on-WP7.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=649fe793-ef83-444c-aa29-81f8d27daae5</guid>
      <pubDate>Fri, 17 Feb 2012 05:57:36 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=649fe793-ef83-444c-aa29-81f8d27daae5</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=649fe793-ef83-444c-aa29-81f8d27daae5</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2012/02/17/Create-a-file-from-a-resource-on-WP7.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=649fe793-ef83-444c-aa29-81f8d27daae5</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=649fe793-ef83-444c-aa29-81f8d27daae5</feedburner:origLink></item>
    <item>
      <title>Using a custom attribute to determine type at runtime</title>
      <description>&lt;p&gt;On a Windows Phone 7 project I am currently building I had a need to build a factory that instantiates different concrete classes depending upon an object at runtime.&amp;#160;&amp;#160; I have a number of information feeds, that all have different classes built to actually go get their data.&amp;#160; One for RSS Feeds, one for Twitter, etc.&amp;#160; Each Feed has a property for the FeedType, this is the information needed to determine what class to instantiate at runtime. &lt;/p&gt;  &lt;p&gt;I have written this pattern many times, but I ran across an interesting post on &lt;a href="http://stackoverflow.com/questions/4387573/can-i-use-attributes-so-my-factory-knows-what-it-can-should-instantiate-without/4387761" target="_blank"&gt;StackOverflow&lt;/a&gt; where Steven gave a different approach to solving this without the classic giant switch statement in the Create method.&amp;#160;&amp;#160; I thought it was neat enough to use in my application and share here.&lt;/p&gt;  &lt;p&gt;There are a couple of steps you have to take, but none of them are difficult.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Decorate your objects with a custom attribute &lt;/li&gt;    &lt;li&gt;Build the object types using reflection &lt;/li&gt;    &lt;li&gt;Implement your factory method &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Custom Attribute&lt;/h2&gt;  &lt;p&gt;The attribute I added is called FeedTypeAttribute, I then add it to the concrete feed processor classes.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; FeedTypeAttribute : Attribute&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; _feedType;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; FeedTypeAttribute(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; feedType)&lt;br /&gt;    {&lt;br /&gt;        _feedType = feedType;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; FeedTypeId&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _feedType;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;Adding the attribute to a class looks like the following.&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;[FeedTypeAttribute(1)]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; StaticFeedProcessor : IFeedProcessor&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; StaticFeedProcessor()&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ProcessFeedModel(FeedModel feedModel)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NotImplementedException();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;Note that this class would be a FeedType of 1 in my data, but how do you determine what class that is during runtime?&amp;#160; The answer is reflection (and yes, this does work on Windows Phone 7).&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;h2&gt;Factory Method Using Custom Attributes&lt;/h2&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 105.47%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 407px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; FeedProcessorFactory : IFeedProcessorFactory&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;, Type&amp;gt; processorList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;, Type&amp;gt;();&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; FeedProcessorFactory()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;// Get the types in this assembly that implement our custom attribute&lt;/span&gt;&lt;br /&gt;        var targetTypes = from type &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; Assembly.GetExecutingAssembly().GetTypes() &lt;br /&gt;                         &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; type.CanBeTreatedAsType(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(IFeedProcessor))&lt;br /&gt;                         &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; !type.IsAbstract &amp;amp;&amp;amp; !type.IsInterface&lt;br /&gt;                         let customAttributes = type.GetCustomAttributes( &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(FeedTypeAttribute), &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;)&lt;br /&gt;                         let attribute = customAttributes[0] &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; FeedTypeAttribute&lt;br /&gt;                         select &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; { type, attribute.FeedTypeId };&lt;br /&gt;&lt;br /&gt;        processorList = targetTypes.ToDictionary(p =&amp;gt; p.FeedTypeId, p =&amp;gt; p.type);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IFeedProcessor CreateProcessorByFeedType(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; feedId)&lt;br /&gt;    {&lt;br /&gt;        Type feedType = processorList[feedId];&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Activator.CreateInstance(feedType) &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; IFeedProcessor;&lt;br /&gt;    }&lt;br /&gt;}&lt;/p&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The key here is the type.GetCustomAttributes() call.&amp;#160; The linq expression gets all the type of the current assembly where the type can be assigned from the IFeedProcessor class.&amp;#160; We have to ensure the class is not abstract or an interface, and then get the custom attributes.&amp;#160; &lt;/p&gt;

&lt;p&gt;The let clause in the linq expression can be thought of like a local temporary variable.&amp;#160; Assigning the attributes to it, and then processing them in the final select.&lt;/p&gt;

&lt;h2&gt;Consuming the Factory&lt;/h2&gt;

&lt;p&gt;Consuming the factory is then as simple as instantiating a factory object and calling the CreateProcessorByFeedType function.&amp;#160; A fully allocated processor is returned ready to handle the feed.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #008000"&gt;// This is in my container object&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; IFeedProcessorFactory _feedProcessorFactory = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FeedProcessorFactory();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// This is in the function to process the feeds&lt;/span&gt;&lt;br /&gt;IFeedProcessor processor = _feedProcessorFactory.CreateProcessorByFeedType(feed.FeedType);&lt;br /&gt;processor.ProcessFeedModel(feed);&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2&gt;Less Coupling is Good&lt;/h2&gt;

&lt;div&gt;This code allows for the addition of new processor classes just by building the class and adding the custom attribute.&amp;#160; Of course you should check if the feedtype is not supported before trying to use the object (I omitted some code used for safety checking).&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div&gt;If a newer class is created in the future to replace a current one I only have to change the custom attribute to handle it.&amp;#160; No switch statements, or remembering to update a config somewhere.&lt;/div&gt;

&lt;div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/whlF4oXLRWk" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/whlF4oXLRWk/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2012/02/06/Using-a-custom-attribute-to-determine-type-at-runtime.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=8b6e9cf1-e303-4557-bf08-2803ba58e1ba</guid>
      <pubDate>Mon, 06 Feb 2012 01:46:00 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=8b6e9cf1-e303-4557-bf08-2803ba58e1ba</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=8b6e9cf1-e303-4557-bf08-2803ba58e1ba</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2012/02/06/Using-a-custom-attribute-to-determine-type-at-runtime.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=8b6e9cf1-e303-4557-bf08-2803ba58e1ba</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=8b6e9cf1-e303-4557-bf08-2803ba58e1ba</feedburner:origLink></item>
    <item>
      <title>Is this .Net Type Assignable from another Type?</title>
      <description>&lt;p&gt;I have run into this a few times and always have to go to the MSDN to find the answer.&amp;#160; I have a situation where I needed to determine if a given type can be treated as a base type in an object factory.&amp;#160; I wanted to be able to create my concrete classes without having to do a switch statement for each type.&lt;/p&gt;  &lt;p&gt;First I had to determine if the types were assignable to each other, then find the type to implement.&amp;#160; I will cover that in another article.&amp;#160; In this one I just want to cover the assignment test.&lt;/p&gt;  &lt;h2&gt;Can this type be assigned?&lt;/h2&gt;  &lt;p&gt;There is a function &lt;a href="http://msdn.microsoft.com/en-us/library/system.type.isassignablefrom.aspx" target="_blank"&gt;IsAssignableFrom&lt;/a&gt; that you can call on a System.Type.&amp;#160; &lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;( ParentType &lt;span style="color: #0000ff"&gt;is&lt;/span&gt; ChildType )&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;It actually has to be written the other way around.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;( ChildType.IsAssignableFrom(ParentType) )&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;h2&gt;Quick Extension Method&lt;/h2&gt;

&lt;p&gt;So instead of having to do that all over my code, I wrote an extension method to allow me to do it following a different ordering.&amp;#160; I actually got this basic idea from one of the comments on the MSDN page.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;( parentType.CanBeTreatedAsType(childType) )&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;As you can see the extension method lets you write the syntax in a more natural manner.&amp;#160; Your preference may differ, but this makes more sense to me.&lt;/p&gt;

&lt;h2&gt;Example Code&lt;/h2&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; DataExtensionMethods&lt;br /&gt;{&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; CanBeTreatedAsType(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; Type CurrentType, Type TypeToCompareWith)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (CurrentType == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; || TypeToCompareWith == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; TypeToCompareWith.IsAssignableFrom(CurrentType);&lt;br /&gt;        }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main()&lt;br /&gt;{&lt;br /&gt;    System.Type parentType = &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ParentClass);&lt;br /&gt;    System.Type childType = &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ChildClass);&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; ChildToParent = childType.CanBeTreatedAsType(parentType);&lt;br /&gt;    Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Child can be treated as parent: &amp;quot;&lt;/span&gt; + ChildToParent );&lt;br /&gt;     &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; ParentAsChild = parentType.CanBeTreatedAsType(childType);&lt;br /&gt;    Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Parent can be treated as child: &amp;quot;&lt;/span&gt; + ParentAsChild );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ParentClass&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ParentClass()&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ChildClass : ParentClass&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ChildClass() : &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;()&lt;br /&gt;    {&lt;br /&gt;    &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/dK7PIIIT3i8" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/dK7PIIIT3i8/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2012/02/02/Is-this-Net-Type-Assignable-from-another-Type.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=9bcc7915-1dcb-4f9a-a2be-48810d7486d4</guid>
      <pubDate>Thu, 02 Feb 2012 09:20:17 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=9bcc7915-1dcb-4f9a-a2be-48810d7486d4</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=9bcc7915-1dcb-4f9a-a2be-48810d7486d4</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2012/02/02/Is-this-Net-Type-Assignable-from-another-Type.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=9bcc7915-1dcb-4f9a-a2be-48810d7486d4</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=9bcc7915-1dcb-4f9a-a2be-48810d7486d4</feedburner:origLink></item>
    <item>
      <title>Debug Secondary Tiles</title>
      <description>&lt;p&gt;This is another of those posts for my future self, because I know I won’t remember this little tip.&lt;/p&gt;  &lt;h2&gt;Set startup through app manifest&lt;/h2&gt;  &lt;p&gt;The WMAppManifest.xml has a property that tells it where to send the default launch of the application.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &amp;lt;Tasks&amp;gt;
      &amp;lt;DefaultTask Name=&lt;span class="str"&gt;&amp;quot;_default&amp;quot;&lt;/span&gt; NavigationPage=&lt;span class="str"&gt;&amp;quot;MainPage.xaml&amp;quot;&lt;/span&gt; /&amp;gt;
    &amp;lt;/Tasks&amp;gt;&lt;/pre&gt;

&lt;p&gt;So the normal launch page is MainPage.xaml. But you can change it to another page, and include your parameters just like from a secondary tile!&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &amp;lt;Tasks&amp;gt;
      &amp;lt;DefaultTask Name=&lt;span class="str"&gt;&amp;quot;_default&amp;quot;&lt;/span&gt; NavigationPage=&lt;span class="str"&gt;&amp;quot;/TileDetails.xaml?myid=2&amp;quot;&lt;/span&gt; /&amp;gt;
    &amp;lt;/Tasks&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now you can just press F5 and debug just as if that secondary tile had been clicked.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/VR8O4gsBoBM" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/VR8O4gsBoBM/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2012/01/04/Debug-Secondary-Tiles.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=3067465a-4bc7-4400-b99e-bc533b89faa6</guid>
      <pubDate>Wed, 04 Jan 2012 02:39:00 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=3067465a-4bc7-4400-b99e-bc533b89faa6</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=3067465a-4bc7-4400-b99e-bc533b89faa6</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2012/01/04/Debug-Secondary-Tiles.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=3067465a-4bc7-4400-b99e-bc533b89faa6</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=3067465a-4bc7-4400-b99e-bc533b89faa6</feedburner:origLink></item>
    <item>
      <title>Coding 4 Fun Phone Toolkit updated</title>
      <description>&lt;p&gt;If you have not looked at the toolkit before you seriously owe it to yourself, go get it now!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://coding4fun.codeplex.com/"&gt;Coding 4 Fun Phone Toolkit&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Windows Phone Geek has also done a great intro post on one of the new controls (the MetroFlow control).&amp;#160; &lt;a href="http://www.windowsphonegeek.com/articles/Getting-Started-with-the-Coding4Fun-toolkit-MetroFlow-Control"&gt;Getting started with MetroFlow Control is a great read&lt;/a&gt;, even just to get up to speed with the overall concepts of the toolkit.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/UFZGs4DBmJw" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/UFZGs4DBmJw/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2012/01/03/Coding-4-Fun-Phone-Toolkit-updated.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=4cd239b5-14ad-42a3-963b-d1193de97f21</guid>
      <pubDate>Tue, 03 Jan 2012 02:37:31 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=4cd239b5-14ad-42a3-963b-d1193de97f21</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=4cd239b5-14ad-42a3-963b-d1193de97f21</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2012/01/03/Coding-4-Fun-Phone-Toolkit-updated.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=4cd239b5-14ad-42a3-963b-d1193de97f21</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=4cd239b5-14ad-42a3-963b-d1193de97f21</feedburner:origLink></item>
    <item>
      <title>Click back twice to exit app?</title>
      <description>&lt;p&gt;I have been adding animations to a Windows Phone 7 app that has a panorama control and ran into a problem I have seen others post online.&amp;#160; I figured it out, so I thought I would take a minute to explain how.&lt;/p&gt;  &lt;h2&gt;Get ready to add transitions&lt;/h2&gt;  &lt;p&gt;The &lt;a href="http://silverlight.codeplex.com/"&gt;Silverlight Toolkit&lt;/a&gt; is the way you want to go about adding quick and easy animations when a page loads and navigates away from the current page.&lt;/p&gt;  &lt;p&gt;If you are not familiar with the basics visit the link above, or read this really good tutorial about &lt;a href="http://www.windowsphonegeek.com/articles/wp7-transitions-in-depth--custom-transitions"&gt;wp7 page transitions&lt;/a&gt; on Windows Phone Geek.&lt;/p&gt;  &lt;p&gt;The basics are that you have to include the toolkit, and you have to modify the root frame of your application to be a transition page instead of a normal phone page.&lt;/p&gt;  &lt;p&gt;In a typical application you have the RootFrame declared in your App.xaml.cs like this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; App : Application
    {
        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// Provides easy access to the root frame of the Phone Application.&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;The root frame of the Phone Application.&amp;lt;/returns&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; PhoneApplicationFrame RootFrame { get; &lt;span class="kwrd"&gt;private&lt;/span&gt; set; }
    }&lt;/pre&gt;

&lt;p&gt;But for transitions to happen you need to change the object to a TransitionFrame when your InitializePhoneApplication is called.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;            &lt;span class="rem"&gt;// REPLACE THE FIRST LINE WITH THE SECOND&lt;/span&gt;
            &lt;span class="rem"&gt;// RootFrame = new PhoneApplicationFrame();&lt;/span&gt;
            RootFrame = &lt;span class="kwrd"&gt;new&lt;/span&gt; TransitionFrame();
&lt;style type="text/css"&gt;.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; }
&lt;/style&gt;&lt;/pre&gt;

&lt;p&gt;This will give you the ability to add transitions to your page.&lt;/p&gt;

&lt;p&gt;I prefer to define my transition style at the application level, rather than the page level.&amp;#160; Usually I want all the pages to behave the same, so this gives a nice central point for all of them to reference it.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;In your App.xaml add a style like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;        &amp;lt;Application.Resources&amp;gt;
            &amp;lt;Style x:Key=&lt;span class="str"&gt;&amp;quot;TransitionPageStyle&amp;quot;&lt;/span&gt; TargetType=&lt;span class="str"&gt;&amp;quot;phone:PhoneApplicationPage&amp;quot;&lt;/span&gt;&amp;gt;
            &amp;lt;Setter Property=&lt;span class="str"&gt;&amp;quot;toolkit:TransitionService.NavigationInTransition&amp;quot;&lt;/span&gt;&amp;gt;
                &amp;lt;Setter.Value&amp;gt;
                    &amp;lt;toolkit:NavigationInTransition&amp;gt;
                        &amp;lt;toolkit:NavigationInTransition.Backward&amp;gt;
                            &amp;lt;toolkit:TurnstileTransition Mode=&lt;span class="str"&gt;&amp;quot;BackwardIn&amp;quot;&lt;/span&gt;/&amp;gt;
                        &amp;lt;/toolkit:NavigationInTransition.Backward&amp;gt;
                        &amp;lt;toolkit:NavigationInTransition.Forward&amp;gt;
                            &amp;lt;toolkit:TurnstileTransition Mode=&lt;span class="str"&gt;&amp;quot;ForwardIn&amp;quot;&lt;/span&gt;/&amp;gt;
                        &amp;lt;/toolkit:NavigationInTransition.Forward&amp;gt;
                    &amp;lt;/toolkit:NavigationInTransition&amp;gt;
                &amp;lt;/Setter.Value&amp;gt;
            &amp;lt;/Setter&amp;gt;
            &amp;lt;Setter Property=&lt;span class="str"&gt;&amp;quot;toolkit:TransitionService.NavigationOutTransition&amp;quot;&lt;/span&gt;&amp;gt;
                &amp;lt;Setter.Value&amp;gt;
                    &amp;lt;toolkit:NavigationOutTransition&amp;gt;
                        &amp;lt;toolkit:NavigationOutTransition.Backward&amp;gt;
                            &amp;lt;toolkit:TurnstileTransition Mode=&lt;span class="str"&gt;&amp;quot;BackwardOut&amp;quot;&lt;/span&gt;/&amp;gt;
                        &amp;lt;/toolkit:NavigationOutTransition.Backward&amp;gt;
                        &amp;lt;toolkit:NavigationOutTransition.Forward&amp;gt;
                            &amp;lt;toolkit:TurnstileTransition Mode=&lt;span class="str"&gt;&amp;quot;ForwardOut&amp;quot;&lt;/span&gt;/&amp;gt;
                        &amp;lt;/toolkit:NavigationOutTransition.Forward&amp;gt;
                    &amp;lt;/toolkit:NavigationOutTransition&amp;gt;
                &amp;lt;/Setter.Value&amp;gt;
            &amp;lt;/Setter&amp;gt;
        &amp;lt;/Style&amp;gt;
            
        &lt;span class="rem"&gt;// Other resources here...&lt;/span&gt;
    &amp;lt;/Application.Resources&amp;gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.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; }&lt;/style&gt;

&lt;p&gt;This is defining a in and out transition that is a turnstile effect.&amp;#160; This is how almost all of the built in applications behave.&lt;/p&gt;

&lt;h2&gt;Modify the page&lt;/h2&gt;

&lt;p&gt;Add the transition to each page you want to use this behavior in the XAML.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&amp;lt;phone:PhoneApplicationPage 
    x:Class=&lt;span class="str"&gt;&amp;quot;YourApplication.MainPage&amp;quot;&lt;/span&gt;
    xmlns=&lt;span class="str"&gt;&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;
   &lt;span class="rem"&gt;// the rest of your xmlns stays the same, you need to add the toolkit and the style &lt;/span&gt;

   &lt;span class="rem"&gt;// This reference loads the toolkit controls for this page&lt;/span&gt;
   xmlns:toolkit=&lt;span class="str"&gt;&amp;quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit&amp;quot;&lt;/span&gt;

    &lt;span class="rem"&gt;// This is named in the App.xaml (you can change it)&lt;/span&gt;
    Style=&lt;span class="str"&gt;&amp;quot;{StaticResource TransitionPageStyle}&amp;quot;&lt;/span&gt;&amp;gt;

    &lt;span class="rem"&gt;// the rest of your page XAML stays the same....&lt;/span&gt;

/&amp;gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.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; }&lt;/style&gt;

&lt;p&gt;Do this for each page you want to use the transition effect.&lt;/p&gt;

&lt;h2&gt;Why do I have to hit back twice?&lt;/h2&gt;

&lt;p&gt;Phew, now to the reason I wrote this post…&lt;/p&gt;

&lt;p&gt;In some situations you will notice that hitting back from your main page will navigate out, but the same page will appear rather than exiting the application. This will surely cause you to fail certification, and probably annoy a few users.&lt;/p&gt;

&lt;p&gt;There are a couple different reasons why I have seen this happen.&lt;/p&gt;

&lt;h2&gt;There can be only one… RootFrame&lt;/h2&gt;

&lt;p&gt;The core of all the issues is that you can only have ONE RootFrame on your page.&amp;#160; If you are allocating a second frame for the transition and assigning it to the RootFrame you have two of them around.&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;            RootFrame = &lt;span class="kwrd"&gt;new&lt;/span&gt; PhoneApplicationFrame();

            &lt;span class="rem"&gt;// This will make a SECOND Frame in your app&lt;/span&gt;
            RootFrame = &lt;span class="kwrd"&gt;new&lt;/span&gt; TransitionFrame();
&lt;style type="text/css"&gt;.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; }
&lt;/style&gt;&lt;/pre&gt;

&lt;p&gt;This is the mistake I have seen online quite a bit.&amp;#160; People think they have to add a new TransitionFrame allocation and leave the original one in place.&amp;#160; You &lt;strong&gt;must delete the PhoneApplicationFrame() allocation line&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;A more subtle version of this same bug is the one I ran into.&amp;#160; The Panorama project template creates a RootFrame for you in the App.xaml like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;   &amp;lt;Application.RootVisual&amp;gt;
        &amp;lt;toolkit:PhoneApplicationFrame x:Name=&lt;span class="str"&gt;&amp;quot;RootFrame&amp;quot;&lt;/span&gt; Source=&lt;span class="str"&gt;&amp;quot;/MainPage.xaml&amp;quot;&lt;/span&gt;/&amp;gt;
    &amp;lt;/Application.RootVisual&amp;gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.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; }&lt;/style&gt;

&lt;p&gt;This will cause a second allocation of a PhoneApplicationFrame!&lt;/p&gt;

&lt;p&gt;If you remove that code from the xaml you will now safely be able to hit back and leave the application.&lt;/p&gt;


&lt;style type="text/css"&gt;

.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; }&lt;/style&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/3J7zrur1fL4" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/3J7zrur1fL4/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2011/12/09/Click-back-twice-to-exit-app.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=e9dae518-7739-4e2d-b583-16956a321627</guid>
      <pubDate>Fri, 09 Dec 2011 08:11:49 -1500</pubDate>
      <category>WP7</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=e9dae518-7739-4e2d-b583-16956a321627</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=e9dae518-7739-4e2d-b583-16956a321627</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2011/12/09/Click-back-twice-to-exit-app.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=e9dae518-7739-4e2d-b583-16956a321627</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=e9dae518-7739-4e2d-b583-16956a321627</feedburner:origLink></item>
    <item>
      <title>Explorer Search options for file and IE favorites</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Do you every need to search in Explorer (your Windows Explorer, not the Internet one) for files of a specific size range?&amp;#160; A coworker showed this to me and I wanted to write it down so I don’t forget it!&lt;/p&gt;  &lt;h2&gt;Search by Size: range&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://infinitecodex.com/image.axd?picture=image_thumb_2.png" width="644" height="209" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That will filter the results to all files within those ranges.&amp;#160; This even works on Server 2008 (I thought it was a Windows 7 only feature at first).&lt;/p&gt;  &lt;h2&gt;Search in Internet Explorer Favorites&lt;/h2&gt;  &lt;p&gt;You can also search through your internet bookmarks and favorites by the strange sequence of adding your favorites to the favorites for search.&lt;/p&gt;  &lt;p&gt;Step 1&lt;/p&gt;  &lt;p&gt;First navigate to your favorites folder in Explorer.&amp;#160; This should be the one under your username, not the one at the top of the Explorer window.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Choose Favorites" border="0" alt="Choose the favorites icon under your username" src="http://infinitecodex.com/image.axd?picture=image_thumb_3.png" width="342" height="267" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select the Favorites item.&amp;#160; You will see your folders and bookmarks on the right side of the screen.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Step 2&lt;/h2&gt;  &lt;p&gt;Then you have to find the Favorites item that is usually at the very top on the left pane of Explorer.&amp;#160; DON’T CLICK IT.&amp;#160; Right Click and select &lt;strong&gt;&lt;em&gt;Add current location to Favorites&lt;/em&gt;&lt;/strong&gt;.&amp;#160; Then you will have a Favorites folder under the Favorites item.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add current location to favorites" border="0" alt="Add current location to favorites" src="http://infinitecodex.com/image.axd?picture=image_thumb_4.png" width="332" height="209" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That’s it.&amp;#160; You can now search them quickly and easily from the Explorer window.&lt;/p&gt;  &lt;h2&gt;Search the Internet Bookmarks and Favorites&lt;/h2&gt;  &lt;p&gt;This next part is also a little non intuitive to me.&amp;#160; To search the internet bookmark favorites you have to select the Favorites icon, then choose Favorites again (for the internet ones) and type your search in the &lt;strong&gt;upper right &lt;/strong&gt;corner of Explorer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Search Favorites" border="0" alt="Search from upper right corner of Explorer" src="http://infinitecodex.com/image.axd?picture=image_thumb_5.png" width="644" height="207" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Name your bookmarks when adding them&lt;/h2&gt;  &lt;p&gt;You can add a favorite by pressing Alt-Z on the keyboard while on a site, or hit the Star icon (Internet Explorer 9) and then add to favorites.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://infinitecodex.com/image.axd?picture=image_thumb_6.png" width="244" height="113" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I find this incredibly useful for finding my bookmarks later. I actually now take the time to give meaningful names to all my bookmarks so I can search on them later. No content from the page can be searched, just the title you put in the bookmark, and the web address.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://infinitecodex.com/image.axd?picture=image_thumb_7.png" width="456" height="212" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can also create folders for them as well.&lt;/p&gt;  &lt;h2&gt;Sync your bookmarks across machines&lt;/h2&gt;  &lt;p&gt;Did you know you can keep your bookmarks across multiple machines?&lt;/p&gt;  &lt;p&gt;Using &lt;a href="http://explore-df.live.com/windows-live-mesh"&gt;Windows Live Mesh&lt;/a&gt; you only have to select to Sync your Internet Explorer under Program Settings.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://infinitecodex.com/image.axd?picture=image_8.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://infinitecodex.com/image.axd?picture=image_thumb_8.png" width="644" height="94" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Windows Live Mesh is a free tool that allows you to also sync folders across machines as well.&amp;#160; If you haven’t seen this tool you really need to!&amp;#160; I think it is way better than using a third party service like Drop Box.&amp;#160; I use it to sync One Note notebooks across all my machines.&lt;/p&gt;  &lt;p&gt;Hope this helps someone, and now I won’t forget it either. &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/ac2zXX7MEXE" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/ac2zXX7MEXE/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2011/12/06/Explorer-Search-options-for-file-and-IE-favorites.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=1d0acc69-9681-4239-be1d-16dcce4be8bd</guid>
      <pubDate>Tue, 06 Dec 2011 00:56:00 -1500</pubDate>
      <category>General</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=1d0acc69-9681-4239-be1d-16dcce4be8bd</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=1d0acc69-9681-4239-be1d-16dcce4be8bd</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2011/12/06/Explorer-Search-options-for-file-and-IE-favorites.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=1d0acc69-9681-4239-be1d-16dcce4be8bd</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=1d0acc69-9681-4239-be1d-16dcce4be8bd</feedburner:origLink></item>
    <item>
      <title>Async Data Flow Block in TPL</title>
      <description>&lt;p&gt;Check out the new System.Threading.Tasks.Dataflow.dll for processing blocks of data in an asynchronous manner.&amp;#160; I watched this video on Channel 9 and it blew me away.&amp;#160; I hope this goes into .Net 4.5 by default.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=14782" target="_blank"&gt;Intro to TPL Dataflow&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Very easy to control things like a data pump where you want to process the data as it comes into a queue.&amp;#160; You can even let the ActionBlock run in and just have it call you back when it is done.&lt;/p&gt; &lt;iframe style="width: 512px; height: 288px" src="http://channel9.msdn.com/posts/TPL-Dataflow-Tour/player?w=512&amp;amp;h=288" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Sample code&lt;/h2&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 400px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #008000"&gt;// Setup an action block - nothing is happening here &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// until we post something to this block&lt;/span&gt;&lt;br /&gt;var ab = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ActionBlock&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt;( i =&amp;gt;&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;// Wait without blocking the thread&lt;/span&gt;&lt;br /&gt;    await TaskEx.Delay(1000);&lt;br /&gt;    Console.WriteLine(i);&lt;br /&gt;}&lt;br /&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataFlowBlockOptions(TaskScheduler.Default, 4));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// Now post 10 items to the block&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 10; i++)&lt;br /&gt;{&lt;br /&gt;    ab.Post(i);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// Tell the action block we are done and it should stop&lt;/span&gt;&lt;br /&gt;ab.DeclinePermanently();&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// Wait for it to done processing&lt;/span&gt;&lt;br /&gt;ab.CompletionTask.Wait();&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;h2&gt;More information&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/async" target="_blank"&gt;Visual Studio Aync Website&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/b4ijnKzQp7k" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/b4ijnKzQp7k/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2011/11/16/Async-Data-Flow-Block-in-TPL.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=f6ade2bc-f0f8-4c1f-ae32-01bf18059498</guid>
      <pubDate>Wed, 16 Nov 2011 03:47:26 -1500</pubDate>
      <category>General</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=f6ade2bc-f0f8-4c1f-ae32-01bf18059498</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=f6ade2bc-f0f8-4c1f-ae32-01bf18059498</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2011/11/16/Async-Data-Flow-Block-in-TPL.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=f6ade2bc-f0f8-4c1f-ae32-01bf18059498</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=f6ade2bc-f0f8-4c1f-ae32-01bf18059498</feedburner:origLink></item>
    <item>
      <title>Windows Runtime Information Links</title>
      <description>&lt;p&gt;WINRT (as the Windows Runtime as been dubbed) was announced a while back at BUILD in California.&amp;#160; I was super busy at the time and didn’t get to read or watch any of the sessions online.&amp;#160; Check out the &lt;a href="http://en.wikipedia.org/wiki/WinRT" target="_blank"&gt;WinRT Wikipedia page&lt;/a&gt; for more information.&lt;/p&gt;  &lt;p&gt;I have been listening to podcasts and trying to catch up today while I am home sick.&amp;#160; Thought I would put some good links up for others looking to catch up also (and hopefully not while sick).&lt;/p&gt;  &lt;h2&gt;Dot Net Rocks&lt;/h2&gt;  &lt;p&gt;If you have never listened to &lt;a href="http://www.dotnetrocks.com/Default.aspx" target="_blank"&gt;Dot Net Rocks&lt;/a&gt; you seriously owe it to yourself to check it out.&amp;#160; I don’t listen to every show.&amp;#160; Grab ones you are interested in from their &lt;a href="http://www.dotnetrocks.com/archives.aspx" target="_blank"&gt;archive&lt;/a&gt;.&amp;#160; I have pointed several junior developers to their shows on specific topics and many have come back to tell me that the podcast was just enough to get them unstuck on some concept or idea.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=701" target="_blank"&gt;DNR Show 701&lt;/a&gt; has a really good intro where Carl goes through the WINRT and announcements from BUILD.&amp;#160; Listen to the first 15 minutes for the best information I have found anywhere about WINRT and Windows 8.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=705" target="_blank"&gt;DNR Show 705&lt;/a&gt; is an entire show about WINRT and WIN8.&amp;#160; It appears they will be starting a new podcast specifically about tablet development.&amp;#160; Rockford Lhotka and Billy Hollis are the guests on the show and talk about how they view WIN8 from a business and development standpoint.&amp;#160; Good information and will give you some insight into how WIN8 might win over the business segment.&lt;/p&gt;  &lt;h2&gt;Channel 9&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-531T" target="_blank"&gt;Using the Windows Runtime from C# and Visual Basic&lt;/a&gt; BUILD session covering the topic at a high level.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.infoq.com/news/2011/09/Design-Details-Windows-Runtime;jsessionid=1BAFB234165E0EE562C6EB0AE2CB9C66"&gt;Design Details of the Windows Runtime&lt;/a&gt; has a good overview slide from BUILD showing how .Net and WinRT all work through the same stack in Windows 8.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2011/09/15/winrt-and-net-in-windows-8.aspx" target="_blank"&gt;WinRT and .NET in Windows 8&lt;/a&gt; a good blog post about the rumors of .Nets death being greatly exaggerated. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/Shows/Going+Deep/Bart-De-Smet-Rx-Updat-NET-45-Async-WinRT" target="_blank"&gt;.Net 4.5, Async, WinRT with Bart De Smet&lt;/a&gt; is a video podcast talking about some topics for all .Net developers in the coming months and years.&amp;#160; Bart is a seriously smart Microsoft engineer working on all sorts of async technologies.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/Shows/Going+Deep/Drawbridge-An-Experimental-Library-Operating-System" target="_blank"&gt;Application Virtualization&lt;/a&gt; is a great podcast talking about how apps could be sandboxed in a future OS.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-2-C-at-BUILD-Windows-Runtime-LibraryWRL-Meet-Tarek-and-Sridhar" target="_blank"&gt;Going Native 2&lt;/a&gt; talks about using C++ in Windows 8 and how the runtime allows C++ to be a first class citizen of the OS again.&amp;#160; If you extrapolate a little you will also see how it was possible for Javascript to become first class as well.&lt;/p&gt;  &lt;h2&gt;Metro is coming&lt;/h2&gt;  &lt;p&gt;Of course building Windows Phone 7 apps I have seen the Metro UI for a while now.&amp;#160; But I am amazed at how many people are now jumping on the Metro theme.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.africangeek.com/"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://infinitecodex.com/image.axd?picture=image_1.png" width="244" height="171" /&gt;&lt;/a&gt;One site that really took the look and feel of Metro and went all out is the &lt;a href="http://www.africangeek.com/" target="_blank"&gt;AfricanGeek.com&lt;/a&gt; site.It is written in Silverlight, but he nailed the whole Windows 8 look and feel for his site.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/InfiniteCodex/~4/-EE_nY3AWLY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/InfiniteCodex/~3/-EE_nY3AWLY/post.aspx</link>
      <author>jasonshort@infinitecodex.com</author>
      <comments>http://infinitecodex.com/infinitecodex/post/2011/10/19/Windows-Runtime-Information-Links.aspx#comment</comments>
      <guid isPermaLink="false">http://infinitecodex.com/infinitecodex/post.aspx?id=3a8c4d55-7862-4f90-a83e-a8418fafb319</guid>
      <pubDate>Wed, 19 Oct 2011 05:44:38 -1500</pubDate>
      <category>General</category>
      <dc:publisher>jshort</dc:publisher>
      <pingback:server>http://infinitecodex.com/infinitecodex/pingback.axd</pingback:server>
      <pingback:target>http://infinitecodex.com/infinitecodex/post.aspx?id=3a8c4d55-7862-4f90-a83e-a8418fafb319</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://infinitecodex.com/infinitecodex/trackback.axd?id=3a8c4d55-7862-4f90-a83e-a8418fafb319</trackback:ping>
      <wfw:comment>http://infinitecodex.com/infinitecodex/post/2011/10/19/Windows-Runtime-Information-Links.aspx#comment</wfw:comment>
      <wfw:commentRss>http://infinitecodex.com/infinitecodex/syndication.axd?post=3a8c4d55-7862-4f90-a83e-a8418fafb319</wfw:commentRss>
    <feedburner:origLink>http://infinitecodex.com/infinitecodex/post.aspx?id=3a8c4d55-7862-4f90-a83e-a8418fafb319</feedburner:origLink></item>
  </channel>
</rss>

