<?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>Silverlight Journal</title>
	<atom:link href="http://silverlightjournal.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://silverlightjournal.wordpress.com</link>
	<description>Veni, vidi, vici</description>
	<lastBuildDate>Thu, 13 May 2010 14:36:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='silverlightjournal.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Silverlight Journal</title>
		<link>http://silverlightjournal.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://silverlightjournal.wordpress.com/osd.xml" title="Silverlight Journal" />
	<atom:link rel='hub' href='http://silverlightjournal.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Dev Summit Prism Talk Source Code</title>
		<link>http://silverlightjournal.wordpress.com/2010/03/29/dev-summit-prism-talk-source-code/</link>
		<comments>http://silverlightjournal.wordpress.com/2010/03/29/dev-summit-prism-talk-source-code/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 14:51:42 +0000</pubDate>
		<dc:creator>bobbsmooth</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://silverlightjournal.wordpress.com/?p=58</guid>
		<description><![CDATA[The source code from my talk can be downloaded from here. The slides can be downloaded from here. I&#8217;ll post a link to the video once it&#8217;s available. EDIT: My presentation is online here.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=58&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The source code from my talk can be downloaded from <a href="http://bit.ly/aedMW7">here</a>.</p>
<p>The slides can be downloaded from <a href="http://bit.ly/aVnvIw">here</a>.</p>
<p>I&#8217;ll post a link to the video once it&#8217;s available.</p>
<p>EDIT:<br />
My presentation is online <a href="http://gisupdates.esri.com/video/devsummit2010/userpres_011.wmv">here.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightjournal.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightjournal.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightjournal.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightjournal.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightjournal.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightjournal.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightjournal.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightjournal.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=58&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightjournal.wordpress.com/2010/03/29/dev-summit-prism-talk-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://gisupdates.esri.com/video/devsummit2010/userpres_011.wmv" length="0" type="video/asf" />
<enclosure url="http://gisupdates.esri.com/video/devsummit2010/userpres_011.wmv" length="14355456" type="video/asf" />
	
		<media:content url="http://1.gravatar.com/avatar/b0e0f262de2e06d89e93bbf7c720de96?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bobbsmooth</media:title>
		</media:content>
	</item>
		<item>
		<title>My First Secure Silverlight ArcGIS Application</title>
		<link>http://silverlightjournal.wordpress.com/2010/02/04/my-first-secure-silverlight-arcgis-application/</link>
		<comments>http://silverlightjournal.wordpress.com/2010/02/04/my-first-secure-silverlight-arcgis-application/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 21:31:00 +0000</pubDate>
		<dc:creator>bobbsmooth</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arcgis server]]></category>
		<category><![CDATA[ESRI ArcGIS Server]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[token service]]></category>

		<guid isPermaLink="false">http://silverlightjournal.wordpress.com/2010/02/04/my-first-secure-silverlight-arcgis-application/</guid>
		<description><![CDATA[I recently developed an application using the Silverlight API for ArcGIS Server (AGS). As with all things the requirements changed near the end of the project to require that the site be hosted offsite and be accessible via the Internet. Despite my desperate cries of, &#8220;Danger! Danger! The interwebs are unsafe.&#8221; My client had made [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=45&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently developed an application using the Silverlight API for ArcGIS Server (AGS).  As with all things the requirements changed near the end of the project to require that the site be hosted offsite and be accessible via the Internet.  Despite my desperate cries of, &#8220;Danger! Danger! The interwebs are unsafe.&#8221;  My client had made up their collective minds and I had my orders:  put it on the Internet and make it secure.</p>
<p>The first step was easy, secure all traffic between the Silverlight client and my web services that do all my data requests.  One wildcard SSL cert later and I was all set to create as many secure websites as I could need.</p>
<p>Next, I had to figure out a way to make AGS keep its preverbal legs shut so it wouldn&#8217;t whore out all my client&#8217;s data over the tubes of the Internet.  This is what I had to do to configure the server.</p>
<ol style="margin-left:38pt;">
<li>Install SSL certificate on server.</li>
<li>Install SQL Server to use as a Membership provider for AGS.</li>
<li>Use aspnet_regsql.exe to create the membership provider.  Typically, this is located somewhere like this: C:\&lt;windows dir&gt;\Microsoft.NET\Framework\&lt;version dir&gt;\aspnet_regsql.exe</li>
<li>
<div>On AGS Manager -&gt; Security -&gt; Settings, change the location of my Security Stores from Windows to SQL server.</div>
<ul>
<li>For SQL Express this just worked but for SQL Server I had to set up the NETWORK SERVICE account with permissions on my Aspnetdb database.</li>
<li>Also on SQL Express, for the name of the SQL database, I used the default .\SQLEXPRESS but for SQL Server, I had to use just the name of the server.</li>
</ul>
</li>
<li>On AGS Manager -&gt; Security -&gt; Roles, add a new role.</li>
<li>On AGS Manager -&gt; Security -&gt; Users, add a new user to my role.</li>
<li>
<div>On AGS Manager -&gt; Services -&gt; Manage Services</div>
<ul>
<li>Add a new folder from the Manage Folders menu. (This turned out to be very important)</li>
<li>Select that folder from the drop list.</li>
<li>From the Manage Folders menu, select Permissions.  Removed &#8220;Everyone&#8221; and add your new role.</li>
<li>Added your map service using the &#8220;Add New Service&#8221; link while your new folder is selected in the drop list.</li>
</ul>
</li>
<li>
<div>On AGS Manager -&gt; Security -&gt; Settings, enabl security.</div>
<ul>
<li>To undo this, you have to modify your Server.dat file and change the &lt;SecurityEnabled&gt; tag from true to false.</li>
</ul>
</li>
<li>
<div>Next generate a token.  For my project I knew I was going to only call the map service from my proxy so I didn&#8217;t want it to expire.</div>
<ul>
<li>https://&lt;AGSSERVERNAME&gt;/ArcGIS/tokens?request=getToken&amp;username=&lt;USERNAME&gt;&amp;password=&lt;PASSWORD&gt;&amp;clientid=&lt;WEBURL&gt;</li>
<li>USERNAME and PASSWORD are for the credential that you set up in step 6.</li>
<li>WEBURL is the URL or IP address of the site that will host your application&#8217;s proxy page (e.g. site.domain.com).  If you use the IP address, use the one that AGS will see.  For example, if AGS is on the same server as your Proxy and both are behind a firewall, then use the private IP address assigned by your firewall.  However, if your proxy and AGS will be on separate networks and will be communicating across the Internet, then you will use the public IP address that your proxy will communicate through.</li>
</ul>
</li>
<li>
<div>Once you have a token, test is using this url:</div>
<ul>
<li>https://&lt;AGSSERVERNAME&gt;/ArcGIS/rest/services/&lt;FOLDERNAME&gt;/&lt;SERVICENAME&gt;/MapServer?token=&lt;TOKEN&gt;</li>
</ul>
</li>
</ol>
<p>The next big chunk was modifying ESRI&#8217;s proxy to handle traffic a little smarter.</p>
<ol style="margin-left:38pt;">
<li>
<div>In proxy.config, I added an attributes to the serverUrl elements.</div>
<ul>
<li>localURL – the url that the proxy could use to find the service without going out of the firewall</li>
</ul>
</li>
<li>
<div>I modified proxy.ashx</div>
<ul>
<li>Uses the localURL instead of the one passed in from the request.</li>
<li>Does error handling to verify the config file opened correctly</li>
<li>Allows for expired and incorrect SSL certificates (sometimes a legitimate SSL would fail for unknown reasons)</li>
</ul>
</li>
</ol>
<p>Next, I modified my application to use my proxy for all calls to the map service.</p>
<p><pre class="brush: plain;">
((ArcGISDynamicMapServiceLayer)esriMap.Layers[0]).ProxyURL = _viewModel.MapServiceProxyURL;
((ArcGISDynamicMapServiceLayer)esriMap.Layers[0]).Url = _viewModel.MapServiceURL;
</pre></p>
<p>It&#8217;s very important that you set the Layer&#8217;s ProxyURL property before setting its Url property.  As soon as the Url property is set, the layer object makes the calls the service.</p>
<p>The last thing I did was to configure IIS Authentication.  For some reason AGS made everything use Windows Authenitication.  I had to change everything to anonymous only so that AGS could do the authentication.</p>
<p>References:</p>
<ul>
<li>ESRI Walkthrough on Implementing security with users and roles in SQL Server <a href="http://webhelp.esri.com/arcgisserver/9.3.1/dotNet/index.htm">http://webhelp.esri.com/arcgisserver/9.3.1/dotNet/index.htm#users_roles_sql_server.htm</a></li>
<li>ESRI AGS configuration files <a href="http://webhelp.esri.com/arcgisserver/9.3.1/dotNet/index.htm">http://webhelp.esri.com/arcgisserver/9.3.1/dotNet/index.htm#cfg_file_security.htm</a></li>
<li>ESRI SL Proxy Page <a href="http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/SLProxyPage.zip">http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/SLProxyPage.zip</a></li>
<li>ESRI Secure services <a href="http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/?Secure_services.htm">http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/?Secure_services.htm</a> (good discussion of token services)</li>
<li>ESRI blank layers fix <a href="http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx">http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx</a> (cross-domain limitations)</li>
<li>Ignoring SSL Cert errors <a href="http://www.west-wind.com/weblog/posts/48909.aspx">http://www.west-wind.com/weblog/posts/48909.aspx</a></li>
<li>ESRI Configuring Token Service <a href="http://webhelp.esri.com/arcgisserver/9.3.1/dotnet/index.htm">http://webhelp.esri.com/arcgisserver/9.3.1/dotnet/index.htm#config_token_service.htm</a></li>
<li>ESRI Using secure services directly without proxy <a href="http://resources.esri.com/help/9.3/arcgisserver/adf/dotnet/developer/ArcGIS/SOAP/using_secure_services.htm">http://resources.esri.com/help/9.3/arcgisserver/adf/dotnet/developer/ArcGIS/SOAP/using_secure_services.htm</a></li>
<li>ESRI Proxy Page for JS <a href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/ve/help/Working%20with%20ArcGIS%20Server%20services/ProxyPage.htm">http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/ve/help/Working%20with%20ArcGIS%20Server%20services/ProxyPage.htm</a></li>
</ul>
<p>Thanks to @dbouwman and @Gmapdev for pointing me in the right direction!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightjournal.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightjournal.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightjournal.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightjournal.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightjournal.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightjournal.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightjournal.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightjournal.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=45&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightjournal.wordpress.com/2010/02/04/my-first-secure-silverlight-arcgis-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b0e0f262de2e06d89e93bbf7c720de96?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bobbsmooth</media:title>
		</media:content>
	</item>
		<item>
		<title>Static object management with file watchers</title>
		<link>http://silverlightjournal.wordpress.com/2009/12/31/static-object-management-with-file-watchers/</link>
		<comments>http://silverlightjournal.wordpress.com/2009/12/31/static-object-management-with-file-watchers/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 18:15:52 +0000</pubDate>
		<dc:creator>bobbsmooth</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[FileSystemWatcher]]></category>
		<category><![CDATA[wcf]]></category>

		<guid isPermaLink="false">http://silverlightjournal.wordpress.com/?p=41</guid>
		<description><![CDATA[I wanted to have some objects remain in memory for use by some WCF services but still be able to refresh them without restarting the service. Basically, when certain files change, I wanted the static objects to be flushed and then re-initialized with the new values in the files.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=41&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wanted to have some objects remain in memory for use by some WCF services but still be able to refresh them without restarting the service.  Basically, when certain files change, I wanted the static objects to be flushed and then re-initialized with the new values in the files.</p>
<p><pre class="brush: csharp;">
        private static System.IO.FileSystemWatcher _configWatcher = null;
        private static void StartWatcher()
        {
            if (_configWatcher == null)
            {
//set the path to a directory that I configured in the web.config file.
                string path = HttpContext.Current.Server.MapPath(WebConfigurationManager.AppSettings[&quot;CONFIGURATION_DIRECTORY&quot;]);

//initialize the watcher to watch any xml file in the directory identified by the path
                _configWatcher = new System.IO.FileSystemWatcher()
                {
                    Path=path,
                    EnableRaisingEvents=true,
                    NotifyFilter=System.IO.NotifyFilters.LastWrite,
                    Filter=&quot;*.xml&quot;
                };

//handle the changed event for when files are modified and the error event
                _configWatcher.Changed += new System.IO.FileSystemEventHandler(_watcher_Changed);
                _configWatcher.Error += new System.IO.ErrorEventHandler(_watcher_Error);
            }
        }
        static void _watcher_Error(object sender, System.IO.ErrorEventArgs e)
        {
                //log error
        }
        public static void _watcher_Changed(object sender, System.IO.FileSystemEventArgs e)
        {
               //reinitialized dependent static objects
        }
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightjournal.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightjournal.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightjournal.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightjournal.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightjournal.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightjournal.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightjournal.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightjournal.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=41&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightjournal.wordpress.com/2009/12/31/static-object-management-with-file-watchers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b0e0f262de2e06d89e93bbf7c720de96?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bobbsmooth</media:title>
		</media:content>
	</item>
		<item>
		<title>Prism commanding: KeyUp example</title>
		<link>http://silverlightjournal.wordpress.com/2009/12/21/prism-commanding-keyup-example/</link>
		<comments>http://silverlightjournal.wordpress.com/2009/12/21/prism-commanding-keyup-example/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 21:10:46 +0000</pubDate>
		<dc:creator>bobbsmooth</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[commanding]]></category>
		<category><![CDATA[keyup]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[passwordbox]]></category>
		<category><![CDATA[Prism]]></category>

		<guid isPermaLink="false">http://silverlightjournal.wordpress.com/?p=34</guid>
		<description><![CDATA[Today, I had to build a simple login form using Silverlight 3 and Prism in a MVVM application.  One requirement that I always put on any login form is that the user can hit the enter key to submit her credentials for validation.  This is my solution: KeyUpBehavior.cs KeyUp.cs View ViewModel ViewModel constructor<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=34&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today, I had to build a simple login form using Silverlight 3 and Prism in a MVVM application.  One requirement that I always put on any login form is that the user can hit the enter key to submit her credentials for validation.  This is my solution:</p>
<p><strong>KeyUpBehavior.cs</strong><br />
<pre class="brush: csharp;">
using System.Windows.Controls;
using System.Windows.Input;
using Microsoft.Practices.Composite.Presentation.Commands;

namespace Infrastructure.Commands.PasswordCommands
{
    public class KeyUpBehavior : CommandBehaviorBase&lt;Control&gt;
    {
        public KeyUpBehavior(Control element)
            : base(element)
        {
            element.KeyUp += new KeyEventHandler(element_KeyUp);
        }

        void element_KeyUp(object sender, KeyEventArgs e)
        {
            //only execute command if the user pressed the enter key
            if (e.Key == Key.Enter)
                base.ExecuteCommand();
        }
    }
}
</pre></p>
<p><strong>KeyUp.cs</strong><br />
<pre class="brush: csharp;">
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Infrastructure.Commands.PasswordCommands
{
    public class KeyUp
    {
        #region Command  attached property
        public static ICommand GetCommand(DependencyObject obj)
        {
            return (ICommand)obj.GetValue(CommandProperty);
        }

        public static void SetCommand(DependencyObject obj, ICommand value)
        {
            obj.SetValue(CommandProperty, value);
        }

        // Using a DependencyProperty as the backing store for Command.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CommandProperty =
            DependencyProperty.RegisterAttached(&quot;Command&quot;, typeof(ICommand), typeof(KeyUp), new PropertyMetadata(OnSetCommandCallback));

        private static void OnSetCommandCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            Control element = dependencyObject as Control;
            if (element != null)
            {
                KeyUpBehavior behavior = GetOrCreateBehavior(element);
                behavior.Command = e.NewValue as ICommand;
            }
        }
        private static KeyUpBehavior GetOrCreateBehavior(Control element)
        {
            KeyUpBehavior behavior = element.GetValue(KeyUpBehaviorProperty) as KeyUpBehavior;
            if (behavior == null)
            {
                behavior = new KeyUpBehavior(element);
                element.SetValue(KeyUpBehaviorProperty, behavior);
            }
            return behavior;
        }
        #endregion

        #region KeyUpBehavior attached property
        public static KeyUpBehavior GetKeyUpBehavior(DependencyObject obj)
        {
            return (KeyUpBehavior)obj.GetValue(KeyUpBehaviorProperty);
        }

        public static void SetKeyUpBehavior(DependencyObject obj, KeyUpBehavior value)
        {
            obj.SetValue(KeyUpBehaviorProperty, value);
        }

        public static readonly DependencyProperty KeyUpBehaviorProperty =
            DependencyProperty.RegisterAttached(&quot;KeyUpBehavior&quot;, typeof(KeyUpBehavior), typeof(KeyUp), null);
        #endregion

        #region CommandParameter attached property
        public static object GetCommandParameter(DependencyObject obj)
        {
            return (object)obj.GetValue(CommandParameterProperty);
        }

        public static void SetCommandParameter(DependencyObject obj, object value)
        {
            obj.SetValue(CommandParameterProperty, value);
        }

        public static readonly DependencyProperty CommandParameterProperty =
            DependencyProperty.RegisterAttached(&quot;CommandParameter&quot;, typeof(object), typeof(KeyUp), new PropertyMetadata(OnSetCommandParameterCallback));

        private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            Control element = dependencyObject as Control;
            if (element != null)
            {
                KeyUpBehavior behavior = GetOrCreateBehavior(element);
                behavior.CommandParameter = e.NewValue;
            }
        }
        #endregion
    }
}
</pre></p>
<p><strong>View</strong><br />
<pre class="brush: xml;">
        &lt;PasswordBox Grid.Row=&quot;2&quot; 
                 Grid.Column=&quot;2&quot; 
                 customCommands:KeyUp.Command=&quot;{Binding KeyUp_Command}&quot; 
                 customCommands:KeyUp.CommandParameter=&quot;{Binding Password, ElementName=txtPassword}&quot; 
                 Password=&quot;{Binding Path=User.Password, Mode=TwoWay}&quot; 
                 x:Name=&quot;txtPassword&quot; /&gt;
</pre></p>
<p><strong>ViewModel</strong><br />
<pre class="brush: csharp;">
        public DelegateCommand&lt;object&gt; KeyUp_Command { get; set; }

        public void KeyUpCommand_Handler(object commandParameter)
        {
            //do authentication, commandParameter is the value stored in PasswordBox.Password.
        }
</pre></p>
<p><strong>ViewModel constructor</strong><br />
<pre class="brush: csharp;">
            KeyUp_Command = new DelegateCommand&lt;object&gt;(KeyUpCommand_Handler);
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightjournal.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightjournal.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightjournal.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightjournal.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightjournal.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightjournal.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightjournal.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightjournal.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=34&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightjournal.wordpress.com/2009/12/21/prism-commanding-keyup-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b0e0f262de2e06d89e93bbf7c720de96?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bobbsmooth</media:title>
		</media:content>
	</item>
		<item>
		<title>My First Expression Encoder App</title>
		<link>http://silverlightjournal.wordpress.com/2009/12/08/my-first-expression-encoder-app/</link>
		<comments>http://silverlightjournal.wordpress.com/2009/12/08/my-first-expression-encoder-app/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 20:59:41 +0000</pubDate>
		<dc:creator>bobbsmooth</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Encode]]></category>
		<category><![CDATA[Expression Encoder 3]]></category>
		<category><![CDATA[Smooth Streaming]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://silverlightjournal.wordpress.com/?p=12</guid>
		<description><![CDATA[Problem Background On my current project, I need to re-encode about 7000 videos into a Smooth Streaming format so that I can take advantage of the functionality in Silverlight&#8217;s MediaElement control. The last time I did a big batch of encoding, I simply scripted Windows Media Sever 9. With Expression Encoder 3, however, that&#8217;s not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=12&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem Background</strong></p>
<p>On my current project, I need to re-encode about 7000 videos into a Smooth Streaming format so that I can take advantage of the functionality in Silverlight&#8217;s MediaElement control.  The last time I did a big batch of encoding, I simply scripted Windows Media Sever 9.  With Expression Encoder 3, however, that&#8217;s not possible.  Instead you must use the API and create an application to do the work.  While not terribly difficult, this project definitely took me outside my comfort zone.  There are very few references out there so I hope this helps shed some more light on the solutions that can be built.</p>
<p><strong>Solution</strong></p>
<p>I decided that the best thing to do first was to create a simple application that would encode one video.  Then I could expand it to use something like a database or an XML file to script the encoding process.</p>
<p>The first step was to install Expression Encoder 3.  I needed the full version because the free version doesn&#8217;t support Smooth Streaming.</p>
<p>Next, I started a new WPF solution and added references to all of the Microsoft.Expression.Encoder libraries.</p>
<div id="attachment_14" class="wp-caption alignnone" style="width: 335px"><a href="http://silverlightjournal.files.wordpress.com/2009/12/references.jpg"><img class="size-full wp-image-14" title="References" src="http://silverlightjournal.files.wordpress.com/2009/12/references.jpg" alt="Library References" width="325" height="316" /></a><p class="wp-caption-text">Project References</p></div>
<p>In my Window1.asmx file, I created some simple controls for finding a file and starting the process.</p>
<p><pre class="brush: xml;">
&lt;Window x:Class=&quot;SingleFileEncoder.Window1&quot;
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    Title=&quot;Window1&quot; Height=&quot;300&quot; Width=&quot;557&quot;&gt;
    &lt;Grid&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height=&quot;25&quot;&gt;&lt;/RowDefinition&gt;
            &lt;RowDefinition Height=&quot;25&quot;&gt;&lt;/RowDefinition&gt;
            &lt;RowDefinition Height=&quot;25&quot;&gt;&lt;/RowDefinition&gt;

        &lt;/Grid.RowDefinitions&gt;
        &lt;StackPanel Orientation=&quot;Horizontal&quot; Grid.Row=&quot;0&quot;&gt;
            &lt;TextBlock Text=&quot;Source Video:&quot; VerticalAlignment=&quot;Center&quot;&gt;
                &lt;TextBlock.Margin&gt;
                    &lt;Thickness&gt;
                        &lt;Thickness.Left&gt;5&lt;/Thickness.Left&gt;
                    &lt;/Thickness&gt;
                &lt;/TextBlock.Margin&gt;
            &lt;/TextBlock&gt;
            &lt;TextBox Height=&quot;23&quot; Name=&quot;txtFileName&quot; VerticalAlignment=&quot;Center&quot; Width=&quot;300&quot; BorderThickness=&quot;1&quot;&gt;
                
                &lt;TextBox.BorderBrush&gt;
                    &lt;SolidColorBrush Color=&quot;Blue&quot; &gt;&lt;/SolidColorBrush&gt;
                &lt;/TextBox.BorderBrush&gt;
                &lt;TextBox.Background&gt;
                    &lt;LinearGradientBrush StartPoint=&quot;.75,0&quot; EndPoint=&quot;0,.5&quot;&gt;
                        &lt;GradientStop Color=&quot;#CCCCFF&quot; Offset=&quot;1&quot; /&gt;
                        &lt;GradientStop Color=&quot;White&quot; Offset=&quot;.25&quot; /&gt;
                    &lt;/LinearGradientBrush&gt;
                &lt;/TextBox.Background&gt;
                &lt;TextBox.Margin&gt;
                    &lt;Thickness&gt;
                        &lt;Thickness.Left&gt;5&lt;/Thickness.Left&gt;
                    &lt;/Thickness&gt;
                &lt;/TextBox.Margin&gt;
            &lt;/TextBox&gt;
            &lt;Button Height=&quot;23&quot; HorizontalAlignment=&quot;Right&quot; Name=&quot;btnBrowse&quot; VerticalAlignment=&quot;Center&quot; Width=&quot;75&quot; Click=&quot;btnBrowse_Click&quot;&gt;Browse
                &lt;Button.Margin&gt;
                    &lt;Thickness&gt;
                        &lt;Thickness.Left&gt;5&lt;/Thickness.Left&gt;
                    &lt;/Thickness&gt;
                &lt;/Button.Margin&gt;
            &lt;/Button&gt;
            &lt;Button Name=&quot;btnEncode&quot; Click=&quot;btnEncode_Click&quot;&gt;
                Encode
                &lt;Button.Margin&gt;
                    &lt;Thickness&gt;
                        &lt;Thickness.Left&gt;5&lt;/Thickness.Left&gt;
                    &lt;/Thickness&gt;
                &lt;/Button.Margin&gt;
            &lt;/Button&gt;
        &lt;/StackPanel&gt;
        &lt;ProgressBar Grid.Row=&quot;1&quot; Name=&quot;progressBar&quot; Minimum=&quot;0&quot; Maximum=&quot;100&quot;&gt;&lt;/ProgressBar&gt;
        &lt;TextBlock Name=&quot;txtMessage&quot; Grid.Row=&quot;2&quot;&gt;&lt;/TextBlock&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</pre></p>
<p>In the code behind file, I added using statements for the Encoder namespaces.<br />
<pre class="brush: csharp;">
 using System;
 using System.Windows;
 using Microsoft.Expression.Encoder;
 using Microsoft.Expression.Encoder.Profiles;
 using Microsoft.Win32;
 </pre></p>
<p> I used the Win32 OpenFileDialog to find a file when the user clicks the Browse button.</p>
<p><pre class="brush: csharp;">
private void btnBrowse_Click(object sender, RoutedEventArgs e)
 {
 OpenFileDialog dialog = new OpenFileDialog();
 dialog.ShowDialog();
 txtFileName.Text = dialog.FileName;
 }
</pre><br />
In the encode button&#8217;s even handler, I assigned that file to a new MediaItem.<br />
<pre class="brush: csharp;">
MediaItem mediaItem;
mediaItem = new MediaItem(txtFileName.Text);
</pre></p>
<p>Next, I created the output profile for my MediaItem.  This technique is new to Encoder 3.</p>
<p><pre class="brush: csharp;">
 AdvancedVC1VideoProfile videoProfile = new AdvancedVC1VideoProfile
 {
 Bitrate = new VariableConstrainedBitrate(403, 600),
 Complexity = VideoComplexity.Fastest,
 SmoothStreaming = true,
 Size = new System.Drawing.Size(236, 176),
 KeyFrameDistance = new TimeSpan(0, 0, 2),
 InLoopFilter = true
 };
mediaItem.OutputFormat = new WindowsMediaOutputFormat()
 {
 VideoProfile = videoProfile
 };
</pre></p>
<p>Next, I created a Job and assigned the MediaItem to it.</p>
<p><pre class="brush: csharp;">
 Microsoft.Expression.Encoder.Job job = new Job();
 job.MediaItems.Add(mediaItem);
 job.OutputDirectory = @&quot;C:\EncodedContent\&quot;;
 job.CreateSubfolder = false;
</pre></p>
<p>I assigned a couple of event handlers that would let me see progress as it was made and notify me when the encoding was complete.<br />
<pre class="brush: csharp;">
job.EncodeProgress += new EventHandler&lt;EncodeProgressEventArgs&gt;(job_EncodeProgress);
 job.EncodeCompleted += new EventHandler&lt;EncodeCompletedEventArgs&gt;(job_EncodeCompleted);
</pre></p>
<p>Finally, I fire the encode process for the Job.<br />
<pre class="brush: csharp;">
job.Encode();
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightjournal.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightjournal.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightjournal.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightjournal.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightjournal.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightjournal.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightjournal.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightjournal.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=12&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightjournal.wordpress.com/2009/12/08/my-first-expression-encoder-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b0e0f262de2e06d89e93bbf7c720de96?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bobbsmooth</media:title>
		</media:content>

		<media:content url="http://silverlightjournal.files.wordpress.com/2009/12/references.jpg" medium="image">
			<media:title type="html">References</media:title>
		</media:content>
	</item>
		<item>
		<title>Silverlight Journal</title>
		<link>http://silverlightjournal.wordpress.com/2009/12/04/silverlight-journal/</link>
		<comments>http://silverlightjournal.wordpress.com/2009/12/04/silverlight-journal/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 23:42:40 +0000</pubDate>
		<dc:creator>bobbsmooth</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://silverlightjournal.wordpress.com/?p=5</guid>
		<description><![CDATA[This will be the home of my musings on Silverlight, MVVM, Prism, Twitter, ArcGIS Server, JavaScript, Agile methodologies and all manner of programming minutia. You can follow me on twitter at http://twitter.com/jrockers.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=5&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This will be the home of my musings on Silverlight, MVVM, Prism, Twitter, ArcGIS Server, JavaScript, Agile methodologies and all manner of programming minutia.</p>
<p>You can follow me on twitter at <a href="http://twitter.com/jrockers">http://twitter.com/jrockers</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightjournal.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightjournal.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightjournal.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightjournal.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightjournal.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightjournal.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightjournal.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightjournal.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightjournal.wordpress.com&amp;blog=10813309&amp;post=5&amp;subd=silverlightjournal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightjournal.wordpress.com/2009/12/04/silverlight-journal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b0e0f262de2e06d89e93bbf7c720de96?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bobbsmooth</media:title>
		</media:content>
	</item>
	</channel>
</rss>
