<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://sartorial.spaces.live.com/mmm2008-05-17_13.22/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fsartorial.spaces.live.com%2fcategory%2fSilverlight%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Simon Ransom's space: Silverlight</title><description /><link>http://sartorial.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catSilverlight</link><language>en-US</language><pubDate>Sat, 21 Jun 2008 05:05:19 GMT</pubDate><lastBuildDate>Sat, 21 Jun 2008 05:05:19 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://sartorial.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-5885367650949873493</live:id><live:alias>sartorial</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Silverlight expiry August/November 2007</title><link>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!177.entry</link><description>&lt;div&gt;According to the current Terms and Conditions for the September 1.1 Alpha refresh, they will expire on 1st August (Mac) and 1st November (PC) 2007. This is &lt;strong&gt;not true&lt;/strong&gt;, I posted this question (via my psuedonym LittleClive :-)) to &lt;a href="http://silverlight.net/forums/p/8248/25757.aspx#25757"&gt;http://silverlight.net/forums/p/8248/25757.aspx#25757&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;See &lt;a href="http://www.microsoft.com/silverlight/license-mac-dev.aspx"&gt;http://www.microsoft.com/silverlight/license-mac-dev.aspx&lt;/a&gt; and &lt;a href="http://www.microsoft.com/silverlight/license-win-dev.aspx"&gt;http://www.microsoft.com/silverlight/license-win-dev.aspx&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5885367650949873493&amp;page=RSS%3a+Silverlight+expiry+August%2fNovember+2007&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=sartorial.spaces.live.com&amp;amp;GT1=sartorial"&gt;</description><comments>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!177.entry#comment</comments><guid isPermaLink="true">http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!177.entry</guid><pubDate>Wed, 09 Jan 2008 17:29:17 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!177/comments/feed.rss</wfw:commentRss><wfw:comment>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!177.entry#comment</wfw:comment><dcterms:modified>2008-01-09T17:29:17Z</dcterms:modified></item><item><title>This operation can only occur on the UI Thread</title><link>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!126.entry</link><description>&lt;p&gt;So to avoid the JSON serialization length limit mentioned in a &lt;a href="http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!118.entry"&gt;previous post&lt;/a&gt;, I have created a separate LoadMenuPage method that takes a menu file and a page number. The total number of pages is returned in the first LoadMenu call. At the moment, my client application loads all of the menus and merges them together into a single menu so the result is the same but this can take some time. The menus have to be limited to 10 menu items per web-service call and since there are 84 items in one of the menus, this requires 9 calls plus merge time. &lt;p&gt;I wanted to give some feedback to the user about this long running application so I tried starting an animation before the long call and then hiding it afterwards. This didn't work because the long running call was executing on the UI thread so I moved the web-service invocation and merging logic to another thread. When it completes, it needs to populate a UI control which it can't do if it's not on the UI thread and there's no Dispatcher in Silverlight yet. So I created a custom dispatcher using the HtmlTimer (which is marked obsolete but from research seems to be the only choice at the moment):&lt;pre&gt;    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;CustomDispatcher
&lt;/span&gt;    {
        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Queue&lt;/span&gt;&amp;lt;&lt;span style="color:rgb(43,145,175)"&gt;Delegate&lt;/span&gt;&amp;gt; uiWork = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Queue&lt;/span&gt;&amp;lt;&lt;span style="color:rgb(43,145,175)"&gt;Delegate&lt;/span&gt;&amp;gt;();
        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;HtmlTimer&lt;/span&gt; timer = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;HtmlTimer&lt;/span&gt;();

        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; Start()
        {
            timer.Start();
        }

        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; InvokeOnUIThread(&lt;span style="color:rgb(43,145,175)"&gt;Delegate&lt;/span&gt; d)
        {
            uiWork.Enqueue(d);
        }

        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; OnTick(&lt;span style="color:rgb(0,0,255)"&gt;object&lt;/span&gt; sender, &lt;span style="color:rgb(43,145,175)"&gt;EventArgs&lt;/span&gt; args)        
        {
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (uiWork.Count &amp;gt; 0)
            {
                &lt;span style="color:rgb(43,145,175)"&gt;Delegate&lt;/span&gt; d = uiWork.Dequeue();
                d.Method.Invoke(d.Target, &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;);
            }
        }

        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; CustomDispatcher()        
        {
            timer.Interval = 100; 
            timer.Tick += &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;EventHandler&lt;/span&gt;(OnTick);
        }
    }&lt;/pre&gt;
&lt;p&gt;So all is looking good-ish, but then I hit another wall when I ran it up because I got the error I had been trying to avoid &amp;quot;This operation can only occur on the UI Thread&amp;quot;:&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://by1.storage.msn.com/y1psdPtLQi_yahrsAvzMJebYhbP0EwPzgVC4uct2WsLY0VOObyk4hGlXO8n2vxlN9GLBG7bslbWVJz-1jfuqCWtV0UToEd2CySx?PARTNER=WRITER"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=251 alt=UIThreadError src="http://by1.storage.msn.com/y1psdPtLQi_yagtYby1J0Q5cZ_gRE2HuOzUp_7MuO3HgeMTl1WtMa0JUCc3T5ue21N2s4GC9nX72MBu9M-Q1JIVD_IiavfXP618?PARTNER=WRITER" width=384 border=0&gt;&lt;/a&gt; 
&lt;p&gt;It seems the web-service proxy code requires an internal call to System.Windows.Browser.HtmlPage.get_DocumentUri() which needs to be executed on the UI thread. I haven't tried the asynchronous BeginLoad in the proxy yet...&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5885367650949873493&amp;page=RSS%3a+This+operation+can+only+occur+on+the+UI+Thread&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=sartorial.spaces.live.com&amp;amp;GT1=sartorial"&gt;</description><comments>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!126.entry#comment</comments><guid isPermaLink="true">http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!126.entry</guid><pubDate>Thu, 04 Oct 2007 11:27:31 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!126/comments/feed.rss</wfw:commentRss><wfw:comment>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!126.entry#comment</wfw:comment><dcterms:modified>2007-10-07T20:44:34Z</dcterms:modified></item><item><title>Fixing the Silverlight 1.1 SDK Alpha controls</title><link>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!120.entry</link><description>&lt;p&gt;It's great that the source code is provided for these controls. I've had to fix the ListBox so that it scrolls back to the top when UpdateItems is called, otherwise the canvas can appear empty when drilling down through menus:  &lt;p&gt; &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;pre&gt;        &lt;span style="color:rgb(0,128,0)"&gt;//Updates the content children with the current items in the list
&lt;/span&gt;        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; UpdateItems()
        {
            &lt;span style="color:rgb(0,128,0)"&gt;//remove all the children and start from empty
&lt;/span&gt;            content.Children.Clear();

            &lt;strong&gt;&lt;em&gt;content.SetValue(&lt;span style="color:rgb(43,145,175)"&gt;Canvas&lt;/span&gt;.TopProperty, 0);&lt;/em&gt;&lt;/strong&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I've also had to fix the list box so that after scrolling it doesn't select content if you release the mouse button inside the content area which has greatly reduced the number of mis-selections:&lt;pre&gt;&lt;strong&gt;&lt;em&gt;        &lt;span style="color:rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color:rgb(0,128,0)"&gt; &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:rgb(128,128,128)"&gt;&amp;lt;summary&amp;gt;
&lt;/span&gt;        &lt;span style="color:rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:rgb(0,128,0)"&gt; Keep track of where mouse was originally pressed
&lt;/span&gt;        &lt;span style="color:rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color:rgb(0,128,0)"&gt; &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:rgb(128,128,128)"&gt;&amp;lt;/summary&amp;gt;
&lt;/span&gt;        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;bool&lt;/span&gt; mouseDownInsideContentArea;&lt;/em&gt;&lt;/strong&gt;

        &lt;span style="color:rgb(0,128,0)"&gt;// CaptureMouse
&lt;/span&gt;        &lt;span style="color:rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; OnMouseLeftButtonDown(&lt;span style="color:rgb(0,0,255)"&gt;object&lt;/span&gt; sender, &lt;span style="color:rgb(43,145,175)"&gt;MouseEventArgs&lt;/span&gt; args)
        {
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (CheckMousePosition(args))
            {
                ActualControl.CaptureMouse();
&lt;strong&gt;&lt;em&gt;                mouseDownInsideContentArea = &lt;span style="color:rgb(0,0,255)"&gt;true&lt;/span&gt;;&lt;/em&gt;&lt;/strong&gt;
            }
            &lt;span style="color:rgb(0,0,255)"&gt;else
&lt;/span&gt;            {
&lt;strong&gt;&lt;em&gt;                mouseDownInsideContentArea = &lt;span style="color:rgb(0,0,255)"&gt;false&lt;/span&gt;;&lt;/em&gt;&lt;/strong&gt;
            }
        }

        &lt;span style="color:rgb(0,128,0)"&gt;// If the mouse is on the ListBox find on which item and select it.
&lt;/span&gt;        &lt;span style="color:rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; OnMouseLeftButtonUp(&lt;span style="color:rgb(0,0,255)"&gt;object&lt;/span&gt; sender, &lt;span style="color:rgb(43,145,175)"&gt;MouseEventArgs&lt;/span&gt; args)
        {
            ActualControl.ReleaseMouseCapture();

            &lt;span style="color:rgb(0,128,0)"&gt;//do thing only if we are outside the ScrollBar [Simon Ransom: and the mouse was originally pressed when not on scroll bar]
&lt;/span&gt;&lt;strong&gt;&lt;em&gt;            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (CheckMousePosition(args) &amp;amp;&amp;amp; mouseDownInsideContentArea) {&lt;/em&gt;&lt;/strong&gt;
                &lt;span style="color:rgb(43,145,175)"&gt;Point&lt;/span&gt; pt = args.GetPosition(&lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;);
                &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; ((items.Count &amp;gt; 0) &amp;amp;&amp;amp;
                    (pt.X &amp;lt; Width) &amp;amp;&amp;amp; (pt.Y &amp;lt; Height)) {
                    &lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt; contentY = pt.Y - (&lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt;)(content.GetValue(&lt;span style="color:rgb(43,145,175)"&gt;Canvas&lt;/span&gt;.TopProperty));
                    &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; itemNumber = (&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;)(contentY / itemHeight);
                    &lt;span style="color:rgb(43,145,175)"&gt;FrameworkElement&lt;/span&gt; newSelection = itemNumber &amp;lt; items.Count ? items[itemNumber] : &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;;
                    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (selectedItem != newSelection) {
                        Select(newSelection);
                        &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (SelectionChanged != &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;) {
                            SelectionChanged(&lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;, &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;);
                        }
                    }
                }
            }
        }&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5885367650949873493&amp;page=RSS%3a+Fixing+the+Silverlight+1.1+SDK+Alpha+controls&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=sartorial.spaces.live.com&amp;amp;GT1=sartorial"&gt;</description><comments>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!120.entry#comment</comments><guid isPermaLink="true">http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!120.entry</guid><pubDate>Thu, 04 Oct 2007 06:57:43 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!120/comments/feed.rss</wfw:commentRss><wfw:comment>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!120.entry#comment</wfw:comment><dcterms:modified>2007-10-04T06:57:43Z</dcterms:modified></item><item><title>JSON serialization and "Error invoking service."</title><link>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!118.entry</link><description>&lt;div&gt;To serve up my menu XML files which I already have .NET serialization classes for, I've created a webservice:&lt;/div&gt;&lt;font size=2&gt;&lt;font size=2&gt;
&lt;p&gt;[&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;WebService&lt;/font&gt;&lt;font size=2&gt;(Namespace = &lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;http://www.simonransom.com/menuservice/3.0&amp;quot;&lt;/font&gt;&lt;font size=2&gt;)]
&lt;p&gt;[&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;WebServiceBinding&lt;/font&gt;&lt;font size=2&gt;(ConformsTo = &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;WsiProfiles&lt;/font&gt;&lt;font size=2&gt;.BasicProfile1_1)]
&lt;p&gt;[&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;ToolboxItem&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;false&lt;/font&gt;&lt;font size=2&gt;)]&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;[System.Web.Script.Services.&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;ScriptService&lt;/font&gt;&lt;font size=2&gt;]
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;public&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;class&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;MenuService&lt;/font&gt;&lt;font size=2&gt; : System.Web.Services.&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;WebService&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;{ 
&lt;p&gt;    [&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;WebMethod&lt;/font&gt;&lt;font size=2&gt;]
&lt;p&gt;    [&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;ScriptMethod&lt;/font&gt;&lt;font size=2&gt;(ResponseFormat = &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;ResponseFormat&lt;/font&gt;&lt;font size=2&gt;.Json)]
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;&lt;font color="#000000"&gt;    &lt;/font&gt;public&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;SegmentedMenu&lt;/font&gt;&lt;font size=2&gt; Load(&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; menu)
&lt;p&gt;    {
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;    &lt;font color="#000000"&gt;    &lt;/font&gt;string&lt;/font&gt;&lt;font size=2&gt; path = Server.MapPath(&lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;~/menufiles/&amp;quot;&lt;/font&gt;&lt;font size=2&gt; + menu);&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;&lt;font color="#000000"&gt;    &lt;/font&gt;    return&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;SegmentedMenu&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;MenuManager&lt;/font&gt;&lt;font size=2&gt;.GetInstance().Load(path));
&lt;p&gt;    }
&lt;p&gt;}
&lt;p&gt;From this I learnt a few things:
&lt;ul&gt;
&lt;li&gt;If I went to the webservice page menuService.asmx in Internet Explorer or Firefox, the browser would only return the XML version of the results which looked fine (as long as you were expecting XML - which given that I'd specified &lt;a href="http://www.json.org/"&gt;Json &lt;/a&gt;serialization I wasn't)
&lt;li&gt;Using &lt;a href="http://www.pocketsoap.com/tcpTrace/"&gt;TCPTrace&lt;/a&gt; from Simon Fell &amp;amp; Matt Humphrey, the message requests from Silverlight were of the more expected form and have a MIME Content-Type of application/json&lt;/ul&gt;
&lt;p&gt;     &lt;strong&gt;{&amp;quot;menu&amp;quot;:&amp;quot;publicphotos.xml&amp;quot;}&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;So it looks like .NET is supporting both serialization forms depending on the client request type. The response back to Silverlight from my webservice is in the form:&lt;/ul&gt;
&lt;blockquote dir=ltr style="margin-right:0px"&gt;
&lt;p&gt;&lt;strong&gt;{&amp;quot;d&amp;quot;:{&amp;quot;__type&amp;quot;:&amp;quot;PBL.App.Menus.WebService.SegmentedMenu&amp;quot;,&amp;quot;Header&amp;quot;:{&amp;quot;MenuLargeImage&amp;quot;:null,&amp;quot;Filename&amp;quot;:&amp;quot;publicphotos.xml&amp;quot;,&amp;quot;AudioPlaylist&amp;quot;:null,&amp;quot;A&lt;em&gt;... etc.&lt;/em&gt;&lt;/strong&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;For some of the menus I get a System.Net.WebException with a message stating &amp;quot;Error invoking service.&amp;quot; (not particularly helpful and no inner exception). However in TCPTrace I get a more helpful: &lt;/ul&gt;
&lt;p&gt;     {&amp;quot;Message&amp;quot;:&amp;quot;&lt;strong&gt;Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property&lt;/strong&gt;.&amp;quot;,&amp;quot;StackTrace&amp;quot;:&amp;quot;   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)&amp;quot;,&amp;quot;ExceptionType&amp;quot;:&amp;quot;System.InvalidOperationException&amp;quot;}
&lt;ul&gt;
&lt;li&gt;My original menu serialization used inheritance and &lt;font size=2&gt;System.Xml.Serialization.&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;XmlInclude &lt;font color="#000000"&gt;to have a base MenuItem and subclasses of MenuItemPhoto, MenuItemMovie, etc. however although the XML looked ok, the JSON serialization format does not support OO inheritance so all the classes on the client end were stripped down to the base class MenuItem. To work around this, I created a SegmentedMenu class which could be created based on the original Menu class but separated each of the MenuItems into different lists (e.g. List&amp;lt;MenuItemPhoto&amp;gt; photos) depending on class type. This could then be passed back but loses the benefit of interleaving different types and increases a mapping overhead but overall not a bad solution for what I need.&lt;/font&gt;&lt;/font&gt;&lt;/ul&gt;
&lt;p&gt;So now I need to work out how make the larger menus smaller or increase the &lt;strong&gt;maxJasonLength&lt;/strong&gt; property.&lt;/font&gt;&lt;/font&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5885367650949873493&amp;page=RSS%3a+JSON+serialization+and+%22Error+invoking+service.%22&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=sartorial.spaces.live.com&amp;amp;GT1=sartorial"&gt;</description><comments>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!118.entry#comment</comments><guid isPermaLink="true">http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!118.entry</guid><pubDate>Tue, 02 Oct 2007 19:17:43 GMT</pubDate><slash:comments>3</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!118/comments/feed.rss</wfw:commentRss><wfw:comment>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!118.entry#comment</wfw:comment><dcterms:modified>2007-10-02T19:18:13Z</dcterms:modified></item><item><title>Week 1-ish</title><link>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!117.entry</link><description>&lt;div&gt;Downloaded:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=b98a61ba-99b0-40b7-ab6e-5386a2b94217&amp;amp;DisplayLang=en"&gt;Visual Studio 2008 Beta 2&lt;/a&gt;
&lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B52AEB39-1F10-49A6-85FC-A0A19CAC99AF&amp;amp;displaylang=en"&gt;Microsoft Silverlight Tools Alpha for Visual Studio 2008 Beta 2&lt;/a&gt;
&lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=54b85d84-604d-43db-bcfe-7afd278208d8&amp;amp;DisplayLang=en"&gt;Silverlight 1.1 Alpha SDK&lt;/a&gt; (includes some basic controls like button, listbox etc.)
&lt;li&gt;&lt;a href="http://www.microsoft.com/expression/products/download.aspx?key=blend2preview"&gt;Blend 2 September Preview&lt;/a&gt;&lt;/ul&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5885367650949873493&amp;page=RSS%3a+Week+1-ish&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=sartorial.spaces.live.com&amp;amp;GT1=sartorial"&gt;</description><comments>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!117.entry#comment</comments><guid isPermaLink="true">http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!117.entry</guid><pubDate>Fri, 28 Sep 2007 13:51:03 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!117/comments/feed.rss</wfw:commentRss><wfw:comment>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!117.entry#comment</wfw:comment><dcterms:modified>2007-10-02T19:18:36Z</dcterms:modified></item><item><title>The beginnings of my photo/video browser</title><link>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!116.entry</link><description>&lt;div&gt;I'm learning Silverlight and for my &amp;quot;hello world&amp;quot; app I've chosen to reimplement my family photo, video and music site. So I keep track of what I'm learning I'll blog it here.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Firstly the &amp;quot;legacy&amp;quot; system I have already built in .NET 2.0 at a high-level creates xml menu files for driving the navigation on the website.&lt;/div&gt;
&lt;p&gt;It has a number of plugins to
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;extract Exif information
&lt;li&gt;create thumbnails, playlists, web preview images
&lt;li&gt;create movie files in Divx, Wmv (standard and VC-1) and Quicktime formats
&lt;li&gt;render 3d artwork using Povray (e.g. piles of photos that are bigger depending on the size of the category)
&lt;li&gt;extract stills from movies to create animated thumbnails
&lt;li&gt;uses Amazon webservice to search for album art and then screenscrape the images to produce a 3d view of the CD case&lt;/ul&gt;&lt;/ul&gt;
&lt;p&gt;This system is separate from the website itself so that I could easily move away from ASP.NET to an alternative interface and that's exactly what I'm doing now....&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5885367650949873493&amp;page=RSS%3a+The+beginnings+of+my+photo%2fvideo+browser&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=sartorial.spaces.live.com&amp;amp;GT1=sartorial"&gt;</description><comments>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!116.entry#comment</comments><guid isPermaLink="true">http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!116.entry</guid><pubDate>Fri, 28 Sep 2007 13:40:49 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://sartorial.spaces.live.com/blog/cns!AE52F94DB08EC0AB!116/comments/feed.rss</wfw:commentRss><wfw:comment>http://sartorial.spaces.live.com/Blog/cns!AE52F94DB08EC0AB!116.entry#comment</wfw:comment><dcterms:modified>2007-09-28T13:40:49Z</dcterms:modified></item></channel></rss>