<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dave&#039;s Two Cents</title>
	<atom:link href="http://blog.davemdavis.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.davemdavis.net</link>
	<description>Exploring the world of software development through my eyes!</description>
	<lastBuildDate>Sun, 06 May 2012 15:51:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.davemdavis.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Dave&#039;s Two Cents</title>
		<link>http://blog.davemdavis.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.davemdavis.net/osd.xml" title="Dave&#039;s Two Cents" />
	<atom:link rel='hub' href='http://blog.davemdavis.net/?pushpress=hub'/>
		<item>
		<title>Coming to an End</title>
		<link>http://blog.davemdavis.net/2012/05/06/coming-to-an-end/</link>
		<comments>http://blog.davemdavis.net/2012/05/06/coming-to-an-end/#comments</comments>
		<pubDate>Sun, 06 May 2012 15:51:16 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[Give Camp]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/?p=263</guid>
		<description><![CDATA[Well the weekend of fun is coming to an end. Another GiveCamp is almost in the books.&#160; New friends were made and a good time was had by all.&#160; Cinco-De-Mayo celebration was a nice break.&#160; This weekend, my team an &#8230; <a href="http://blog.davemdavis.net/2012/05/06/coming-to-an-end/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=263&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well the weekend of fun is coming to an end. Another GiveCamp is almost in the books.&nbsp; New friends were made and a good time was had by all.&nbsp; Cinco-De-Mayo celebration was a nice break.&nbsp; This weekend, my team an I worked with <a href="http://www.respondinc.org/Home.aspx">Respond, Inc</a>. to redesign their website and update all the content. Here is a screen shot of their current site:</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/05/before.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="before" border="0" alt="before" src="http://dmd0822.files.wordpress.com/2012/05/before_thumb.png?w=654&#038;h=334" width="654" height="334"></a></p>
<p>As you can see the site needed some love.&nbsp; Thanks to the talent of our designer Amanda, we were able to update the look.&nbsp; Here is the how it looks now, keep in mind that we are still working so the content so some on the screen will change but you get the picture:</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/05/after.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="After" border="0" alt="After" src="http://dmd0822.files.wordpress.com/2012/05/after_thumb.png?w=654&#038;h=326" width="654" height="326"></a></p>
<p>Work will continue up until the end, which is a couple of hours away.&nbsp; Stay tuned for the publish date!</p>
<p>I have to say that after three GiveCamps, the keep getting better.&nbsp; I&nbsp; can’t wait to see what next year brings.&nbsp; To all the sponsors thank you, to all the volunteers until we meet again, and the Jim O’Neil and Kelley Muir for organizing such a fantastic event.&nbsp; I would also like to thank Microsoft for letting us camp out in your spaces, the views can’t be beat (even overcast):</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/05/wp_000036.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000036" border="0" alt="WP_000036" src="http://dmd0822.files.wordpress.com/2012/05/wp_000036_thumb.jpg?w=654&#038;h=492" width="654" height="492"></a></p>
<p align="center">So until next year!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/263/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=263&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2012/05/06/coming-to-an-end/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/05/before_thumb.png" medium="image">
			<media:title type="html">before</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/05/after_thumb.png" medium="image">
			<media:title type="html">After</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/05/wp_000036_thumb.jpg" medium="image">
			<media:title type="html">WP_000036</media:title>
		</media:content>
	</item>
		<item>
		<title>That Time of Year Again! New England Give Camp</title>
		<link>http://blog.davemdavis.net/2012/05/04/that-time-of-year-again-new-england-give-camp/</link>
		<comments>http://blog.davemdavis.net/2012/05/04/that-time-of-year-again-new-england-give-camp/#comments</comments>
		<pubDate>Fri, 04 May 2012 23:29:49 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[Give Camp]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/?p=255</guid>
		<description><![CDATA[Well it is that time of year again.&#160; I am once again volunteering for New England Give Camp.&#160; For one weekend, over a hundred volunteers will help over 20 Non-Profit organizations solve there technical needs, getting help that most of &#8230; <a href="http://blog.davemdavis.net/2012/05/04/that-time-of-year-again-new-england-give-camp/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=255&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://dmd0822.files.wordpress.com/2012/05/givecampcolorlogo2012.jpg"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 11px 0 0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;" title="GiveCampColorLogo2012" border="0" alt="GiveCampColorLogo2012" align="left" src="http://dmd0822.files.wordpress.com/2012/05/givecampcolorlogo2012_thumb.jpg?w=377&#038;h=212" width="377" height="212"></a></p>
<p>Well it is that time of year again.&nbsp; I am once again volunteering for <a href="http://newenglandgivecamp.org/">New England Give Camp</a>.&nbsp; For one weekend, over a hundred volunteers will help over 20 Non-Profit organizations solve there technical needs, getting help that most of these organization would not otherwise get due to cost.&nbsp; Over the coarse of the weekend these organizations will get technical help, attend seminars that help teach them how best to use technology to their advantage, and network with other organizations. </p>
<p><a href="http://dmd0822.files.wordpress.com/2012/05/wp_000028.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:right;border-top:0;border-right:0;padding-top:0;" title="WP_000028" border="0" alt="WP_000028" align="right" src="http://dmd0822.files.wordpress.com/2012/05/wp_000028_thumb.jpg?w=275&#038;h=207" width="275" height="207"></a>This year I will be helping redesign the website for <a href="http://www.respondinc.org/Home.aspx">Respond, Inc</a>.&nbsp; They are New England&#8217;s first domestic violence agency and the second oldest in the nation. My team will be working closely to help solve all their web needs over the course of this weekend.&nbsp; Quite ambitious, I know, but we are up to the challenge.&nbsp; You will have to tune in at the weekend to see the results of our work. Our goal is to leave them with a site that will help them help their clients.</p>
<h3>Camp is in the Name</h3>
<p>That’s right we spend the weekend working into the wee hours of the morning.&nbsp; Some go as far as to pitch a tent.&nbsp; I would like to thank the <a href="http://newenglandgivecamp.org/sponsors-box/">sponsors</a> who keep us fed and caffeinated. Good luck campers!!!</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/05/2011-05-01_08-23-45_358_thumb.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="2011-05-01_08-23-45_358_thumb" border="0" alt="2011-05-01_08-23-45_358_thumb" src="http://dmd0822.files.wordpress.com/2012/05/2011-05-01_08-23-45_358_thumb_thumb.jpg?w=651&#038;h=490" width="651" height="490"></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=255&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2012/05/04/that-time-of-year-again-new-england-give-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/05/givecampcolorlogo2012_thumb.jpg" medium="image">
			<media:title type="html">GiveCampColorLogo2012</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/05/wp_000028_thumb.jpg" medium="image">
			<media:title type="html">WP_000028</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/05/2011-05-01_08-23-45_358_thumb_thumb.jpg" medium="image">
			<media:title type="html">2011-05-01_08-23-45_358_thumb</media:title>
		</media:content>
	</item>
		<item>
		<title>What is This &#8216;LayoutAwarePage&#8217; You Speak Of</title>
		<link>http://blog.davemdavis.net/2012/03/04/what-is-this-layoutawarepage-you-speak-of/</link>
		<comments>http://blog.davemdavis.net/2012/03/04/what-is-this-layoutawarepage-you-speak-of/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 05:35:17 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Windows 8]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/?p=246</guid>
		<description><![CDATA[The other day Microsoft released the Consumer Preview of their&#160; next version of Windows.&#160; The next version of Windows will bring Microsoft in direct competition with iPad and the various Android tablets.&#160; I was excited about this release since I &#8230; <a href="http://blog.davemdavis.net/2012/03/04/what-is-this-layoutawarepage-you-speak-of/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=246&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The other day Microsoft released the <a href="http://windows.microsoft.com/en-US/windows-8/download">Consumer Preview</a> of their&nbsp; next version of Windows.&nbsp; The next version of Windows will bring Microsoft in direct competition with iPad and the various Android tablets.&nbsp; I was excited about this release since I had been using the Developer Preview since it was released.&nbsp; I installed the new version of Windows and the tools to build apps as soon as I could.&nbsp; I wanted to get a handle on developing Metro applications.</p>
<p>So the first thing I decided to do was see if any of the apps I built using the Developer Preview would run in the Consumer Preview.&nbsp; Low and behold neither application would run. After a quick internet search I found <a href="http://go.microsoft.com/fwlink/?LinkID=242888">Microsoft’s guidance</a> on upgrading applications.&nbsp; This document comes in at over a hundred pages.&nbsp; According to what I found they listened to the feedback of early adopters and as such had to make many breaking changes. It was nice to see them listening to the community.&nbsp; It does mean that any developers that created applications will need to spend time converting their apps. Since the applications I are not that import I decided to hold off on upgrading them.</p>
<h3>Making Life Easy</h3>
<p><a href="http://dmd0822.files.wordpress.com/2012/03/commonsfolder.png"><img title="CommonsFolder" style="background-image:none;float:right;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;margin:0 0 0 8px;" border="0" alt="CommonsFolder" align="right" src="http://dmd0822.files.wordpress.com/2012/03/commonsfolder_thumb.png?w=244&#038;h=149" width="244" height="149"></a>So I decided to work on a new project.&nbsp; I started by creating a blank C# Metro Application.&nbsp; After the template finished loading I noticed something new, a ‘Common’ folder.&nbsp; Inside the common folder there are <a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh768232.aspx">some interesting files</a>.&nbsp; The first thing to take a look at is the ReadMe.txt.&nbsp; In there, Microsoft explains what these new classes are there for.</p>
<p>Here is the contents of the ReadMe file:</p>
<blockquote><p>The Common directory contains classes and XAML styles that simplify application development.</p>
<p>These are not merely convenient, but are required by most Visual Studio project and item templates. Removing, renaming, or otherwise modifying the content of these files may result in a project that does not build, or that will not build once additional pages are added.&nbsp; If variations on these classes or styles are desired it is recommended that you copy the content under a new name and modify your private copy.</p>
</blockquote>
<p>That is a little scary. These file are here to help but don’t modify them or your project may never work again.&nbsp; So there are a couple of value converters which are ones I tend to build so thank you Microsoft. There is also a StandardStyles.xaml.&nbsp; This is a nice change for the previous version where the styles were on each new page. I did not think that would carry through to the final version of the templates.&nbsp; </p>
<h3>Layout My Page Please</h3>
<p>This leaves three other classes.&nbsp; The one that I am going to take a deeper look at here is the LayoutAwarePage.&nbsp; I will leave the rest for a different post. The first thing to notice is that the class is heavily commented which is nice but how it used?&nbsp; Well it inherits from Page, so I assume it has to do with code behind files. I did a search of the entire solution for this class and it is not used anywhere.&nbsp; So I created another solution using one of the other templates.&nbsp; All the pages in that template inherit LayoutAwarePage.</p>
<p>One of the complaints I had with the Developer Preview is that there was no easy way to navigate from page to page. There was also no means to capture page history.&nbsp; Hitting the back buttons on a page created by the templates did not necessarily do what the user thought it would.&nbsp; It may or may not navigate to the last page the user visited.&nbsp; Of course you could override that behavior but it required build a custom navigation framework.&nbsp; This is now taken care of in this new class. Here are the convenience methods that handle that for you.</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/03/navigationmethods.png"><img title="NavigationMethods" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="NavigationMethods" src="http://dmd0822.files.wordpress.com/2012/03/navigationmethods_thumb.png?w=634&#038;h=411" width="634" height="411"></a></p>
<p>The Page class has a Frame member that handles the navigation and handles the call stack.</p>
<h3>Handle Those Turns</h3>
<p>One of the sensors that most tablets have is an accelerometer.&nbsp; This allows user to orient their tablets in any orientation they want.&nbsp; Also Metro apps can be snapped side by side with another Metro application.&nbsp; Developers have to handle these changes.&nbsp; In the Developer Preview each page subscribed, in the code behind, to the orientation event that gets fired. This functionality has been abstracted into the LayoutAwarePage class.&nbsp; This makes sense since this class is named LayoutAwarePage. Here are some of the methods that handle that:</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/03/image.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2012/03/image_thumb.png?w=634&#038;h=350" width="634" height="350"></a></p>
<p>I like that this functionality has been centralized and removed from the code behind.&nbsp; I like to develop XAML applications using Mode-View-ViewModel (MVVM) pattern.&nbsp; Anything that helps limit the code in the code behind I am for.&nbsp; So how does MVVM play out in Windows 8.</p>
<h3>Is MVVM Dead?</h3>
<p>When Microsoft released Expression Blend for Windows Phone development, they included a MVVM template.&nbsp; That made a lot of people happy.&nbsp; They started wondering when will there be a temple for MVVM within Visual Studio.&nbsp; Sure there were third party frameworks that contain MVVM templates, <a href="http://www.galasoft.ch/mvvm/">MVVMLight</a> being the one I liked the most.&nbsp; Since there was not a template within the Developer Preview I was hoping that there would be one in the Beta. Alas I was disappointed.</p>
<p>What I did find is that there is a DefaultViewModel in the LayoutAwarePage class. Here is the property declaration:</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/03/image1.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2012/03/image_thumb1.png?w=634&#038;h=177" width="634" height="177"></a></p>
<p>This is implemented as an ObservableDictionary. This view model is set to the pages DataContext in the constructor.</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/03/image2.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2012/03/image_thumb2.png?w=634&#038;h=182" width="634" height="182"></a></p>
<p>“Properties” on the DefaultViewModel as you would using any dictionary.&nbsp; There are two things to note first to pass data between pages through the Frame.Navigate method as NavigationsEventArgs.&nbsp; Second notice the magic strings.&nbsp; Bindings are handled the same as before, binding to the magic string noted above.</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/03/bindingexample.png"><img title="BindingExample" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="BindingExample" src="http://dmd0822.files.wordpress.com/2012/03/bindingexample_thumb.png?w=367&#038;h=72" width="367" height="72"></a>
<p>&nbsp;</p>
<p>I am not sure that I like this.&nbsp; My view models tend to have a little bit of logic in them.&nbsp; It is convenient to be able to pass data in the navigation event but that would mean moving some service/data logic into the code behind.&nbsp; I will have to think about this a bit to figure out how I want to handle my view models.</p>
<h3>Summary</h3>
<p>This was a look at one of the ways that Microsoft is trying to make it more convenient to develop applications.&nbsp; I don’t like the language of the ReadMe text or how they seem to be forcing a paradigm down developers’ throats. Kind of like how Apple treats their iOS developers. I will have to see how much of a pain it will be to use or not use these convenience classes. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=246&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2012/03/04/what-is-this-layoutawarepage-you-speak-of/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/03/commonsfolder_thumb.png" medium="image">
			<media:title type="html">CommonsFolder</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/03/navigationmethods_thumb.png" medium="image">
			<media:title type="html">NavigationMethods</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/03/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/03/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/03/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/03/bindingexample_thumb.png" medium="image">
			<media:title type="html">BindingExample</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 8 is Coming&#8230;.Should I Care?</title>
		<link>http://blog.davemdavis.net/2012/02/20/windows-8-is-coming-should-i-care/</link>
		<comments>http://blog.davemdavis.net/2012/02/20/windows-8-is-coming-should-i-care/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 04:19:18 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Metro]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/?p=230</guid>
		<description><![CDATA[Recently I have been using the Developer Preview of Windows 8.&#160; Back in September Microsoft announced how developers can build the next generation Windows applications. So Microsoft is trying to revamp its tablet industry while moving their operating system forward. &#8230; <a href="http://blog.davemdavis.net/2012/02/20/windows-8-is-coming-should-i-care/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=230&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://dmd0822.files.wordpress.com/2012/02/win8logo.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;" title="Win8Logo" border="0" alt="Win8Logo" align="right" src="http://dmd0822.files.wordpress.com/2012/02/win8logo_thumb.png?w=301&#038;h=64" width="301" height="64"></a>Recently I have been using the Developer Preview of Windows 8.&nbsp; Back in September Microsoft announced how developers can <a href="http://www.buildwindows.com/">build</a> the next generation Windows applications. So Microsoft is trying to revamp its tablet industry while moving their operating system forward. They are developing an operating system that is attempting&nbsp; unify their operating system across platforms and if the rumors are true the next version of the <a href="http://www.zdnet.com/blog/btl/windows-8-and-windows-phone-8-apollo-os-convergence-tango1-and-tango2-and-more/57900">Windows Phone</a>.</p>
<p>In this post I will take a look at what coming and give my feedback on what I have encountered thus far.&nbsp; I have had to opportunity to build a couple of demo applications so I have experienced Windows 8 from the point of a developer and a user.&nbsp; I installed it on the Acer laptop that Microsoft gave away at PDC 2009.&nbsp; Windows 8 runs have way&nbsp; decent on that machine though the touch drivers acts a little funny.</p>
<h3>Architecture</h3>
<p>From the time Microsoft announced Windows 8 to the time they announced the developer experience, there were a lot of rumors as to the fate of <em>Name your favorite development language here. </em>The only known at the time was that HTML5 was going to play a key part of the ecosystem. This sent all the XAML developers into fits. Then along came Build.&nbsp; During the keynote all was revealed: </p>
<p><a href="http://dmd0822.files.wordpress.com/2012/02/win8_arch.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Win8_Arch" border="0" alt="Win8_Arch" src="http://dmd0822.files.wordpress.com/2012/02/win8_arch_thumb.png?w=632&#038;h=357" width="632" height="357"></a></p>
<p>As you can see there are two stacks available for developing applications. The blue stack is the same stack that we have now.&nbsp; The green stack on the left is the new goodness that allows developers to build applications targeted towards the tablet side of the house. These applications are called Metro Apps.&nbsp; As a side note Microsoft has said that these applications will work just as well with a mouse as it will with touch.</p>
<p>These Metro applications operate just like WP7 apps.&nbsp; They operate in a sandbox and can only access external resources through well define contracts.&nbsp; Also they need user permission to access sensors, location data, camera and such.&nbsp; This gives user a constant user experience. Metro apps are built on a core framework called WinRT.&nbsp;&nbsp; WinRT abstracts access to the underlining operating system.&nbsp; It then projects the API in the various languages. </p>
<p>With this architecture, Microsoft open windows application development to a whole new group of people, HTML/Javascript developers.&nbsp; These developers can develop the same rich applications as the XAML developers, using the same WinRT API. This architecture also keeps C#/VB XAML developers in the loop but brings also brings C/C++ into modern times by allowing them to develop rich user experiences.&nbsp; At the same time legacy applications will still run in desktop “mode”. </p>
<p>There are so many new features.&nbsp; Too many to mention is a “short” blog post.&nbsp; In an attempt to solicit feedback early and often the Windows 8 team have been releasing <a href="http://blogs.msdn.com/b/b8/">blog posts</a> about their endeavors to Windows 8. You can read, in detail, the many new features that are coming.&nbsp; You may even influence their course of action by posting comments on each topic.</p>
<h3>Metro Everywhere</h3>
<p>Over the years, Microsoft has paid little attention to User Experience (UX).&nbsp; In contrast Apple has put most of their effort into creating the best UX possible.&nbsp; In order to keep up Microsoft has recently&nbsp; started to develop a common style that places UX in the forefront.&nbsp; It started with Zune software, then it made an appearance in Windows Phone 7, the XBOX dashboard was not far behind, and finally it is the premier UX for the new Windows 8. The style is Metro.</p>
<p>What is Metro? It is a style based on simplicity. Inspired by signage seen in European Subways.&nbsp; The style emphasizes clean line, subtle animations&nbsp; and simple fonts.&nbsp; Metro also takes power consumption into consideration. By standardizing the experience across the Microsoft&nbsp; ecosystem, the user is familiar with how to interact with the system.&nbsp; Couple that with the integration across platform and you can see that Microsoft has definitely learned that UX matters. </p>
<p>For Windows 8, Microsoft has published a set of <a href="http://msdn.microsoft.com/en-us/windows/apps/">design guidelines</a>.&nbsp; These guidelines assists developers and designers, in make compelling UX while adhering to the UX that Microsoft envisions for its users.&nbsp;&nbsp; There has been some rumbling that if you follow those guidelines then how do you differentiate your application from all the rest?&nbsp; Microsoft has even published in its guidelines on how to accomplish differentiation.&nbsp; </p>
<p>Below are some screens shots from one of my demo applications.&nbsp; As you can see I was able to follow the Metro guidelines while allowing my company’s brand shine through.&nbsp; Windows 8 makes it easy to implement a Metro design.&nbsp; There are built in styles and animations that helps in following the Metro guidelines.</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/02/metro1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Metro1" border="0" alt="Metro1" src="http://dmd0822.files.wordpress.com/2012/02/metro1_thumb.png?w=320&#038;h=182" width="320" height="182"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://dmd0822.files.wordpress.com/2012/02/metro3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Metro3" border="0" alt="Metro3" src="http://dmd0822.files.wordpress.com/2012/02/metro3_thumb.png?w=244&#038;h=210" width="244" height="210"></a></p>
<h3>XAML vs. HTML5</h3>
<p>Now that we have a little background on Windows 8 how do we develop applications?&nbsp; The frameworks available are shown in the green boxes above.&nbsp; If you start from choosing a UI technology then your choices are HTML5, XAML, and DirectX.&nbsp; For now we will concentrate on the HTML5 and XAML. Which one do is the best choice?&nbsp; The answer is the same answer it depends. It depends on your skill set and on if you have resources that you want/need to reuse.&nbsp; </p>
<p>Lately Microsoft has been emphasizing HTML5 and downplaying their XAML technologies.&nbsp; In my opinion they are doing this to enable a whole new group of Windows developers.&nbsp; By exposing WinRT in Javascript HTML developers can now can now build rich applications that will run on Win8 tablets. These developers will be able to develop HTML and CSS that can be reused in web applications.&nbsp; There may even be some Javascript that can be reused, as long as the pieces of Javascript that interacts with the WinRT projection, are isolated. </p>
<p>XAML developers need not worry.&nbsp; XAML is there, but not only is it there it has been opened up another language, C/C++.&nbsp; There is even an opportunity for reuse here.&nbsp; The XAML in Win8 is closest to the XAML in Silverlight.&nbsp; The namespaces may be different but the XAML is similar.&nbsp; Also class libraries be able to be reused as long as the functionality exists in WinRT. </p>
<p>So who can develop Win8 Apps? Web developers…..XMAL developers…C++ developers. The ecosystem of developers is large, larger than iOS and Andriod.&nbsp; This was a smart move, in my opinion.&nbsp; In order to steal market share away from those other platforms, Microsoft is going to need a large and varied collections of applications available from day one.&nbsp; By lowering the barrier to development, they may be able to reach that goal. </p>
<h3>It is Just Windows<a href="http://dmd0822.files.wordpress.com/2012/02/win8_dt2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:right;border-top:0;border-right:0;padding-top:0;" title="Win8_DT2" border="0" alt="Win8_DT2" align="right" src="http://dmd0822.files.wordpress.com/2012/02/win8_dt2_thumb.png?w=286&#038;h=163" width="286" height="163"></a></h3>
<p>“I have been developing applications for years, are my skills dead?”&nbsp; The answer to that no. At the end of the day Windows 8 is just Windows.&nbsp; You WPF application will run just as it did in Windows 7.&nbsp; Even your WinForm apps will run.&nbsp; Icons to launch your applications will even appear in the new start menu. As you can see “legacy” applications will appear side by side with new Metro applications.&nbsp; You can even optimize these application for touch</p>
<p>Microsoft has creating an operating system that will run on a 7 inch screen all the way up to a desktop with rather large screens.&nbsp; One of the goals of the system had to have been that it had to run Microsoft’s other cash cow, Office.&nbsp; The current version of Office should run just fine but is not optimized for touch.&nbsp; It is rumored that the next version of Office (Office 15) will have Metro versions of Office applications that will even run on devices that use the ARM processor.&nbsp; The Metro versions will probably on have a limited set of features, features that make sense in a tablet environment.&nbsp; But since a Windows 8 tablet is still just Windows (there is some debate as to the extent of&nbsp; “legacy windows” will be available to ARM devices) the user just has to switch over to the desktop and launch the full version of that Office application. My guess is the functionality of Metro will be close to their Office Online versions.</p>
<p>Another nice feature of having full Windows on a tablet is the security features available.&nbsp; One of the barriers to enabling tablet computers into the corporate environment is security.&nbsp; Most network administrators are nervous when it comes to letting devices onto their networks that they cannot secure using their tried and true means.&nbsp; With Windows 8 they will be able to encrypt the hard drive using BitLocker.&nbsp; They will also have the ability to enforce Group Policy. So securing a table becomes as easy as securing a desktop.</p>
<p><a href="http://dmd0822.files.wordpress.com/2012/02/win8_dt.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="Win8_DT" border="0" alt="Win8_DT" src="http://dmd0822.files.wordpress.com/2012/02/win8_dt_thumb.png?w=641&#038;h=362" width="641" height="362"></a></p>
<h3>App Store</h3>
<p>Another lesson learned from WP7 is they have to control the user experience when it comes to Metro applications.&nbsp; To do this they are creating an <a href="http://blogs.msdn.com/b/windowsstore/">App Store</a>.&nbsp; This will be the only place where applications will be able to be loaded.&nbsp; Applications must be submitted to Microsoft where they will be tested to ensure that they are safe for user to install.&nbsp; The App Store is also where developer will be able to monetize their work. </p>
<h3>Summary</h3>
<p>This was a long post but there is some much that Windows 8 encompasses that I did not even scratch the surface. My observations have been made against the Developer Preview which has been out since September. With this release the development tooling is a little lacking, only an express edition of the next version of Visual Studio and an Expression Blend that only works with HTML5 applications.&nbsp; There quite a few bug that popped up from time to time.&nbsp; In less than 2 weeks a Consumer Preview will be released with a final version rumored to arrived later in the year.&nbsp;&nbsp; </p>
<p>If Microsoft is able to deliver all that they have announced thus far they will have a viable competitor to Andriod and iOS.&nbsp; They have taken a page out of Apple’s book and kept the details of Windows 8 under tight wrap. Hopefully the next release of Win8 will more details of what is yet to come.&nbsp; I have enjoyed developing Metro apps and the tablets given to Build Attendees is a nice piece of hardware.&nbsp; I am looking forward to the different form factors that been rumored to be delivered later in the year.&nbsp; I just hope that Microsoft does Windows 8 right and that it does not become another Windows Vista!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=230&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2012/02/20/windows-8-is-coming-should-i-care/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/win8logo_thumb.png" medium="image">
			<media:title type="html">Win8Logo</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/win8_arch_thumb.png" medium="image">
			<media:title type="html">Win8_Arch</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/metro1_thumb.png" medium="image">
			<media:title type="html">Metro1</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/metro3_thumb.png" medium="image">
			<media:title type="html">Metro3</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/win8_dt2_thumb.png" medium="image">
			<media:title type="html">Win8_DT2</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/win8_dt_thumb.png" medium="image">
			<media:title type="html">Win8_DT</media:title>
		</media:content>
	</item>
		<item>
		<title>Everything Goes in Cycles</title>
		<link>http://blog.davemdavis.net/2012/02/15/everything-goes-in-cycles/</link>
		<comments>http://blog.davemdavis.net/2012/02/15/everything-goes-in-cycles/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 02:26:50 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/?p=216</guid>
		<description><![CDATA[Recently a colleague of mine at BlueMetal Architects presented to the following trend image: State of The Environment I find it funny how these things go in cycles.&#160; It is like the cycle of Client/Server –&#62; Desktop –&#62; Distributed.&#160; If &#8230; <a href="http://blog.davemdavis.net/2012/02/15/everything-goes-in-cycles/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=216&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently a colleague of mine at <a href="http://www.bluemetal.com">BlueMetal Architects</a> presented to the following trend image: </p>
<p><a href="http://dmd0822.files.wordpress.com/2012/02/trends.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Trends" border="0" alt="Trends" src="http://dmd0822.files.wordpress.com/2012/02/trends_thumb.png?w=598&#038;h=341" width="598" height="341"></a></p>
<h3>State of The Environment</h3>
<p>I find it funny how these things go in cycles.&nbsp; It is like the cycle of Client/Server –&gt; Desktop –&gt; Distributed.&nbsp; If you think about it the technology of the time dictates the paradigm flavor of the month.&nbsp; Take the switch from web apps to native switch right around the time smartphones started to become more common.&nbsp; Native apps emerged to take full advantage of the hardware they were running on. Along comes HTML5 that starts to take advantage of parts of this functionality. So where does that leave us? Go native? Ride the leading edge of HTML5?</p>
<p>One of the reason native applications became prevalent in mobile applications is because the vendors keep out plugins that enabled rich applications. That left the developer with two choices: a) go native or b) go web.&nbsp; Each of these has advantages and disadvantages. Native allows the developer to utilize the full feature set of the device, but for companies that want to be on all platforms, this requires redevelopment of the app into each native form.&nbsp; If the developer decides to go the web route, they cut down on development time/costs but more than likely they can’t take advantage for all the capabilities the devices have to offer.&nbsp; They also develop an app that doesn’t follow the visual design standards for the device. Windows Phone has <a href="http://msdn.microsoft.com/en-us/library/ff637515%28v=VS.92%29.aspx">Metro</a>, Apple wants their apps to look like iOS apps, and even <a href="http://developer.android.com/design/index.html">Google has guidelines for Andriod</a>. </p>
<h3>Keeping Developer Costs Low</h3>
<p>So how do companies keep their development costs low while creating native apps for all the platforms?&nbsp; They use frameworks that take one language as input and output native applications or HTML5 equivalents.&nbsp; The input languages could be HTML5, Xaml, C#, or others.&nbsp; The problem with approach is that the conversions don’t always take advantage of all the functionality of the devices. Or they can only handle a small subset of tasks (look at <a href="http://www.componentart.com/products/mds/">ComponentArt Mobile Dashboard Server</a>). The ComponentArt server takes in Xaml and outputs many different formats that works on all different platforms.&nbsp; The problem is that the input is Xaml markup of a ComponentArt dashboard. </p>
<p><a href="http://dmd0822.files.wordpress.com/2012/02/converter.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Converter" border="0" alt="Converter" align="left" src="http://dmd0822.files.wordpress.com/2012/02/converter_thumb.png?w=377&#038;h=209" width="377" height="209"></a></p>
<p>Another barrier to conversion frameworks is cost.&nbsp; So you are cutting developer costs but the costs of the different frameworks may wipe out and savings you are getting.&nbsp; The aforementioned ComponentArt Server cost in excess of $10k (at the time of this post).&nbsp; That’s a lot to pay for such limited functionality.&nbsp; When evaluating whether to use one of these frameworks you should keep the cost vs. functionality in mind.</p>
<h3>The Best of Both Worlds</h3>
<p>Some organizations try to get the best of both worlds by creating hybrid applications.&nbsp; They use native where it makes sense and incorporate HTML components when needed.&nbsp; This allows them to create reusable components that can then be utilized within native applications.&nbsp; This is just one way to get reusability out of common components. There are issues here.&nbsp; Not all platforms handle hosting HTML within native apps the same so there maybe some workarounds that need to be implemented.&nbsp; So how much time/money are you really saving.</p>
<h3>Reusability to the Max</h3>
<p><a href="http://dmd0822.files.wordpress.com/2012/02/cloud.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;" title="Cloud" border="0" alt="Cloud" align="right" src="http://dmd0822.files.wordpress.com/2012/02/cloud_thumb.png?w=302&#038;h=151" width="302" height="151"></a></p>
<p>Another way to maximize reusability is to encapsulate as much business/data access logic behind web services.&nbsp; Now the native app only has to handle creating a compelling user experience for displaying data.&nbsp; That is where native apps excel.&nbsp; Developers can take advantage of the capabilities/design guidelines of each platform.&nbsp; What’s the catch? Well this approach requires the device to always have a connection and in certain situations a high bandwidth connection (data dependent). </p>
<h3>When is Enough, Good Enough</h3>
<p>Sometimes you have to ask yourself “When is enough, good enough” for my users.&nbsp; There are situations when a mobile optimized web application is “good enough”.&nbsp; If your applications does not require an accelerometer or fancy touch gestures then go ahead and build that web app.&nbsp; Content delivery applications are another good candidate for the web.&nbsp; These apps usually don’t have heavy interactivity requirements. Besides at the end of the day <a href="http://www.indystar.com/usatoday/article/52891556">most users ignore apps on their mobile devices</a>.</p>
<h3>Summary </h3>
<p>At the end of the day there is no right or wrong answer to what app should I build.&nbsp; The situations, time, developer skill set, target audience, and budget are all going to factor into the decision on application type.&nbsp; It is always good to look at the trends leading up to this point in time.&nbsp; </p>
<p>What will the future hold?&nbsp; Which paradigm will drive future development?&nbsp; These are questions that only time will tell. If we don’t learn from the past we are destine to relive it. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=216&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2012/02/15/everything-goes-in-cycles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/trends_thumb.png" medium="image">
			<media:title type="html">Trends</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/converter_thumb.png" medium="image">
			<media:title type="html">Converter</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2012/02/cloud_thumb.png" medium="image">
			<media:title type="html">Cloud</media:title>
		</media:content>
	</item>
		<item>
		<title>Code Once Use Twice&#8230;.or More</title>
		<link>http://blog.davemdavis.net/2011/07/05/code-once-use-twice-or-more/</link>
		<comments>http://blog.davemdavis.net/2011/07/05/code-once-use-twice-or-more/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 13:04:15 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/2011/07/05/code-once-use-twice-or-more/</guid>
		<description><![CDATA[If you have programed against any of Microsoft’s Xaml based user interface frameworks then you might have heard about the MVVM (Model-View-ViewModel) pattern.&#160; One of the benefits of this pattern is the separation of the view&#160; from the view model.&#160; &#8230; <a href="http://blog.davemdavis.net/2011/07/05/code-once-use-twice-or-more/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=209&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have programed against any of Microsoft’s Xaml based user interface frameworks then you might have heard about the MVVM (Model-View-ViewModel) pattern.&nbsp; One of the benefits of this pattern is the separation of the view&nbsp; from the view model.&nbsp; All of the logic lives in the view model which is then bound to the view.&nbsp; This separation allows for rapid revolutions of the visual components.&nbsp; All that is needed is to recreate the Xaml and go.&nbsp; What is you do that across Xaml technologies?&nbsp; As of now Microsoft has three Xaml based UI Frameworks, WPF, Silverlight, WP7 (which is of course is a variant of Silverlight 3).&nbsp; There is even a hint of a <a href="http://www.zdnet.com/blog/microsoft/under-the-windows-8-hood-questions-and-answers-from-the-trenches/9738?pg=1">new/revamped Xaml Framework in Windows 8</a>.</p>
<p>I have recently started to look at reusing a Silverlight 4 ViewModels in a WP7 applications. I figured this would probably be the easiest place to start since they are both Silverlight. I was recently asked what would it take to make a component reusable across Silverlight and WPF.&nbsp; That figures right into my ViewModel sharing research. I will start by looking at different ways to share code across all three frameworks.&nbsp; In a future post I will explore ways to reuse Xaml.</p>
<h3></h3>
<h3>The Challenges</h3>
<p>Let’s start off by examining the challenges associated with this task.&nbsp; The first challenge is the fact that they are three different frameworks that are designed for three different use cases.&nbsp; That means that any reusable code would have to be coded to the lowest common denominator.&nbsp; In this case it means WP7. </p>
<p>For this post I don’t have any working code to share but I have been trying a few things.&nbsp; One of the first things I ran into was in the System.ServiceModel namespace.&nbsp; Each framework handles calling web services differently.&nbsp; Silverlight and WP7 can only make calls asynchronously and WPF defaults to synchronous calls.&nbsp; I am still working out how I want to handle this.&nbsp; There are other challenges too, take third party libraries for instance. </p>
<p>Another challenge that you are going to face is keeping consistent namespaces across the frameworks.&nbsp; If your organization has a strict naming convention then this could become a challenge.&nbsp; Luckily you control what your namespaces are but it can become quite hairy if you are not careful.&nbsp; </p>
<p>Third Party Libraries are usually compiled against specific runtimes.&nbsp; The third party library that I consistently use when working with Xaml is the <a href="http://galasoft.ch/mvvm/">MVVM Light Toolkit</a>.&nbsp; Luckily the MVVM Light Toolkit is compiled against the different Xaml runtimes and the functionality is consistent across the frameworks.&nbsp; But with other libraries you may not be as lucky.&nbsp; Now it is time to talk about the different options available for reuse.</p>
<h3>Copy and Paste</h3>
<p><a href="http://dmd0822.files.wordpress.com/2011/07/copyandpaste.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;" title="CopyAndPaste" border="0" alt="CopyAndPaste" align="right" src="http://dmd0822.files.wordpress.com/2011/07/copyandpaste_thumb.png?w=203&#038;h=334" width="203" height="334"></a>The most basic method is copy and paste.&nbsp; This is a quick and dirty solution.&nbsp; First you create a file that works in one framework.&nbsp; Then you create that same file in the other projects copying the code from the original class to the new class.&nbsp; The up side to this method is that you can tweak the code for each framework.&nbsp; But red flags should be waving and alarms sounding. </p>
<p>Copy and paste architecture is NOT the key to a reusable strategy.&nbsp; There is no means to update the code once it resides in each project since the code is not linked together. Any change would need to be propagated across the different files.&nbsp; Which may be ok if there is one “shared” file and more than that and you are asking for a nightmare. In other words there is no maintainability or scalability with this option.</p>
<h3>Add As a Link</h3>
<p><a href="http://dmd0822.files.wordpress.com/2011/07/addaslinkdiag.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;margin:0 15px 0 0;" title="AddAsLinkDiag" border="0" alt="AddAsLinkDiag" align="left" src="http://dmd0822.files.wordpress.com/2011/07/addaslinkdiag_thumb.png?w=303&#038;h=188" width="303" height="188"></a>The next option I explored is add linked files to the projects. For this method you create a class in on project and then add it as a link to another project.&nbsp; In the “Add Existing Items” dialog you can navigate to the file you want to link and select “Add As Link” from the “Add” button dropdown.</p>
<p>&nbsp;</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/07/addaslink.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;" title="AddAsLink" border="0" alt="AddAsLink" align="right" src="http://dmd0822.files.wordpress.com/2011/07/addaslink_thumb.png?w=257&#038;h=273" width="257" height="273"></a>You can tell the file is linked by the icon of the file in the linked project. With this solution there is only one physical copy of the file.&nbsp; Each project then compiles the file against the proper framework. The up side to this approach is that there is only one file to maintain.&nbsp; On the downside namespaces can become an issue. You may also have to use conditional compile tags if modifications are needed.&nbsp; Conditional tag will allow for the use of different using statements when it comes to third part libraries as long as the internal namespaces are consistent.</p>
<h3>Portable Library Tools</h3>
<p>The final method I looked at was the <a href="http://msdn.microsoft.com/en-us/library/gg597391.aspx">Portable Library Tools</a> from Microsoft. The Portable Library tools </p>
<blockquote><p>is a new Visual Studio add-in from Microsoft that enables you to create C# and Visual Basic libraries that run on a variety of .NET-based platforms without recompilation. – Visual Studio Gallery Description</p>
</blockquote>
<p>The add-in can be downloaded from the <a href="http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/">Visual Studio Gallery</a>.&nbsp; This method allows you to create a class library that can run against many of the .Net runtimes.&nbsp; To accomplish this the class library compiles against a very restrictive version of the .Net framework.&nbsp;&nbsp; This can be a challenge when planning out what to include in a reusable library.</p>
<p>Since this project is still in the CTP/Beta phase not all of the available frameworks libraries have been included. Most notably there is no odata support so you cannot create a reusable odata access library with this tool. According to the Q and A tab in the gallery there is a product road map that plans to include more of the framework. </p>
<p>On a side note it looks like this tool is part of the developer story for Windows 8.&nbsp; Take a look at the response, on the <a href="http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/">Q and A Tab</a>, to the “System.Threading.Thread problem” question. </p>
<blockquote><p>We needed to remove explictly thread creation for a reason that we&#8217;re not ready to discuss yet (ask me again in 3 months).</p>
</blockquote>
<p>Note that the <a href="http://www.buildwindows.com/">Build Windows Conference</a> is three months away.</p>
<h3>Conclusion </h3>
<p>Sorry there is not any working code for this post.&nbsp; I am still mulling over how I want to accomplish my goals.&nbsp; I wanted to put this together to organize my thoughts and get feedback from others who have tried for reusable nirvana.&nbsp; One of the lessons that I have learned so far is be picky about what you include.&nbsp; The different frameworks kind of take care of that for you by restricting what libraries are available.</p>
<p>The other early lesson I have garnered from my investigation is that you have to be more aware of Framework updates that could break your reusable code.&nbsp; There is a lot of churn happening right now with Xaml frameworks (Silverlight 5 and WP7.1).&nbsp;&nbsp; New releases may break what you are doing but they may also bring in more components that can be reusable!&nbsp; </p>
<p>Next I will be looking to see how compatible Xmal is across the different frameworks. The ultimate goal is to develop a strategy that allows components to be used across Silverlight, WPF and Windows Phone.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/209/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=209&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2011/07/05/code-once-use-twice-or-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/07/copyandpaste_thumb.png" medium="image">
			<media:title type="html">CopyAndPaste</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/07/addaslinkdiag_thumb.png" medium="image">
			<media:title type="html">AddAsLinkDiag</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/07/addaslink_thumb.png" medium="image">
			<media:title type="html">AddAsLink</media:title>
		</media:content>
	</item>
		<item>
		<title>Greetings From New England givecamp!</title>
		<link>http://blog.davemdavis.net/2011/05/01/greetings-from-new-england-givecamp/</link>
		<comments>http://blog.davemdavis.net/2011/05/01/greetings-from-new-england-givecamp/#comments</comments>
		<pubDate>Sun, 01 May 2011 12:57:50 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/2011/05/01/greetings-from-new-england-givecamp/</guid>
		<description><![CDATA[What can you do with 48 hour and over 120 volunteers.&#160; I will tell you what we did.&#160; We helped out over 25 charity with variety technical projects.&#160; Projects that would normally not get done because of lack of budget &#8230; <a href="http://blog.davemdavis.net/2011/05/01/greetings-from-new-england-givecamp/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=201&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://dmd0822.files.wordpress.com/2011/05/givecampcolorlogo2011.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;" title="GiveCampColorLogo2011" border="0" alt="GiveCampColorLogo2011" align="right" src="http://dmd0822.files.wordpress.com/2011/05/givecampcolorlogo2011_thumb.png?w=342&#038;h=193" width="342" height="193" /></a>What can you do with 48 hour and over 120 volunteers.&#160; I will tell you what we did.&#160; We helped out over 25 charity with variety technical projects.&#160; Projects that would normally not get done because of lack of budget and lack of skill but desperately needed none the less.&#160; </p>
<p>This weekend was the second annual <a href="http://newenglandgivecamp.org/" target="_blank">New England givecamp</a>.&#160; A weekend dedicated to helping out charities with technical projects.&#160; These projects range from designing web sites to building out content management systems.&#160; In addition to getting technical help there are seminars designed to help charities make the most of the technology they are getting.&#160; This weekend there were sessions on content management, engaging social media, and others to help these organizations grow in a highly technological world.</p>
<p>First I would like to thank all the sponsors of providing the means to fuel all the activities this weekend.&#160; What does it take to keep developers developing…..a lot of support so again thanks.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_08-03-07_699.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="2011-05-01_08-03-07_699" border="0" alt="2011-05-01_08-03-07_699" src="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_08-03-07_699_thumb.jpg?w=617&#038;h=464" width="617" height="464" /></a></p>
<p>Next I would like to thank Jim O’Neil and Kelley Muir for organizing the event.&#160; It may not have seemed it to you but to us it was very well organized.&#160; Leaps and bounds over last year.&#160; Which means next years should be spectacular…..no pressure!</p>
<p>The one thing you need to realize is that the word camp is in the title and camped we did.&#160; A number of the volunteers camped out here at <a href="http://microsoftcambridge.com/Default.aspx?pmc=bing" target="_blank">Microsoft’s New England Research and Development Center</a>, affectionately known as NERD! Thank you Microsoft for letting us have run of your beautiful facility for the weekend. There was plenty of room for people to pull up a piece of the floor, grab a couch and pitch a tent……wait pitch a tent?&#160; That’s right some people even pitch tents!</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_08-23-45_358.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="2011-05-01_08-23-45_358" border="0" alt="2011-05-01_08-23-45_358" src="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_08-23-45_358_thumb.jpg?w=596&#038;h=448" width="596" height="448" /></a></p>
<p>As I stated before it takes a lot of food to keep an Army of Techies moving.&#160; The food this year did not disappoint!&#160; We had&#160; chowdah from <a href="http://shop.legalseafoods.com/?source=MSN&amp;page=homepage/pd/1" target="_blank">Legals</a>, sandwiches for <a href="http://www.getcosi.com/" target="_blank">Cosi</a> and pizza from <a href="http://www.nakedpizza.biz/" target="_blank">Naked</a>.&#160; </p>
<p><a href="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_07-51-35_478.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="2011-05-01_07-51-35_478" border="0" alt="2011-05-01_07-51-35_478" src="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_07-51-35_478_thumb.jpg?w=621&#038;h=468" width="621" height="468" /></a></p>
<p>And when there was too much food what did givecamp do?&#160; Give it away, of course, to a local shelter:</p>
<blockquote><p>“took <a href="http://twitter.com/#!/search?q=%23givecamp">#givecamp</a> leftovers, fruit, chips to <a href="http://www.casparinc.org/" target="_blank">CASPAR in Cambridge</a> &#8211; shelter housing 100 tonight. Another way <a href="http://twitter.com/#!/search?q=%23negc2011">#negc2011</a> makes a difference.” <a href="http://twitter.com/#!/jimoneil">@jimoneil</a></p>
</blockquote>
<p>So here we sit, the morning of the final day.&#160; Tech teams have 5 hours to get their projects done.&#160; They are frantically racing to deliver quality projects to their charities.&#160; The key word is quality.&#160; The goal is to handover all the work to the charities so they can build upon a foundation laid out by their tech teams.</p>
<p>So until next year I leave you give camp with this quote</p>
<blockquote><p>“Ladies and gentlemen, take my advice, pull down your pants and slide on the ice.” Dr. Sidney Freedman (M.A.S.H.)</p>
</blockquote>
<p>And I would add </p>
<blockquote><p>Get out of your office and do something nice!</p>
</blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=201&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2011/05/01/greetings-from-new-england-givecamp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/05/givecampcolorlogo2011_thumb.png" medium="image">
			<media:title type="html">GiveCampColorLogo2011</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_08-03-07_699_thumb.jpg" medium="image">
			<media:title type="html">2011-05-01_08-03-07_699</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_08-23-45_358_thumb.jpg" medium="image">
			<media:title type="html">2011-05-01_08-23-45_358</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/05/2011-05-01_07-51-35_478_thumb.jpg" medium="image">
			<media:title type="html">2011-05-01_07-51-35_478</media:title>
		</media:content>
	</item>
		<item>
		<title>Controlling Silverlight Child Windows Using MVVM</title>
		<link>http://blog.davemdavis.net/2011/04/22/controlling-silverlight-child-windows-using-mvvm/</link>
		<comments>http://blog.davemdavis.net/2011/04/22/controlling-silverlight-child-windows-using-mvvm/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 20:19:24 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[MVVMLight]]></category>
		<category><![CDATA[Software Architecture]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/2011/04/22/controlling-silverlight-child-windows-using-mvvm/</guid>
		<description><![CDATA[A while ago I wrote a post called “Silverlight Child Window With MEF and MVVM Light” where I laid out an approach on how to implement a child window in Silverlight while following MVVM.&#160; Some of the challenges of using &#8230; <a href="http://blog.davemdavis.net/2011/04/22/controlling-silverlight-child-windows-using-mvvm/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=190&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A while ago I wrote a post called “<a href="http://blog.davemdavis.net/2010/07/24/silverlight-child-window-with-mef-and-mvvm-light/" target="_blank">Silverlight Child Window With MEF and MVVM Light</a>” where I laid out an approach on how to implement a child window in Silverlight while following MVVM.&nbsp; Some of the challenges of using MVVM center around keeping UI specifics out of the view model.&nbsp; Keeping UI out of the view model is not mandatory but seems to a generally accepted practice.&nbsp; So how do you launch UI without referencing UI?&nbsp; In my previous approach I used <a href="http://galasoft.ch/mvvm/" target="_blank">MVVMLight’s</a> to message to the active view to launch the dialog.&nbsp; The dialog would then message back with any return results that the view model would handle. A big component for passing objects around was MEF.&nbsp; In this post I am going show a couple of different ways to accomplish the same thing without using MEF, though I am still using MVVMLight.</p>
<h3>Goals</h3>
<p>The ultimate goal is to keep the UI specifics out of the view model.&nbsp; This separation increases the reusability of the view models while at the same time allowing for maintainability and testability.&nbsp; Another goal is to abstract out the launching of child windows so that they can be easily launched from any view.&nbsp; A good example of this is an Error Window.&nbsp; I will show an example of this in this post.</p>
<p>In this post I will show launching a dialog that requires passing data from the view. I will show an example that returns data from a dialog that the view model can consume. Finally I will show an example that takes my ReturnAction&lt;T&gt; object (described in my last post <a href="http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/" target="_blank">here</a>) to handle passing data back including any exceptions.&nbsp; You should be able to handle any situations by interchanging these building blocks.&nbsp; </p>
<p>All of my child windows have their own view models so I am limiting the amount of code I place in my view’s code behind.&nbsp; I am not an MVVM purist.&nbsp; I believe you can put code in the code behind as long as you limit it to view specific code and do not do any business logic there.&nbsp; In my case I will be setting properties on the DataContext (ViewModels).&nbsp; I will also be closing the child windows from the code behind as you will see in later examples.</p>
<h3></h3>
<p>The Pieces </p>
<p>The first step is to abstract the launching of the dialogs.&nbsp; To accomplish this I create a navigation service.&nbsp; Here is the interface for my navigation service:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image13.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb13.png?w=610&#038;h=105" width="610" height="105"></a></p>
<p>As you can see I have three different child windows in this demo, each requiring different data.&nbsp; Note you could also add a method for navigating to other pages if you are using a Silverlight Navigation application.&nbsp; This would allow you to navigate from page to page from the view models.</p>
<p>The actual implementation is responsible for launching the child windows passing any required arguments.&nbsp; Here is what my implementation looks like:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image14.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb14.png?w=602&#038;h=256" width="602" height="256"></a></p>
<p>Note the two different ways I am passing arguments to the child windows.&nbsp; In the first method I am passing an exception to the constructor of the ErrorView child window.&nbsp; I will then pass this parameter to the DataContext in the code behind of the ErrorView.&nbsp; The second dialog takes no arguments and returns a message that gets displayed in the main view.&nbsp; The final dialog takes a ReturnAction&lt;T&gt; which it uses to pass the results back to the main view. </p>
<p>The NavigationService is injected into the ViewModels&nbsp; from the ServiceProviderBase through the ViewModel Locator (described in my last post <a href="http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/" target="_blank">here</a>).&nbsp; I treat the NavigationService just like I treat the my service wrappers from my service layer.&nbsp; The NavigationService provides a service for the view model.&nbsp; </p>
<h3></h3>
<h3></h3>
<h3></h3>
<h3>A Reusable Error Dialog</h3>
<p>One of the most common dialog in an application should be the error dialog.&nbsp; There should be a mechanism to display friendly messages when an exception happens.&nbsp; This is especially useful when fault exceptions come back from service calls.&nbsp;&nbsp; I will be showing an example of this when I show the dialog that works with my ReturnAction&lt;T&gt;.&nbsp; For now I am going to explain how I implemented the ErrorView dialog.</p>
<p>You can see from the code above that I am passing the exception to the DisplayError method in my navigation service.&nbsp; It then calls the constructor on the ErrorView passing the exception:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image15.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb15.png?w=582&#038;h=144" width="582" height="144"></a></p>
<p>In the constructor I am casting the DataContext as an ErrorViewModel.&nbsp; I the set a property, that I created, with that exception.&nbsp; The DataContext is set in my Xaml (described in my last post <a href="http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/" target="_blank">here</a>).&nbsp; Through the magic of data binding the dialog calls ToString() on the exception and displays it to the user.&nbsp; If the dialog looks familiar it is because it is the same one that gets created by the “Silverlight Business Application” template in the New Project dialog.&nbsp; This shows how easily that can be adapted to fit this architecture. </p>
<p>Now to launch the dialog I bind a command to the button from the MainViewModel:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image16.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb16.png?w=594&#038;h=110" width="594" height="110"></a></p>
<p>That is how easy it is one line of code (line 77).</p>
<h3></h3>
<h3>Handling Return Data</h3>
<p>The next example will show how I handle dialogs that need to return data to the underlying View/ViewModel.&nbsp; In this example I am going to use the Messaging capabilities of the MVVMLight framework.&nbsp; There is nothing fancy with how I create the dialog.&nbsp; It is exactly the same way I created the ErrorView dialog above except that I am not passing any arguments. This is the dialog that gets launched:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image17.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb17.png?w=491&#038;h=377" width="491" height="377"></a></p>
<p>I bind a command to the ‘Ok’ button from the ViewModel:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image18.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb18.png?w=621&#038;h=97" width="621" height="97"></a></p>
<p>Here the Messenger class takes a MyMessage object and sends it out setting TheMessage property with the text in the TextBox. In the MainViewModel I subscribe to the message from the dialog.&nbsp; It takes the MyMessage object and uses it to set a property on the MainViewModel that is bound to a TextBlock on the view:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image19.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb19.png?w=635&#038;h=125" width="635" height="125"></a></p>
<p>The final thing to do is close the dialog.&nbsp; Since we removed the click handler from the ‘Ok’ button, the code that usually closes the dialog no longer gets called.&nbsp; So I subscribe to the same message in the dialog’s code behind.&nbsp; In the Action of the message I call the code that closes the dialog.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image20.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb20.png?w=608&#038;h=137" width="608" height="137"></a></p>
<p>One thing to note, it does not matter what you set DialogResult to.&nbsp; We are not subscribing to the close event of the dialog.&nbsp; We are handling any business logic (whether the user clicked ‘Cancel’ or ‘Ok’) through messaging.&nbsp; It is up to the view models to take appropriate actions.&nbsp; Theoretically you could hold off sending the message until a service returned and not do it right on the button click.&nbsp; This would allow for a save action, for instance, to complete prior to closing the dialog.&nbsp; But the decision to&nbsp; close now resides with the view models and not the view.</p>
<h3></h3>
<h3>An Alternate Way</h3>
<p>The previous example is one way to get data back from a dialog.&nbsp; Here is another way.&nbsp; It is a combination of the ErrorView (getting an object in) and the last example getting data back.&nbsp; In the ErrorView example I use the view code behind to set a property on the DataContext.&nbsp; Here is an alternate way to accomplish the same task without using the code behind:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image21.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb21.png?w=644&#038;h=113" width="644" height="113"></a></p>
<p>To understand what the ReturnAction&lt;T&gt; is look at my previous post <a href="http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/" target="_blank">here</a>.&nbsp; In a nutshell it captures a return object or and exception and allows the caller to create a call back method that gets called when the Notify method is called.&nbsp; Here is the ReturnAction&lt;T&gt; getting created:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image22.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb22.png?w=651&#038;h=98" width="651" height="98"></a></p>
<p>The constructor takes an Action callback which I will show in a few minutes.&nbsp; In the dialog I create commands to bind to buttons on the dialog. For this example I simulate a message and simulate an exception being thrown:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image23.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb23.png?w=653&#038;h=226" width="653" height="226"></a></p>
<p>(Note: I still have to use the Messenger to close the dialog).</p>
<p>In the MainViewModel I can now handle the action appropriately.&nbsp; If there is a message I can display it and if there is an error I can handle it.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image24.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb24.png?w=676&#038;h=248" width="676" height="248"></a></p>
<h3>Conclusion</h3>
<p>These example should give you some ideas as to how easy it is to use MVVM in your Silverlight Applications while dealing with Child Windows.&nbsp; With a little bit of infrastructure in place you are able to work with different views passing data back and forth.</p>
<p>If you want to play with the code you can get it <a href="http://dl.dropbox.com/u/16582482/ChildWindowExample.zip" target="_blank">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/190/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=190&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2011/04/22/controlling-silverlight-child-windows-using-mvvm/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb23.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb24.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Isolating OData Calls in Silverlight.</title>
		<link>http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/</link>
		<comments>http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 20:34:08 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[OData]]></category>
		<category><![CDATA[Software Architecture]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/2011/04/18/isolating-odata-calls-in-silverlight/</guid>
		<description><![CDATA[As Software Engineers we strive to build elegant solutions.&#160; We tend to layer our architecture so that our code is modular so that our code is testable and maintainable.&#160; With Silverlight this poses some particular challenges specifically when dealing with &#8230; <a href="http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=165&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As Software Engineers we strive to build elegant solutions.&nbsp; We tend to layer our architecture so that our code is modular so that our code is testable and maintainable.&nbsp; With Silverlight this poses some particular challenges specifically when dealing with external services.&nbsp; All external calls from with Silverlight are asynchronous in order to prevent developers from locking up the UI thread waiting for the response. How do we build our applications to conform to this while keeping us from tightly coupling our applications to the services we consume.</p>
<p>In this post I will document an approach that I have used a couple of times that allows me to layer my Silverlight application in the way I would any other application.&nbsp; That is the first trick to developing in Silverlight.&nbsp; Treat the Silverlight part of the application as if it were is its own application, because it is! This holds true whether you are using RIA Services or getting your data from an external web service. By treating it as its own application you tend to bring in accepted coding practices but as I stated before there are some challenges.</p>
<p>For this blog I am going to use a project that I just started and will be working in my spare time.&nbsp; I am building a File downloader to download content from <a href="http://live.visitmix.com/" target="_blank">Microsoft’s Mix11 Conference</a>. This little project was inspired by a project <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/12/31/rebuilding-the-pdc-2010-silverlight-application-part-7.aspx" target="_blank">Mike Taulty did for last year’s PDC</a>.&nbsp; I know that there are easier ways to download the video content from the conference.&nbsp; Scott Hanselmen documents one such way by using the <a href="http://www.hanselman.com/blog/Mix11VideosDownloadThemAllWithRSS.aspx" target="_blank">RSS feeds from Channel 9</a>. This is more of an exercise to build an application that consumes an OData feed while at the same time maintaining an elegant solution. </p>
<p>Here is my initial layer diagram that I am working form:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/layerdiagram.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="LayerDiagram" border="0" alt="LayerDiagram" src="http://dmd0822.files.wordpress.com/2011/04/layerdiagram_thumb.png?w=604&#038;h=289" width="604" height="289"></a></p>
<p>These are the layers that I have come up with and will be working with through out this project.&nbsp; I will be covering the details and interesting aspects of each layer in the following sections.</p>
<h3>Presentation</h3>
<p>I choose to use M-V-VM when I develop with Silverlight.&nbsp; This pattern allows for separation of the UI markup from the functionality.&nbsp; There are many frameworks that help out when working with MVVM.&nbsp; The one I like to use the most is <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVMLight</a>.&nbsp; This is a nice light weight framework that contains a bunch of templates, some base classes and a messaging service.&nbsp; Laurent Bugnion is even adding a light IoC container in the next version.&nbsp; There are other frameworks that perform similar functionality and are just as good (<a href="http://compositewpf.codeplex.com/" target="_blank">Prism</a> for one). I started using MVVMLight a few years ago and haven’t turned back since.</p>
<p>The next key to an elegant solution is to use a ViewModelLocator.&nbsp; There are a few schools of thought when it comes to binding ViewModels to Views.&nbsp; Some new them up in the constructor of the Views.&nbsp; The problem with this is that there is no design time feed back using this method.&nbsp; Others like to declare the binding in Xaml.&nbsp; This is similar to how I do it except that I bind to a property in my ViewModelLocator.&nbsp; With a ViewModelLocator you can control the lifetime of the ViewModel (new instance for each load or created once for the lifetime of the application).</p>
<p>Here is my ViewModelLocator: </p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb5.png?w=564&#038;h=534" width="564" height="534"></a></p>
<p>Here you can see that I am using my locator class to inject a dependency into my ViewModel (I may changes this in the future to use the Simple IoC class from the MVVMLight framework).&nbsp; I create an entry in a Resource Dictionary for my locator class.&nbsp; So binding the ViewModel to the View is as simple as this: </p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb6.png?w=617&#038;h=83" width="617" height="83"></a></p>
<p>In my ViewModelLocator you should notice a class called ServiceProviderBase.&nbsp; You may be asking yourself what purpose does this serve.&nbsp; I will tell you.&nbsp; As you recall from our layer diagram our data access services live in another project. This class serves a factory for serving up our services.&nbsp; In order to have design time data a DesignServiceProvider is created. Let’s take a look at the base class:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image7.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb7.png?w=615&#038;h=416" width="615" height="416"></a></p>
<p>As you can see it is implemented a Singleton and which instance to serve up is determined in the CreateInstance method.&nbsp; This method determines if it is design time or run time and serves up the proper provider.&nbsp; That rounds out my Presentation Layer except for some Resources and Value Converters (the other things that make the UI elegant).</p>
<h3>Model</h3>
<p>You can’t have MVVM with a Model.&nbsp; If you did you would VVM and that just does not look balanced! In this project I am not doing anything fancy.&nbsp; I did decide to create a model that is separate from the model that is generated from the service proxy.&nbsp; This will allow me to switch out the service layer implementation (say when the next conference happens) with little impact to my presentation layer.&nbsp; I handle the mapping in the service layer. That concludes the model layer, I will now return you to your regularly scheduled program…..I told you not too exciting.</p>
<h3>The Commons</h3>
<p>When I am developing Silverlight application, I find that there are some classes I can’t live without.&nbsp; These classes are needed in all the layers so I like to pull them out to a separate project that can be referenced throughout the application.&nbsp; Someday I may even create my own open source collection of these things.&nbsp; One of the biggest short comings of the Silverlight framework is a means to convert an IEnumerable into an ObservableCollection.&nbsp; ObservableCollection’s are used to bind collections to the ItemsSource property of ItemsControls.&nbsp; The observable part is what allows for updates to be delivered to the UI when something changes.&nbsp; So I implement this as an extension method in my common project.&nbsp; This is the kind of stuff that I like to put in.</p>
<p>One of the key things needed to separate out the services from the rest of the application is to have a means handle the asynchronous nature of service calls, especially when they are happening in a different dll. How does that presentation layer know when the service call they made is finished?&nbsp; I have seen a few different ways to handle this including creating events in my service layer that the ViewModels cans subscribe to.&nbsp; This is kind of like recreating the functionality in the proxy.&nbsp; This approach can complicate things when it comes to unit testing.&nbsp; The approach I like to take is to build out an object that contains a callback action.&nbsp; This approach is similar to the approached outlined by Ben Day in his post <a href="http://blog.benday.com/archive/2010/12/24/23300.aspx" target="_blank">Silverlight Asynchronous WCF Calls Without Ruining Your Architecture</a>. Here is my implementation of his ReturnResult object:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image8.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb8.png?w=631&#038;h=733" width="631" height="733"></a></p>
<p>The premise is that this object will be passed into all service calls.&nbsp; When the service returns the Notify method is called with either the results or and exception.&nbsp; The ViewModel can then handle this.&nbsp; This brings us to our Service Layer.</p>
<h3></h3>
<h3>The Serivce Layer</h3>
<p>This is the layer that is responsible for ferrying the data between the source and the Presentation Layer.&nbsp; The source can be anything from an RSS feed to a SOAP Service or in our case an OData feed.&nbsp; Here I am abstracting out the how the data is retrieved allowing the Presentation Layer to concentrate on presentation.&nbsp; I start out by creating a ServiceBase that is responsible for instantiating the proxy.&nbsp; Here is my ServiceBase for the Mix11 OData feed:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image9.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb9.png?w=601&#038;h=430" width="601" height="430"></a></p>
<p>I then create a design time service that returns design data and I create an actual runtime service.&nbsp; In Silverlight all service calls return void.&nbsp; The magic happens in the callback method.&nbsp; How do I get access to my ResultAction&lt;T&gt; object in the callback method?&nbsp; With a proxy created from a web service all the service method calls have an overload that takes an object that is available in the callback.&nbsp; all you have to do is cast it as the ReturnAction&lt;T&gt; and be on your way.&nbsp; I could not find such a thing when dealing with the DataServiceCollection&lt;T&gt; object used to pass queries to the OData service.&nbsp; So I created my own caller that inherits from DataServiceCollection&lt;T&gt; and has a property to hold any state that must persist after the call returns.&nbsp; Here is my caller:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image10.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb10.png?w=572&#038;h=625" width="572" height="625"></a></p>
<p>And here is an example of this class in action pre call:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image11.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb11.png?w=582&#038;h=120" width="582" height="120"></a></p>
<p>and post call:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image12.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb12.png?w=577&#038;h=363" width="577" height="363"></a></p>
<p>This also shows the ReturnAction&lt;T&gt; class in action.&nbsp; All my services implement interfaces that are used by the Presentation Layer in the ServiceProviders.&nbsp; The Service Layer allows for many different data sources.&nbsp; Adding/subtracting sources or even changing source will not have any affect on the Presentation Layer as long as they adhere to the contracts set forth in the interfaces. </p>
<h3></h3>
<h3>Conclusion</h3>
<p>This is a good place to stop for this post.&nbsp; In this post I have laid out a layered architecture that can help developers build elegant Silverlight solutions.&nbsp; I have addressed some of the pitfalls associated with Silverlight development and proposed solutions to those pitfalls that have worked for me.&nbsp; As I get further along in my quest for building this downloader I will write further post that other may find useful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/165/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=165&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2011/04/18/isolating-odata-calls-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/layerdiagram_thumb.png" medium="image">
			<media:title type="html">LayerDiagram</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting a User&#8217;s Windows Identity in WCF</title>
		<link>http://blog.davemdavis.net/2011/04/11/getting-a-users-windows-identity-in-wcf/</link>
		<comments>http://blog.davemdavis.net/2011/04/11/getting-a-users-windows-identity-in-wcf/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 20:14:47 +0000</pubDate>
		<dc:creator>dmd0822</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">https://dmd0822.wordpress.com/2011/04/11/getting-a-users-windows-identity-in-wcf/</guid>
		<description><![CDATA[I was recently asked by a coworker, “How do I get the Windows Identity of a user calling my WCF service from Silverlight?”&#160; My answer to him was “To the Cloud!”&#160;&#160; No seriously, I put together a little demo application.&#160; &#8230; <a href="http://blog.davemdavis.net/2011/04/11/getting-a-users-windows-identity-in-wcf/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=146&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was recently asked by a coworker, “How do I get the Windows Identity of a user calling my WCF service from Silverlight?”&nbsp; My answer to him was “To the Cloud!”&nbsp;&nbsp; No seriously, I put together a little demo application.&nbsp; I figured I would write a short blog post so that others can partake in the logic. </p>
<p>The first question to as is why do I care about the Windows credentials of the user?&nbsp; The simple answer is that I am building an internal Line of Business (LOB) application and I want to use Windows Authentication .&nbsp; This makes sense.&nbsp; If your company does not have a federated solution so that you can use claims base security, then Windows Authentication is the next best thing.&nbsp; </p>
<p>Start out by creating a Silverlight application using the defaults, letting the template create the web application for you.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb.png?w=416&#038;h=334" width="416" height="334"></a></p>
<p>The first thing that you want to do is set up the web application to restrict users from accessing your web resources (xap files, .svc files, etc…).&nbsp; To do that add the following code to your web.config file:</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb1.png?w=544&#038;h=144" width="544" height="144"></a></p>
<p>Obviously you would restrict the “allow” to specific domains and add a deny key for all other users.&nbsp; You can restrict down to the folder level, allowing different access rights to different folders.</p>
<p>Now you are ready to create the a service.&nbsp; For this example I am did a simple “Hello <em>User</em>” service.&nbsp; It has a single method that returns the Windows Identity of the user making the call.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb2.png?w=673&#038;h=166" width="673" height="166"></a></p>
<p>Ok the service method is configured, you need to modify service configuration in the web.config.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb3.png?w=638&#038;h=157" width="638" height="157"></a>&nbsp; </p>
<p>The key to this is the “security” configuration in the binding.&nbsp; Once the service is configured you add a reference from the Silverlight client just like you would normally do.&nbsp; There is nothing else you have to do.</p>
<p>My coworker then came back and said, “Our services are hosted on a different server this surely this won’t work in that situation?”&nbsp; So I added another web application created an identical to the service I created in the original web application.</p>
<p><a href="http://dmd0822.files.wordpress.com/2011/04/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://dmd0822.files.wordpress.com/2011/04/image_thumb4.png?w=315&#038;h=588" width="315" height="588"></a></p>
<p>What do you think happened?&nbsp; The same results. So it didn’t matter what server the services were on a different servers.</p>
<p>In this situation the client technology doesn’t matter.&nbsp; The client could be WPF or even Winforms.&nbsp; The key is your service configuration. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmd0822.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmd0822.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dmd0822.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dmd0822.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmd0822.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmd0822.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmd0822.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmd0822.wordpress.com/146/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davemdavis.net&#038;blog=5272298&#038;post=146&#038;subd=dmd0822&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davemdavis.net/2011/04/11/getting-a-users-windows-identity-in-wcf/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9acf8c419b792dd362657f8233647de9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmd0822</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://dmd0822.files.wordpress.com/2011/04/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
