<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://mtaulty.com/CommunityServer/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Mike Taulty's Blog</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/default.aspx</link><description>Bits and Bytes</description><dc:language>en-GB</dc:language><generator>CommunityServer 2.0 (Build: 60217.2664)</generator><item><title>Silverlight 2 Beta 2 - ASMX Services &amp;amp; XmlSerializer</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/31/10659.aspx</link><pubDate>Thu, 31 Jul 2008 14:50:40 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10659</guid><dc:creator>mtaulty</dc:creator><slash:comments>3</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10659.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10659</wfw:commentRss><description>&lt;p&gt;It wasn't clear to me from reading the Silverlight SDK docs whether or not you could call ASMX services from Silverlight 2 Beta 2 if calling those services meant involing the XmlSerializer.&lt;/p&gt; &lt;p&gt;Silverlight is using WCF to call services and WCF usually uses the DataContractSerializer. This is a clever serializer but one of the things that it doesn't do ( which I never understood the rationale for ) is serialize XML attributes. It is as element-centric as a serializer can be.&lt;/p&gt; &lt;p&gt;So, I read in the Silverlight SDK docs;&lt;/p&gt; &lt;blockquote&gt; &lt;h4&gt;&lt;font color="#808080"&gt;Using XmlSerializer&lt;/font&gt;&lt;/h4&gt; &lt;ul&gt; &lt;li&gt;&lt;font color="#808080"&gt;Silverlight 2 Beta 2 supports &lt;b&gt;XmlSerializer&lt;/b&gt;. The equivalent serialization support in WCF is described in &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=111011"&gt;&lt;font color="#808080"&gt;XML and SOAP Serialization&lt;/font&gt;&lt;/a&gt;&lt;font color="#808080"&gt;.&lt;/font&gt; &lt;li&gt;&lt;font color="#808080"&gt;In Silverlight 2 Beta 2, generating SOAP messages as described in the preceding document is not supported.&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt; &lt;p&gt;and I didn't understand whether those 2 sentences combined to say &lt;strong&gt;"Supported"&lt;/strong&gt; or &lt;strong&gt;"Not Supported"&lt;/strong&gt;. Having read it twice, I &lt;em&gt;think&lt;/em&gt; what it means is that the &lt;strong&gt;XmlSerializer&lt;/strong&gt; bits are supported but the &lt;a href="http://msdn.microsoft.com/en-us/library/d5wt2he6(VS.71).aspx"&gt;bits referenced here&lt;/a&gt; are not. That's what I &lt;em&gt;think&lt;/em&gt; it means but I can't be 100% sure.&lt;/p&gt; &lt;p&gt;And so I built a quick ASMX service as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Operand
{
  [System.Xml.Serialization.XmlAttribute]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; X { get; set; }

  [System.Xml.Serialization.XmlAttribute]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Y { get; set; }
}

[WebService(Namespace = &lt;span class="str"&gt;"http://tempuri.org/"&lt;/span&gt;)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WebService : System.Web.Services.WebService
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; WebService()
  {
  }
  [WebMethod]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Add(Operand op)
  {
    &lt;span class="kwrd"&gt;return&lt;/span&gt; (op.X + op.Y);
  }
}&lt;/pre&gt;
&lt;p&gt;and added a reference to it from my Silverlight 2 Beta 2 project and the proxy generation seemed to work ok and, specifically, I could see that the generated proxy code is using the XmlSerializer;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; SilverlightApplication3.ProxyCode {
    
    
    [System.ServiceModel.ServiceContractAttribute()]
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; WebServiceSoap {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=&lt;span class="kwrd"&gt;true&lt;/span&gt;, Action=&lt;span class="str"&gt;"http://tempuri.org/Add"&lt;/span&gt;, ReplyAction=&lt;span class="str"&gt;"*"&lt;/span&gt;)]
        [System.ServiceModel.XmlSerializerFormatAttribute()]
        System.IAsyncResult BeginAdd(SilverlightApplication3.ProxyCode.Operand op, System.AsyncCallback callback, &lt;span class="kwrd"&gt;object&lt;/span&gt; asyncState);
        
        &lt;span class="kwrd"&gt;int&lt;/span&gt; EndAdd(System.IAsyncResult result);
    }&lt;/pre&gt;
&lt;p&gt;and then I called the service using the proxy and it all seemed to work fine. Note that I had to manually add a reference to &lt;strong&gt;System.Xml.Serialization.dll&lt;/strong&gt; in order to get the client to compile but that's fine.&lt;/p&gt;
&lt;p&gt;So..."seems to work". &lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10659" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1000.aspx">.NET</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1015.aspx">Silverlight</category></item><item><title>Silverlight 2 and HTML 5 - Being Online/Offline ( Part 2 )</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10651.aspx</link><pubDate>Wed, 30 Jul 2008 18:24:29 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10651</guid><dc:creator>mtaulty</dc:creator><slash:comments>3</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10651.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10651</wfw:commentRss><description>&lt;p&gt;Following up on &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10650.aspx"&gt;this post&lt;/a&gt;, it seems that there's more to this online/offline malarky in HTML 5 in that this;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://www.w3.org/TR/2008/WD-html5-20080122/#appcache" href="http://www.w3.org/TR/2008/WD-html5-20080122/#appcache"&gt;http://www.w3.org/TR/2008/WD-html5-20080122/#appcache&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;talks about Application Caches. As far as I can work out, that's to do with providing more of a manifest around what pages/resource need to be cached in order to make the application work well when run entirely from the cache offline.&lt;/p&gt; &lt;p&gt;I was wondering how this would work with Silverlight so I thought I'd try an experiment using that base class that I wrote in the &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10650.aspx"&gt;previous post&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Let's say (for argument's sake) that I want to build a simple email client in Silverlight. So, I want a UI with fields such as &lt;strong&gt;TO, CC, Subject, Body&lt;/strong&gt; and I have some webservice that'll actually do the emailing for me.&lt;/p&gt; &lt;p&gt;I want to be able to do this whether I am online or offline. Maybe I want a UI something like this;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image.png"&gt;&lt;img height="240" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;The idea being that you write a mail and when you click &lt;strong&gt;Send&lt;/strong&gt; we either;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;If we're online, call the webservice.  &lt;li&gt;If we're offline, store the mail in IsolatedStorage and next time we go online we send the mail via the webservice.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;I built a quick website and added a simple web service; &lt;/p&gt;&lt;pre class="csharpcode"&gt;[ServiceContract]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IMailService
{
  &lt;span class="rem"&gt;// Assume we know who the mail is from (which we wouldn't :-))&lt;/span&gt;
  [OperationContract]  
  &lt;span class="kwrd"&gt;void&lt;/span&gt; SendMail(&lt;span class="kwrd"&gt;string&lt;/span&gt; to, &lt;span class="kwrd"&gt;string&lt;/span&gt; cc, &lt;span class="kwrd"&gt;string&lt;/span&gt; subject, &lt;span class="kwrd"&gt;string&lt;/span&gt; body);
}
&lt;/pre&gt;
&lt;p&gt;and implemented it with a dummy implementation;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MailService : IMailService
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SendMail(&lt;span class="kwrd"&gt;string&lt;/span&gt; to, &lt;span class="kwrd"&gt;string&lt;/span&gt; cc, &lt;span class="kwrd"&gt;string&lt;/span&gt; subject, &lt;span class="kwrd"&gt;string&lt;/span&gt; body)
  {
    &lt;span class="rem"&gt;// Sorry, lost in the post.&lt;/span&gt;
  }
}
&lt;/pre&gt;
&lt;p&gt;and then configured that in my web.config to do the basic http binding;&lt;/p&gt;&lt;pre class="csharpcode"&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.serviceModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;behaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;serviceBehaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;behavior&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="MailServiceBehavior"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;serviceMetadata&lt;/span&gt; &lt;span class="attr"&gt;httpGetEnabled&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;behavior&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;serviceBehaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;behaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;services&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;service&lt;/span&gt; &lt;span class="attr"&gt;behaviorConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;="MailServiceBehavior"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="MailService"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;="basicHttpBinding"&lt;/span&gt; &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;="IMailService"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;identity&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;dns&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="localhost"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;identity&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;service&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;services&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.serviceModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and did a quick "View in Browser" to see if that was working ok. &lt;/p&gt;
&lt;p&gt;With that in place, I added a Silverlight project to the website and then added in my &lt;strong&gt;NetworkAwareApplication&lt;/strong&gt; code like I did on the &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10650.aspx"&gt;previous post&lt;/a&gt; and changed my &lt;strong&gt;app.xaml&lt;/strong&gt; and my &lt;strong&gt;app.xaml.cs&lt;/strong&gt; in order that I am producing a &lt;strong&gt;NetworkAwareApplication&lt;/strong&gt;-derived class for my &lt;strong&gt;Application.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I can then go and build a bit of UI. I'm not sure that it's worth including the XAML here so here's the picture;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_3.png"&gt;&lt;img height="244" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_3.png" width="224" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and I data bound the listbox on the left hand side and the various fields of the email on the right hand side. I wrote a few classes to sit behind this which ended up looking something like this;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_4.png"&gt;&lt;img height="484" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_4.png" width="640" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Ultimately, what happens here is that I have the Page which is bound to an instance of the &lt;strong&gt;MailData&lt;/strong&gt; class which contains the current mail item and a list of queued items. At application start we do;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Load up any persisted &lt;strong&gt;MailInfo&lt;/strong&gt; items from isolated storage. 
&lt;li&gt;Check if the application is online. If so, try and send any persisted emails to the web service. Any failures just stay in the queue. Any successes come out of the queue. 
&lt;li&gt;When the user presses "Send" we just see if we are online and either send/queue the email respectively.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Now, this application only consists of 2 separate files;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The launching HTML page. 
&lt;li&gt;The Silverlight XAP.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;And there's no way to instantiate the application without the browser having read both of those files and cached them.&lt;/p&gt;
&lt;p&gt;So, the application cache stuff from HTML 5 doesn't really seem that relevant but, nonetheless, I wrote a little manifest file and referenced it from my HTML. Here's the manifest file;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;CACHE MANIFEST&lt;br&gt;# v1&lt;br&gt;# This is a comment.&lt;br&gt;OnlineExperimentSLTestPage.html&lt;br&gt;ClientBin/OnlineExperimentSL.xap&lt;br&gt;ClientBin/img1.jpg&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;/blockquote&gt;
&lt;p&gt;I just added the &lt;strong&gt;.jpg&lt;/strong&gt; file so that I could see if the browser would pro-actively download and cache it ( i.e. to pretend that my Silverlight application was more than just 2 files ). &lt;/p&gt;
&lt;p&gt;I referenced that from my HTML;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt; &lt;span class="attr"&gt;manifest&lt;/span&gt;&lt;span class="kwrd"&gt;="manifest.cmf"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and then ran up the page to see a;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_5.png"&gt;&lt;img height="31" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_5.png" width="644" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;so I let it the browser do the offline storage but I'm not sure that it did as I didn't see the browser pro-actively download the img1.jpg file and nor did I see it download the .cmf file ( I gave it that extension so that I could give it a MIME type of "text/cache-manifest" within IIS ).&lt;/p&gt;
&lt;p&gt;So, I'm not sure that stuff's working for me or maybe I don't understand it properly.&lt;/p&gt;
&lt;p&gt;It doesn't really matter because I only have 2 files in my application and, by definition, if you are running the application then you've got those 2 files in your browser cache unless you clear it so there's no real need for me to try and provide a manifest with a more complete set of files.&lt;/p&gt;
&lt;p&gt;I can run my application;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_6.png"&gt;&lt;img height="151" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_6.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and I can send that mail and it'll call the web service. However, if I pull out the network cable then the application will spot that I'm now "offline" and so if I send the mail it goes into the "queue" maintained in isolated storage;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_7.png"&gt;&lt;img height="151" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_7.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now, if I go and plug the network cable back in, the browser detects that and sends the mail via the web service. &lt;/p&gt;
&lt;p&gt;More interestingly, if I shut down the web server so that the browser can't get to the webpage and I then refresh the browser I'll get;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_8.png"&gt;&lt;img height="151" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_8.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;but if I put the browser into its "Work Offline" mode and then refresh it I'll get;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_9.png"&gt;&lt;img height="151" alt="image" src="http://mtaulty.com/blog/images/Silverlight2andHTML5BeingOnlineOfflinePa_BC93/image_thumb_9.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;My next hope would be to restart my web server and plug the cable back in the browser doesn't seem to realise that we are now online or, at least, it's not prepared to take me out of "Work Offline" just because it's noticed the network cable has been plugged back in.&lt;/p&gt;
&lt;p&gt;So, I manually uncheck the "Work Offline" option and the queued mail gets sent when my code realises that the network is back.&lt;/p&gt;
&lt;p&gt;The usage feels a bit weird. I'm hitting a URL when I know full well that the application isn't really available but it seems to work reasonably well even though it feels weird.&lt;/p&gt;
&lt;p&gt;I was wondering how this might be made to feel a little more normal and I had a brief look at "&lt;a href="http://labs.mozilla.com/2007/10/prism/"&gt;PRISM&lt;/a&gt;" which takes away all the browser chrome and makes it look like your web application is an installed application but the problem I had with that is that it doesn't seem to do offline working as far as I can tell ( it's in the wishlist of features ).&lt;/p&gt;
&lt;p&gt;So...at the end of a long post I'm not really contributing anything particularly radical here - the conclusion is that I can run a Silverlight application from the browser's cache and you can make it go online/offline based on the new events in HTML5 and that seems to work reasonably well. &lt;/p&gt;
&lt;p&gt;Ultimately, that might partner up a little better with the "application cache" stuff driven by the manifest for HTML5 but I've yet to get my browser to play ball on that one :-)&lt;/p&gt;
&lt;p&gt;I put the &lt;a href="http://mtaulty.com/downloads/SLOnlineOffline.zip"&gt;project files here&lt;/a&gt; in case you want to play - bear in mind that the web service proxy will be coded to point to the wrong machine and you'll need to unpack the website bits into a web project.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10651" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1000.aspx">.NET</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1015.aspx">Silverlight</category></item><item><title>Silverlight 2 and HTML 5 - Being Online/Offline</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10650.aspx</link><pubDate>Wed, 30 Jul 2008 12:15:53 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10650</guid><dc:creator>mtaulty</dc:creator><slash:comments>4</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10650.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10650</wfw:commentRss><description>&lt;p&gt;One of the things that's coming in IE8 and is already present in FireFox 3 as far as I know is HTML 5's ability to detect whether the browser is online or offline and to provide some offline storage ( alongside cookies ) for the application.&lt;/p&gt; &lt;p&gt;You can find some details about that here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://www.w3.org/TR/offline-webapps/" href="http://www.w3.org/TR/offline-webapps/"&gt;http://www.w3.org/TR/offline-webapps/&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;It occurred to me that this might be pretty useful to pick up from Silverlight and so I wrote a little base class for an application which would surface this info. &lt;/p&gt; &lt;p&gt;I didn't go into the "offline storage" idea because I can't really see the point with Silverlight because it already has IsolatedStorage which would work regardless of whether the browser can currently see the network or not.&lt;/p&gt; &lt;p&gt;Here's the class, very simple. If someone knows how I answer my TODO: then please let me know - I'm not "great" at Javascript;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; SLOnlineOffline
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;enum&lt;/span&gt; NetworkStatus
  {
    Online,
    Offline,
    Unknown
  }
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; NetworkStatusEventArgs : EventArgs
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; NetworkStatus NetworkStatus { get; set; }
  }
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; NetworkAwareApplication : Application 
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; NetworkAwareApplication()
    {
      HookBrowserOnlineOfflineEvents();
    }
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; HookBrowserOnlineOfflineEvents()
    {
      &lt;span class="rem"&gt;// TODO: Figure out how we find out whether the DOM actually _has_&lt;/span&gt;
      &lt;span class="rem"&gt;// an "onoffline" and an "ononline" event. Don't want to get into&lt;/span&gt;
      &lt;span class="rem"&gt;// checking the UserAgent here so someone tell me how to do it please :-)&lt;/span&gt;
      HtmlPage.Document.Body.AttachEvent(&lt;span class="str"&gt;"onoffline"&lt;/span&gt;, (EventHandler)OnOffline);
      HtmlPage.Document.Body.AttachEvent(&lt;span class="str"&gt;"ononline"&lt;/span&gt;, (EventHandler)OnOnline);
    }
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnOffline(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)
    {
      FireNetworkStatusChange(NetworkStatus.Offline);
    }
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnOnline(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)
    {
      FireNetworkStatusChange(NetworkStatus.Online);
    }
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; FireNetworkStatusChange(NetworkStatus networkStatus)
    {
      &lt;span class="kwrd"&gt;if&lt;/span&gt; (NetworkStatusChange != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
      {
        NetworkStatusChange(&lt;span class="kwrd"&gt;this&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; NetworkStatusEventArgs() { NetworkStatus = networkStatus });
      }
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; NetworkStatus NetworkStatus 
    {
      get
      {
        &lt;span class="rem"&gt;// Ask the browser...&lt;/span&gt;
        NetworkStatus status = NetworkStatus.Unknown;

        &lt;span class="kwrd"&gt;try&lt;/span&gt;
        {
          ScriptObject navigator = (ScriptObject)HtmlPage.Window.GetProperty(&lt;span class="str"&gt;"navigator"&lt;/span&gt;);

          &lt;span class="kwrd"&gt;if&lt;/span&gt; (navigator != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
          {
            &lt;span class="kwrd"&gt;bool&lt;/span&gt; navigatorStatus = (&lt;span class="kwrd"&gt;bool&lt;/span&gt;)navigator.GetProperty(&lt;span class="str"&gt;"onLine"&lt;/span&gt;);

            status = navigatorStatus ? NetworkStatus.Online : NetworkStatus.Offline;
          }
        }
        &lt;span class="kwrd"&gt;catch&lt;/span&gt; &lt;span class="rem"&gt;// Gulp.&lt;/span&gt;
        {
        }
        &lt;span class="kwrd"&gt;return&lt;/span&gt; (status);
      }
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; EventHandler&amp;lt;NetworkStatusEventArgs&amp;gt; NetworkStatusChange;
  }
}&lt;/pre&gt;
&lt;p&gt;and then I can use that as my base class for my Silverlight application instead of &lt;strong&gt;System.Windows.Application&lt;/strong&gt; so I can author some XAML such as;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:NetworkAwareApplication&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
  &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;="SLOnlineOffline.App"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:local&lt;/span&gt;&lt;span class="kwrd"&gt;="clr-namespace:SLOnlineOffline"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:NetworkAwareApplication.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;local:NetworkAwareApplication.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;local:NetworkAwareApplication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;and then the code behind that &lt;strong&gt;app.xaml&lt;/strong&gt; looks like this;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; SLOnlineOffline
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; App : NetworkAwareApplication
  {
&lt;/pre&gt;
&lt;p&gt;so we're producing a &lt;strong&gt;NetworkAwareApplication&lt;/strong&gt; rather than a plain old &lt;strong&gt;Application &lt;/strong&gt;and then I can write a little UI for my &lt;strong&gt;Page&lt;/strong&gt;;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&amp;lt;UserControl x:Class=&lt;span class="str"&gt;"SLOnlineOffline.Page"&lt;/span&gt;
    xmlns=&lt;span class="str"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt; 
    xmlns:x=&lt;span class="str"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt; 
    Width=&lt;span class="str"&gt;"400"&lt;/span&gt; Height=&lt;span class="str"&gt;"300"&lt;/span&gt;&amp;gt;
    &amp;lt;Grid x:Name=&lt;span class="str"&gt;"LayoutRoot"&lt;/span&gt; Background=&lt;span class="str"&gt;"White"&lt;/span&gt;&amp;gt;
    &amp;lt;Grid.RowDefinitions&amp;gt;
      &amp;lt;RowDefinition /&amp;gt;
      &amp;lt;RowDefinition /&amp;gt;
    &amp;lt;/Grid.RowDefinitions&amp;gt;
      &amp;lt;Button
      Content=&lt;span class="str"&gt;"Hello"&lt;/span&gt; 
        Click=&lt;span class="str"&gt;"OnClick"&lt;/span&gt;/&amp;gt;
    &amp;lt;TextBlock
      x:Name=&lt;span class="str"&gt;"txtStatus"&lt;/span&gt;
      Text=&lt;span class="str"&gt;"Not Set"&lt;/span&gt; Grid.Row=&lt;span class="str"&gt;"1"&lt;/span&gt;/&amp;gt;
  &amp;lt;/Grid&amp;gt;
&amp;lt;/UserControl&amp;gt;
&lt;/pre&gt;
&lt;p&gt;and a little code behind that;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; SLOnlineOffline
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Page : UserControl
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; Page()
    {
      InitializeComponent();

      Application.NetworkStatusChange += OnNetworkStatusChange;
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnNetworkStatusChange(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, NetworkStatusEventArgs e)
    {
      txtStatus.Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(
        &lt;span class="str"&gt;"Automatically determined new status is {0}"&lt;/span&gt;, e.NetworkStatus);
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnClick(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)
    {
      txtStatus.Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(
        &lt;span class="str"&gt;"Manually checked status is {0}"&lt;/span&gt;,
        Application.NetworkStatus.ToString());
    }
    NetworkAwareApplication Application
    {
      get
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; ((NetworkAwareApplication)System.Windows.Application.Current);
      }
    }
  }
}&lt;/pre&gt;
&lt;p&gt;and then I've got a Silverlight application that I can view in FireFox 3 ( I don't have IE8 installed just yet ) and I can unplug my network cable and the Browser knows that it's gone offline and I can plug my network cable back in and the browser knows that it's back online and all &lt;em&gt;seems&lt;/em&gt; well and this information filters through into my Silverlight application.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10650" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1000.aspx">.NET</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1015.aspx">Silverlight</category></item><item><title>Dell Hybrid</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10648.aspx</link><pubDate>Wed, 30 Jul 2008 11:47:37 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10648</guid><dc:creator>mtaulty</dc:creator><slash:comments>1</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10648.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10648</wfw:commentRss><description>&lt;p&gt;Dell's got a (reasonably) nice looking &lt;a href="http://www1.euro.dell.com/content/products/productdetails.aspx/desktop-studio-hybrid?c=uk&amp;amp;cs=ukdhs1&amp;amp;l=en&amp;amp;s=dhs&amp;amp;ref=homepg"&gt;little machine&lt;/a&gt; that might make a nice Media Center.&lt;/p&gt; &lt;p&gt;I run ( Vista ) Media Center under my TV on a Shuttle box ( search the blog for Shuttle you'll find the specs ) every day and it works extremely well. For me, Media Center is one of the bits of Vista that it's very easy to point at and say "This is way better than it was on XP".&lt;/p&gt; &lt;p&gt;However, I think it's true to say that I spec'd the Shuttle for XP and not for Vista. Whilst it runs Vista well enough it doesn't quite &lt;em&gt;zing&lt;/em&gt; when it comes to the Media Center UI ( I think I turned off a bunch of transitions way back ) and I was using one of these &lt;a href="https://www.sonystyle.co.uk/SonyStyle/b2c/display/(isQuery=yes&amp;amp;xcm=PCM_b2ccrmstandard&amp;amp;citemprod=46833F8436EC00B9020000002BC29B72&amp;amp;query=*tp1e*&amp;amp;citemarea=46D48D0F17C90175E10080002BC29B85&amp;amp;layout=15_116_61_59_117_121&amp;amp;Z_CAMP_SKWCID=sony+media+center%7C2276844977&amp;amp;Z_OMNI_CID=14001643&amp;amp;carea=%24ROOT&amp;amp;citem=46D48D0F17C90175E10080002BC29B8546833F8436EC00B9020000002BC29B72)/.do"&gt;Sony boxes&lt;/a&gt; in a shop the other week and it highlighted to me that my performance with Media Center could be better.&lt;/p&gt; &lt;p&gt;Hence...the look at the Dell Hybrid.&lt;/p&gt; &lt;p&gt;I'm not sure it'll quite work for me though as;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;I'm not sure whether the integrated graphics will cut it or not.&lt;/li&gt; &lt;li&gt;It looks to accept no internal cards so I'm not sure how I'd get a TV tuner into it. I guess I could find one of those USB tuners but I've never tried one and don't know if you can get a dual-DVB-T tuner that way. Additionally, I already &lt;em&gt;have&lt;/em&gt; a perfectly good card so that'd be a bit of a waste.&lt;/li&gt; &lt;li&gt;Cooling. I wonder how warm/noisy it is? Kind of hard to tell from a website :-)&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Perhaps I'll hang fire for a while and see if something better crops up.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10648" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1022.aspx">Hardware</category></item><item><title>Using Excel as an XML Editor</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/30/10644.aspx</link><pubDate>Wed, 30 Jul 2008 08:22:29 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10644</guid><dc:creator>mtaulty</dc:creator><slash:comments>4</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10644.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10644</wfw:commentRss><description>&lt;p&gt;In a couple of instances recently I've had cause to take data that exists in an Excel spreadsheet and save it out as XML and, whilst it's slightly off-topic, I thought I'd share as I find it "enjoyable" :-)&lt;/p&gt; &lt;p&gt;I don't mean as a .XLSX file but, rather, as an XML file according to my own schema.&lt;/p&gt; &lt;p&gt;Let's say I sketch out some XML file format by running VS and coming up with something like;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;videos&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;video&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Using Excel for XML Editing"&lt;/span&gt;
         &lt;span class="attr"&gt;author&lt;/span&gt;&lt;span class="kwrd"&gt;="Mike Taulty"&lt;/span&gt;
         &lt;span class="attr"&gt;duration&lt;/span&gt;&lt;span class="kwrd"&gt;="120"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;videos&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;I can then get Visual Studio to infer a schema from this giving me something like;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&amp;lt;xs:schema attributeFormDefault=&lt;span class="str"&gt;"unqualified"&lt;/span&gt; elementFormDefault=&lt;span class="str"&gt;"qualified"&lt;/span&gt; xmlns:xs=&lt;span class="str"&gt;"http://www.w3.org/2001/XMLSchema"&lt;/span&gt;&amp;gt;
  &amp;lt;xs:element name=&lt;span class="str"&gt;"videos"&lt;/span&gt;&amp;gt;
    &amp;lt;xs:complexType&amp;gt;
      &amp;lt;xs:sequence&amp;gt;
        &amp;lt;xs:element name=&lt;span class="str"&gt;"video"&lt;/span&gt; minOccurs=&lt;span class="str"&gt;"1"&lt;/span&gt; maxOccurs=&lt;span class="str"&gt;"unbounded"&lt;/span&gt;&amp;gt;
          &amp;lt;xs:complexType&amp;gt;
            &amp;lt;xs:attribute name=&lt;span class="str"&gt;"title"&lt;/span&gt; type=&lt;span class="str"&gt;"xs:string"&lt;/span&gt; use=&lt;span class="str"&gt;"required"&lt;/span&gt; /&amp;gt;
            &amp;lt;xs:attribute name=&lt;span class="str"&gt;"author"&lt;/span&gt; type=&lt;span class="str"&gt;"xs:string"&lt;/span&gt; use=&lt;span class="str"&gt;"required"&lt;/span&gt; /&amp;gt;
            &amp;lt;xs:attribute name=&lt;span class="str"&gt;"duration"&lt;/span&gt; type=&lt;span class="str"&gt;"xs:unsignedByte"&lt;/span&gt; use=&lt;span class="str"&gt;"required"&lt;/span&gt; /&amp;gt;
          &amp;lt;/xs:complexType&amp;gt;
        &amp;lt;/xs:element&amp;gt;
      &amp;lt;/xs:sequence&amp;gt;
    &amp;lt;/xs:complexType&amp;gt;
  &amp;lt;/xs:element&amp;gt;
&amp;lt;/xs:schema&amp;gt;&lt;/pre&gt;
&lt;p&gt;I know that's a very imprecise science (schema inference) but I don't really mind here although I did tweak it just to add the minOccurs and maxOccurs facets on there.&lt;/p&gt;
&lt;p&gt;Now, I can drop into Excel and create a new spreadsheet and on the Developer tab I can associate my schema with the sheet by clicking "Source";&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image.png"&gt;&lt;img height="144" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and adding an XML map;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_3.png"&gt;&lt;img height="112" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_3.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and then dragging and dropping items from that map to the spreadsheet;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_4.png"&gt;&lt;img height="205" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_4.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;to the spreadsheet cells that I want to associate with that schema and "BOOM!" ;-) I get;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_5.png"&gt;&lt;img height="82" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_5.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and then I can just edit my XML;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_6.png"&gt;&lt;img height="122" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_6.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and then click Export from the Developer Tab;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_7.png"&gt;&lt;img height="143" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_7.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and save the resulting XML. Cool! Nice and easy way to create XML. As an aside, you can also import data this way ( with the import button ) and I recently found that to be &lt;strong&gt;&lt;em&gt;really&lt;/em&gt;&lt;/strong&gt; useful because I wanted to gather all the details of the videos that we have published on the UK MSDN site into an Excel spreadsheet for discussion.&lt;/p&gt;
&lt;p&gt;I was about to write some C# code to do this when I realised that I could just do &lt;strong&gt;Import&lt;/strong&gt; from Excel, point it at the live RSS feed and it would just magically drop that into a spreadsheet for me with the XML association. Very neat.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;By the way - if you're missing the &lt;strong&gt;Developer&lt;/strong&gt; tab in Excel you need to go to the Office Button, hit the "Excel Options" button;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_8.png"&gt;&lt;img height="244" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_8.png" width="170" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;em&gt;and then go and select to show the developer tab;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_9.png"&gt;&lt;img height="102" alt="image" src="http://mtaulty.com/blog/images/UsingExcelasanXMLEditor_11A00/image_thumb_9.png" width="244" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10644" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1019.aspx">Office</category></item><item><title>Silverlight 2 Videos on Silverlight.net</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/28/10642.aspx</link><pubDate>Mon, 28 Jul 2008 22:10:20 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10642</guid><dc:creator>mtaulty</dc:creator><slash:comments>0</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10642.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10642</wfw:commentRss><description>&lt;p&gt;Nice to see that the videos that &lt;a href="http://blogs.msdn.com/mikeormond/"&gt;Mike&lt;/a&gt; and I made on Silverlight 2 are now on &lt;a&gt;Silverlight.net&lt;/a&gt; up here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://silverlight.net/Learn/videocat.aspx?cat=10" href="http://silverlight.net/Learn/videocat.aspx?cat=10"&gt;http://silverlight.net/Learn/videocat.aspx?cat=10&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10642" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1015.aspx">Silverlight</category></item><item><title>Added (Updated) ADO.NET Data Services Videos to C9</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/25/10636.aspx</link><pubDate>Fri, 25 Jul 2008 11:00:33 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10636</guid><dc:creator>mtaulty</dc:creator><slash:comments>1</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10636.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10636</wfw:commentRss><description>&lt;p&gt;I produced a new set of short videos around ADO.NET Data Services and dropped them on to Channel 9. You can find them here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://channel9.msdn.com/tags/UK"&gt;http://channel9.msdn.com/tags/UK&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;and that list will grow as time goes in ( specifically, it'll grow if I can get the publishing system to publish my next 4 videos for me as it's not playing ball at the time of writing :-) ).&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10636" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1000.aspx">.NET</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1005.aspx">ADO.NET</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx">Entity Framework</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1026.aspx">Data Access</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1027.aspx">Data Services</category></item><item><title>Don't Steal My Focus</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/24/10634.aspx</link><pubDate>Thu, 24 Jul 2008 08:32:35 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10634</guid><dc:creator>mtaulty</dc:creator><slash:comments>0</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10634.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10634</wfw:commentRss><description>&lt;p&gt;I've been encoding videos today with Expression Encoder 2.&lt;/p&gt; &lt;p&gt;I load up a batch of videos and set them transcoding. This takes &lt;strong&gt;ages &lt;/strong&gt;and burns CPU cycles like nobody's business - at times like this you wish the age of quad-core, eight-core and so on was already mainstream. &lt;/p&gt; &lt;p&gt;I get quad-core effects by using the 2 cores on my laptop and the 2 cores on my desktop :-)&lt;/p&gt; &lt;p&gt;Anyway, I'd left it running for maybe 8-10 hours and it was nearly done on all the videos when Outlook popped up its reminders window and I tried to dismiss it by hitting ESC.&lt;/p&gt; &lt;p&gt;Unfortunately, the ESC went to the wrong window. It went to the Expression Encoder 2 window which &lt;strong&gt;&lt;em&gt;promptly cancelled the job and, even worse, deleted all the files that it had transcoded as part of that job so far&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;Bad marks all around;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Bad marks to that Outlook reminders window for being so "needy".&lt;/li&gt; &lt;li&gt;Bad marks to Windows for letting that Outlook reminders window annoy me.&lt;/li&gt; &lt;li&gt;Very bad marks to Expression Encoder for assuming that pressing ESC on their UI means;&lt;/li&gt; &lt;ol&gt; &lt;li&gt;Stop the current encoding job&lt;/li&gt; &lt;li&gt;Delete all the outputs produced so far by the current encoding job&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt; &lt;p&gt;Ouch. &lt;/p&gt; &lt;p&gt;I've tried to modify my ForegroundLockTimeout in my register to stop windows stealing focus - not 100% sure if this still has an effect on Vista though.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10634" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1028.aspx">Off Topic</category></item><item><title>Experiments in Building a Silverlight Photo Control ( Part 4 )</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/21/10617.aspx</link><pubDate>Mon, 21 Jul 2008 10:37:57 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10617</guid><dc:creator>mtaulty</dc:creator><slash:comments>6</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10617.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10617</wfw:commentRss><description>&lt;p&gt;Following on from &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/19/10610.aspx"&gt;this post&lt;/a&gt;, I wanted to see what would happen if I opened my solution in Expression Blend 2.5 June Preview and tried to style my control a little.&lt;/p&gt; &lt;p&gt;So, I opened it in Blend.&lt;/p&gt; &lt;p&gt;I got a bit stuck straight away because when I tried to display my &lt;strong&gt;page.xaml&lt;/strong&gt; Blend threw up an error;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image.png"&gt;&lt;img height="132" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;From the stack trace, this looked suspiciously like some of my code running to load images when it really shouldn't be inside of a design time environment like Blend.&lt;/p&gt; &lt;p&gt;So, I added a little member function to my control;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; IsInDesignMode
    {
      get
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; (DesignerProperties.GetIsInDesignMode(&lt;span class="kwrd"&gt;this&lt;/span&gt;));
      }
    }
&lt;/pre&gt;
&lt;p&gt;and called it from a few places to stop the control trying to load images and so on if it's in design mode rather than run-time mode and Blend sprung into life;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_3.png"&gt;&lt;img height="223" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_3.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now...to try and set about styling the control. First off, I created an empty template for my control;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_4.png"&gt;&lt;img height="206" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_4.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Then I took the Grid that's given to me;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_5.png"&gt;&lt;img height="106" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_5.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and replaced it with a &lt;strong&gt;StackPanel, &lt;/strong&gt;some &lt;strong&gt;Buttons&lt;/strong&gt;, an &lt;strong&gt;Image&lt;/strong&gt; and a couple of other bits and pieces to create my UI. I made sure to name this things in accordance with the naming expected by my control. I managed to get as far as this;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_6.png"&gt;&lt;img height="130" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_6.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Which gives me this delightful look and feel ;-)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_7.png"&gt;&lt;img height="244" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_7.png" width="235" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;With a sort of "border path" that I "drew" in Expression Design but then I got stuck in that I get exceptions from Blend if I try and change the template on those buttons that I've got. That is, just picking one of those buttons and doing "Edit Empty Template" gives me;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_8.png"&gt;&lt;img height="83" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_8.png" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I wasn't entirely sure what to do about that but I found that if I went into the XAML and just set up a Template for the buttons manually and then just put something basic into that template then once I revisited that in Blend it would now edit that template.&lt;/p&gt;
&lt;p&gt;So, I managed to get a fairly ugly looking thing :-) but at least it looks different from where I started;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_9.png"&gt;&lt;img height="244" alt="image" src="http://mtaulty.com/blog/images/ExperimentsinBuildingaSilverlightPhotoCo_AB4C/image_thumb_9.png" width="189" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;And, with that, I'm giving up for a while :-) &lt;/p&gt;
&lt;p&gt;If you want the project, then I shared the &lt;a href="http://mtaulty.com/downloads/SLPhotoControl.zip"&gt;whole thing here for download&lt;/a&gt;. It includes the web project, the images, everything so you should be able to just press F5. Most of the size of the ZIP file is the 5 images which are taken from Windows.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10617" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1000.aspx">.NET</category><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1015.aspx">Silverlight</category></item><item><title>SQL Bits III</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/07/21/10616.aspx</link><pubDate>Mon, 21 Jul 2008 08:02:24 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10616</guid><dc:creator>mtaulty</dc:creator><slash:comments>0</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10616.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10616</wfw:commentRss><description>&lt;p&gt;I've managed to submit a session for SQL Bits III in Hatfield on Saturday the 13th September. If I manage to make the vote then I'll be talking about ADO.NET Data Services as a way of ( productively ) exposing CRUD access to your data over RESTful web services and probably doing a bit of explanation around RESTful whilst I'm there along with talking about consuming those services with AJAX and .NET clients.&lt;/p&gt; &lt;p&gt;I spoke at the last SQL Bits and it's a cool conference - if you're interested in coming along then check out;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://www.sqlbits.com/" href="http://www.sqlbits.com/"&gt;http://www.sqlbits.com/&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;and if you're interested in coming along to my session then you need to vote for it on this page ( otherwise it may well not happen! );&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://www.sqlbits.com/information/publicsessions.aspx" href="http://www.sqlbits.com/information/publicsessions.aspx"&gt;http://www.sqlbits.com/information/publicsessions.aspx&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10616" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1025.aspx">UK Communities</category></item></channel></rss>