<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/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>MCS UK Solution Development Team</title><link>http://blogs.msdn.com/b/mcsuksoldev/</link><description>The blog of the UK Solutions Development Team of Microsoft Consulting Services.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>.Net Implementation of a Priority Queue (aka Heap)</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/05/10/net-implementation-of-a-priority-queue-aka-heap.aspx</link><pubDate>Thu, 10 May 2012 16:16:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10303863</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10303863</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/05/10/net-implementation-of-a-priority-queue-aka-heap.aspx#comments</comments><description>&lt;p&gt;I thought I would take a break for a while from Hadoop and put together an F# .Net implementation of a Priority Queue; implemented using a heap data structure. Conceptually we can think of a heap as a balanced binary tree. The tree will have a root, and each node can have up to two children; a left and a right child. The keys in such a binary tree are said to be in heap order, such that any element is at least as large as its parent element.&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;font size="2"&gt;&lt;i&gt;For every element v, at a node i, the element w at i’s parent satisfies&lt;/i&gt; key(w)≤key(v)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;The heap is maintained as an array, indexed by i=1…N, such that for any node i, the nodes at positions &lt;span style="font-family: consolas;" face="Consolas"&gt;leftChild(i)=2i&lt;/span&gt; and &lt;span style="font-family: consolas;" face="Consolas"&gt;rightChild(i)=2i+1&lt;/span&gt;, and the parent of the node is at position &lt;span style="font-family: consolas;" face="Consolas"&gt;parent(i)=(1/2)&lt;/span&gt;.&lt;/p&gt;  &lt;p&gt;The idea behind a Priority Queue is that finding the element with the lowest key is easy, &lt;span style="font-family: consolas;" face="Consolas"&gt;O(&lt;em&gt;1&lt;/em&gt;)&lt;/span&gt; time, as it is always the root. When adding a new element it is always added to the end of the list. The heap is then fixed by recursively checking the new element with its parent, and swapping their positions in the list until the heap condition is satisfied. This operation takes &lt;span style="font-family: consolas;" face="Consolas"&gt;O(log &lt;em&gt;n&lt;/em&gt;)&lt;/span&gt; time.&lt;/p&gt;  &lt;p&gt;Within .Net we implemented a Priority Queue using a &lt;span style="font-family: consolas;" face="Consolas"&gt;List&amp;lt;KeyValuePair&amp;lt;'TKey, 'TValue&amp;gt;&amp;gt;&lt;/span&gt;.&lt;/p&gt;  &lt;p&gt;The code, as always can be downloaded from:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Net-Implementation-of-a-d3ac7b9d"&gt;http://code.msdn.microsoft.com/Net-Implementation-of-a-d3ac7b9d&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The basic operations supported on the Priority Queue will be:&lt;/p&gt;  &lt;table style="width: 491px;" border="1" cellspacing="0" cellpadding="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;Enqueue&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Adds an item to the Queue&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;Dequeue&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Removes the root element; that with the lowest key&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;Peek&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Queries the root element&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;IndexOf&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Returns the index of a given key value pair&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;RemoveAt&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Removes the element at the specified index value&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;ContainsKey&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Determines whether the Queue contains a specific key value&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;ChangeKey&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Changes a specific key value&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;RemoveKey&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;Removes the element with the specific key value&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="142"&gt;&lt;em&gt;Item&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="347"&gt;An indexer based on the key value&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Before showing the code a quick word is warranted about the implementation. The Key operations shown above rely on a second data structure; a &lt;span style="font-family: consolas;" face="Consolas"&gt;Dictionary&amp;lt;'TKey, int&amp;gt;&lt;/span&gt;. This secondary data structure maintains a reference of the index within the list for each key. This positional structure does restrict the Priority Queue to unique key values, but does provide greater flexibility for the heap operations; all in &lt;span style="font-family: consolas;" face="Consolas"&gt;O(&lt;em&gt;1&lt;/em&gt;)&lt;/span&gt; time.&lt;/p&gt;  &lt;p&gt;So what does the F# code look like:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ceb8d762-432d-478a-8c28-b0e5988abb3e" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div style="background: #ddd; max-height: 500px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 3em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.FSharp&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Collections&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Collections.Generic&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; PriorityQueue&amp;lt;&amp;#39;TKey, &amp;#39;TValue &lt;span style="color:#0000ff"&gt;when&lt;/span&gt; &amp;#39;TKey : comparison&amp;gt; &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; (data:IEnumerable&amp;lt;KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;&amp;gt; option, capacity:int, comparer:IComparer&amp;lt;&amp;#39;TKey&amp;gt;) =   &lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;mutable&lt;/span&gt; heapList:List&amp;lt;KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;&amp;gt; =  &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;mutable&lt;/span&gt; positionDict:Dictionary&amp;lt;&amp;#39;TKey, int&amp;gt; = &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Determines if a value is in the heap&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; inRange index =&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; index &amp;gt;= 0 &amp;amp;&amp;amp; index &amp;lt; heapList.Count &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; Some(index) &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; None&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; checkIndex index =&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; ((inRange index).IsNone) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; raise (ArgumentException(sprintf &lt;span style="color:#800000"&gt;&amp;quot;Index specified is not within range - %i&amp;quot;&lt;/span&gt; index))&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Gets the children of a node&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getChildren (index:int) = &lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#008000"&gt;// children left[2*pos] and right[2*pos + 1] where pos = index + 1&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; left = (2 * index) + 1&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; right = (2 * index) + 2     &lt;/li&gt; &lt;li&gt;        (inRange left, inRange right)&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Gets the parent of an index&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getParent (index:int) = &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#008000"&gt;// parent index [pos/2] where index = pos - 1&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (index = 0) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; None&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; Some((index-1) / 2)&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Tests to see if the first value is greater than the first&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; isGreater parent child =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (comparer.Compare(heapList.[parent].Key, heapList.[child].Key) &amp;gt; 0) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Swaps two elements of the heap list&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; swapElements idx1 idx2 = &lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; element1 = heapList.[idx1]&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; element2 = heapList.[idx2]&lt;/li&gt; &lt;li class="code-even"&gt;        heapList.[idx1] &amp;lt;- heapList.[idx2]&lt;/li&gt; &lt;li&gt;        heapList.[idx2] &amp;lt;- element1&lt;/li&gt; &lt;li class="code-even"&gt;        positionDict.[element1.Key] &amp;lt;- idx2&lt;/li&gt; &lt;li&gt;        positionDict.[element2.Key] &amp;lt;- idx1&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Heapifys toward the parent&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; heapifyUp (index:int) =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (index &amp;gt; 0) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parent = getParent index&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (isGreater parent.Value index) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                swapElements parent.Value index&lt;/li&gt; &lt;li&gt;                heapifyUp parent.Value&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Heapifys down to the children&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; heapifyDown (index:int) = &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; (left, right) = getChildren index&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (left.IsSome) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; childindex =&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (right.IsSome &amp;amp;&amp;amp; (isGreater left.Value right.Value)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; right.Value&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; left.Value&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (isGreater index childindex) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                swapElements index childindex&lt;/li&gt; &lt;li class="code-even"&gt;                heapifyDown childindex&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Heapifys down to the children&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; heapifyUpDown (index:int) = &lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parent =  getParent index&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (parent.IsSome &amp;amp;&amp;amp; (isGreater parent.Value index)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            heapifyUp index&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            heapifyDown index&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Adds an items and heapifys&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; insertItem (key:&amp;#39;TKey) (value:&amp;#39;TValue) =&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; insertindex = heapList.Count&lt;/li&gt; &lt;li&gt;        positionDict.Add(key, insertindex)&lt;/li&gt; &lt;li class="code-even"&gt;        heapList.Add(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;(key, value))&lt;/li&gt; &lt;li&gt;        heapifyUp(insertindex)&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Delete the root node and heapifys &lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; deleteItem index =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (heapList.Count &amp;lt;= 1) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            heapList.Clear()&lt;/li&gt; &lt;li&gt;            positionDict.Clear()&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; lastindex = heapList.Count - 1&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; indexKey =  heapList.[index].Key&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; lastKey = heapList.[lastindex].Key&lt;/li&gt; &lt;li class="code-even"&gt;            heapList.[index] &amp;lt;- heapList.[lastindex]&lt;/li&gt; &lt;li&gt;            positionDict.[lastKey] &amp;lt;- index&lt;/li&gt; &lt;li class="code-even"&gt;            heapList.RemoveAt(lastindex)&lt;/li&gt; &lt;li&gt;            positionDict.Remove(indexKey) |&amp;gt; ignore&lt;/li&gt; &lt;li class="code-even"&gt;            heapifyDown index&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Default do bindings&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (comparer = &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            raise (ArgumentException(&lt;span style="color:#800000"&gt;&amp;quot;Comparer cannot be null&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; equalityComparer = &lt;/li&gt; &lt;li class="code-even"&gt;            { &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; IEqualityComparer&amp;lt;&amp;#39;TKey&amp;gt; &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; x.Equals(c1, c2) = &lt;/li&gt; &lt;li class="code-even"&gt;                    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; ((comparer.Compare(c1, c2)) = 0) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; x.GetHashCode(value) =&lt;/li&gt; &lt;li&gt;                    value.GetHashCode()&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        heapList &amp;lt;- &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; List&amp;lt;KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;&amp;gt;(capacity)&lt;/li&gt; &lt;li&gt;        positionDict &amp;lt;- &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;&amp;#39;TKey, int&amp;gt;(capacity, equalityComparer)&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; data.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            data.Value |&amp;gt; Seq.iter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; item &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; insertItem item.Key item.Value)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Set of constructors&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;new&lt;/span&gt;() = PriorityQueue(None, 0, ComparisonIdentity.Structural&amp;lt;&amp;#39;TKey&amp;gt;)&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;new&lt;/span&gt;(capacity:int) = PriorityQueue(None, capacity, ComparisonIdentity.Structural&amp;lt;&amp;#39;TKey&amp;gt;)&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;new&lt;/span&gt;(data:IEnumerable&amp;lt;KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;&amp;gt;) = PriorityQueue(Some(data), 0, ComparisonIdentity.Structural&amp;lt;&amp;#39;TKey&amp;gt;)&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;new&lt;/span&gt;(comparer:IComparer&amp;lt;&amp;#39;TKey&amp;gt;) = PriorityQueue(None, 0, comparer)&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;new&lt;/span&gt;(capacity:int, comparer:IComparer&amp;lt;&amp;#39;TKey&amp;gt;) = PriorityQueue(None, capacity, comparer)&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;new&lt;/span&gt;(data:IEnumerable&amp;lt;KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;&amp;gt;, comparer:IComparer&amp;lt;&amp;#39;TKey&amp;gt;) = PriorityQueue(Some(data), 0, comparer)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Checks to see if the heap is empty&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.IsEmpty&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; get() = (heapList.Count = 0)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Enqueues a new entry into the heap&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Enqueue (key:&amp;#39;TKey) (value:&amp;#39;TValue) =&lt;/li&gt; &lt;li class="code-even"&gt;        insertItem key value&lt;/li&gt; &lt;li&gt;        ()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Peeks at the head of the heap&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Peek() = &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not(this.IsEmpty) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            heapList.[0]&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            raise (InvalidOperationException(&lt;span style="color:#800000"&gt;&amp;quot;Priority Queue is empty&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Dequeues the head entry into the heap&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Dequeue() = &lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; value = this.Peek()&lt;/li&gt; &lt;li&gt;        deleteItem 0&lt;/li&gt; &lt;li class="code-even"&gt;        value&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Determines whether an item is in the queue&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Contains (key:&amp;#39;TKey) (value:&amp;#39;TValue) = &lt;/li&gt; &lt;li class="code-even"&gt;        heapList.Contains(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;(key, value))&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Returns the index of a specified item&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.IndexOf (key:&amp;#39;TKey) (value:&amp;#39;TValue) = &lt;/li&gt; &lt;li class="code-even"&gt;        heapList.IndexOf(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;(key, value))&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Removes an item from the queue at the specified index&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.RemoveAt (index:int) = &lt;/li&gt; &lt;li class="code-even"&gt;        checkIndex index&lt;/li&gt; &lt;li&gt;        deleteItem index&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Determines whether an item is in the queue&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.ContainsKey (key:&amp;#39;TKey) =&lt;/li&gt; &lt;li&gt;        positionDict.ContainsKey key&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Determines whether an item is in the queue&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.ChangeKey (key:&amp;#39;TKey) (value:&amp;#39;TKey)=&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; index = positionDict.[key]&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; item = heapList.[index]&lt;/li&gt; &lt;li&gt;        heapList.[index] &amp;lt;- &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;(value, item.Value)&lt;/li&gt; &lt;li class="code-even"&gt;        positionDict.Remove(key) |&amp;gt; ignore&lt;/li&gt; &lt;li&gt;        positionDict.Add(value, index)&lt;/li&gt; &lt;li class="code-even"&gt;        heapifyUpDown index&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Removes an item from the queue for the specified key&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.RemoveKey (key:&amp;#39;TKey) =&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; index = positionDict.[key]&lt;/li&gt; &lt;li&gt;        this.RemoveAt index&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Modifies elements based on index values&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Item&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; get(key) =&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; index = positionDict.[key]&lt;/li&gt; &lt;li&gt;            heapList.[index]&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;and&lt;/span&gt; set(key) (value) =&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; index = positionDict.[key]&lt;/li&gt; &lt;li class="code-even"&gt;            heapList.[index] &amp;lt;- &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;(key, value)&lt;/li&gt; &lt;li&gt;            heapifyUpDown index&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Returns the count of the queue&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Count&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; get() = heapList.Count&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Resets the capacity of the Queue&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.TrimExcess() = &lt;/li&gt; &lt;li&gt;        heapList.TrimExcess()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Returns the capacity of the queue&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Capacity &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; get() = heapList.Capacity&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Clears the queue&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Clear() = &lt;/li&gt; &lt;li&gt;        heapList.Clear()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// Standard IList members&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;interface&lt;/span&gt; ICollection&amp;lt;KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;&amp;gt; &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Add(item:KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;) = &lt;/li&gt; &lt;li class="code-even"&gt;            this.Enqueue item.Key item.Value&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Clear() = &lt;/li&gt; &lt;li&gt;            heapList.Clear()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Contains(item:KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;) = &lt;/li&gt; &lt;li class="code-even"&gt;            heapList.Contains(item)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Count&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; get() = heapList.Count&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.CopyTo(toArray:KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;[], arrayIndex:int) = &lt;/li&gt; &lt;li class="code-even"&gt;            heapList.CopyTo(toArray, arrayIndex)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.IsReadOnly&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; get() = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.Remove(item:KeyValuePair&amp;lt;&amp;#39;TKey, &amp;#39;TValue&amp;gt;) = &lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; index = heapList.IndexOf(item)&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (inRange index).IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                deleteItem index&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.GetEnumerator() = &lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;upcast&lt;/span&gt; heapList.GetEnumerator()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#008000"&gt;// IEnumerable GetEnumerator implementation&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;interface&lt;/span&gt; IEnumerable &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; this.GetEnumerator() =  &lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;upcast&lt;/span&gt; heapList.GetEnumerator()&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;p&gt;This code implementation has the PriorityQueue derive from ICollection. The implementation is analogous to the .Net Queue implementation, but with Key and Value pairs; but more importantly where Dequeue is guaranteed to return the element with the lowest value. &lt;/p&gt;  &lt;p&gt;The correctness of the heap is managed through the &lt;em&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;heapify&lt;/span&gt;&lt;/em&gt; operations. It is these recursive operations that compare parent and child nodes and adjust the positions accordingly.&lt;/p&gt;  &lt;p&gt;One has to remember though that the enumerator will effectively return elements in a random order.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10303863" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+Development/">.Net Development</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IEnumerable/">IEnumerable</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IEqualityComparer/">IEqualityComparer</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net/">.Net</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Heap/">Heap</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/PriorityQueue/">PriorityQueue</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IComparer/">IComparer</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/ICollection/">ICollection</category></item><item><title>ADFS 2.0: Single sign-on when a website references remote images</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/05/02/adfs-2-0-single-sign-on-when-a-website-references-remote-images.aspx</link><pubDate>Wed, 02 May 2012 16:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10300022</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10300022</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/05/02/adfs-2-0-single-sign-on-when-a-website-references-remote-images.aspx#comments</comments><description>&lt;p class="ExternalClass0E7E3D506D6F4851837E615289CD616C"&gt;I recently had an issue where a website, secured with Active Directory Federation Services 2.0 (ADFS), was referencing images stored in another website, secured by the same instance of ADFS. This meant that if a user logged into the main website without going first to the website hosting the images, they would not see the images. The error scenario is as follows:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div class="ExternalClass0E7E3D506D6F4851837E615289CD616C"&gt;The user logs into the main website and is redirected to ADFS to login. Once successfully logged in, the browser then holds a session cookie for that site&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;div class="ExternalClass0E7E3D506D6F4851837E615289CD616C"&gt;   &lt;ul&gt;     &lt;li&gt;A page is then displayed on the main website that references images on a remote site via simple html&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;  &lt;div class="csharpcode-wrapper"&gt;   &lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; height: 20px; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;     &lt;pre id="codeSnippet" style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;img&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;https://imageswebsite.dev/image1.jpg&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;alt&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;imagecontent&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div class="csharpcode-wrapper"&gt; The image is not displayed on the page. This is because referencing an image does not cause the browser to be redirected to ADFS for authentication, and so no session cookie exists for the image site (as the host header differs)&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;N.B. - If the image site was secured using windows authentication, you would simply see the standard browser login prompt.&lt;/p&gt;

&lt;p&gt;As both sites are secured using the same ADFS 2.0 instance, we want the user to simply log into the main site and achieve Single Sign On (SSO) across both sites. To this end we need some mechanism to bounce the browser against the images site, thus obtaining a session cookie.&lt;/p&gt;

&lt;p&gt;This is a problem that must be resolved in the client browser and there are a few mechanisms to achieve this. e.g. - using a HTTP module to redirect the user to a page on the images site. The option I ended up choosing was iframe based, as this is capable of handling redirects (plus most browsers would cache the image once obtained, so performance impact would be minimal).&lt;/p&gt;

&lt;p&gt;The methodology is as follows:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Set the image src to use a placeholder image whilst it is loading (so the user doesn’t see a image missing cross) &lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
  &lt;li&gt;Add an iframe that has its src set to the actual image src&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
  &lt;li&gt;Once the iframe is loaded (and hence the browser has obtained a session cookie for the image site – this is invisible to the end user), set the src of the image to the correct path&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example html/javascript is as follows:&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;pre id="codeSnippet" style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;html&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;head&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;Accenture Reach - Example iframe preloader&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;script&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;language&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum1" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;&amp;#160; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum2" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; LoadImageWhenFrameHasLoaded() &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum3" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;         {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum4" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;             currentFrame = document.getElementById(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;frameid&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum5" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (currentFrame.readyState != &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;complete&amp;quot;&lt;/span&gt;) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum6" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;             {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum7" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;                 setTimeout(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;LoadImageWhenFrameHasLoaded();&amp;quot;&lt;/span&gt;, 100);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum8" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;             }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum9" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum10" style="color: rgb(96, 96, 96);"&gt;  &lt;/span&gt;                 document.getElementById(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;imageContent&amp;quot;&lt;/span&gt;).src = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;https://imageswebsite.dev/image1.gif&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum11" style="color: rgb(96, 96, 96);"&gt;  &lt;/span&gt;             }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum12" style="color: rgb(96, 96, 96);"&gt;  &lt;/span&gt;         }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum13" style="color: rgb(96, 96, 96);"&gt;  &lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;script&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum1" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum2" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;   &amp;lt;/head&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum3" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;   &amp;lt;body&amp;gt;        &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span id="lnum4" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;     &amp;lt;iframe src=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;https://imageswebsite.dev/image1.jpg&amp;quot;&lt;/span&gt; id=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;frameid&amp;quot;&lt;/span&gt; style=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;display: none&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/iframe&amp;gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span id="lnum5" style="color: rgb(96, 96, 96);"&gt;   &lt;/span&gt;     &amp;lt;script type=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt; language=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;javascript&amp;quot;&lt;/span&gt;&amp;gt;LoadImageWhenFrameHasLoaded();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;script&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;img&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;placeholder.gif&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;id&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;imageContent&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;alt&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;imagecontent&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;body&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;html&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;Note that when implementing this in a production scenario, I did have a problem where the iframe says it has completed loading before a session cookie is obtained; this is because of the redirects. I ended up just waiting a period of time to overcome this, but please let me know if anyone can suggest an alternative.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Rob+Nowik/default.aspx"&gt;Rob Nowik&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10300022" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SharePoint/">SharePoint</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SSO/">SSO</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/ADFS/">ADFS</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SharePoint+2010/">SharePoint 2010</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Rob+Nowik/">Rob Nowik</category></item><item><title>Generic based Framework for .Net Hadoop MapReduce Job Submission</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/05/02/generic-based-framework-for-net-hadoop-mapreduce-job-submission.aspx</link><pubDate>Wed, 02 May 2012 14:54:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10299979</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10299979</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/05/02/generic-based-framework-for-net-hadoop-mapreduce-job-submission.aspx#comments</comments><description>&lt;p&gt;Over the past month I have been working on a framework to allow composition and submission of MapReduce jobs using .Net. I have put together two previous blog posts on this, so rather than put together a third on the latest change I thought I would create a final composite post. To understand why lets run through a quick version history of the code:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Initial release where the values are treated as strings, and serialization was handled through Object.ToString() &lt;/li&gt;    &lt;li&gt;Made minor modifications to the submission APIs &lt;/li&gt;    &lt;li&gt;Modified the Reducer and Combiner types to allow In-Reducer optimizations through the ability to yield a Tuple of the key and value in the Cleanup &lt;/li&gt;    &lt;li&gt;Modified the Combiner and Reducer base classes such that data out of the mapper, in and out of the combiner, and in to the reducer uses a binary formatter; thus changing the base classes from strings to objects; meaning the classes can now cast to the expected type rather than performing string parsing &lt;/li&gt;    &lt;li&gt;Added support for multiple mapper keys; with supporting utilities &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The latest change takes advantage of the fact the objects are serialized in Binary format. This change has allowed for the base abstract classes to move away from object based APIs to one based on Generics. This change hopefully greatly simplifies the creation of .Net MapReduce jobs.&lt;/p&gt;  &lt;p&gt;As always to submit MapReduce jobs one can use the following command line syntax:&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input &amp;quot;mobile/data/debug/sampledata.txt&amp;quot; -output &amp;quot;mobile/querytimes/debug&amp;quot;       &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryMapper, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryReducer, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\MSDN.Hadoop.MapReduce\Release\MSDN.Hadoop.MapReduceFSharp.dll&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The mapper and reducer parameters are .Net types that derive from a base Map and Reduce abstract classes shown below. The input, output, and files options are analogous to the standard Hadoop streaming submissions. The mapper and reducer options (more on a combiner option later) allow one to define a .Net type derived from the appropriate abstract base classes. Under the covers standard Hadoop Streaming is being used, where controlling executables are used to handle the StdIn and StdOut operations and activating the required .Net types. The “file” parameter is required to specify the DLL for the .Net type to be loaded at runtime, in addition to any other required files.&lt;/p&gt;  &lt;p&gt;As always the source can be downloaded from:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7"&gt;http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Mapper and Reducer Base Classes&lt;/h4&gt;  &lt;p&gt;The following definitions outline the abstract base classes from which one needs to derive. Lets start with the C# definitions:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:78b01581-b704-44fa-897a-3200bbf384fb" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div class="code-titleblock"&gt;C# Abstract Classes&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt; &lt;li class="code-even"&gt;{&lt;/li&gt; &lt;li&gt;    [&lt;span style="color:#2b91af"&gt;Serializable&lt;/span&gt;]&lt;/li&gt; &lt;li class="code-even"&gt;    [AbstractClass]&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MapReduceBase&lt;/span&gt;&amp;lt;V2&amp;gt;&lt;/li&gt; &lt;li class="code-even"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; MapReduceBase();&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, V2&amp;gt;&amp;gt; Cleanup();&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Setup();&lt;/li&gt; &lt;li&gt;    }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    [&lt;span style="color:#2b91af"&gt;Serializable&lt;/span&gt;]&lt;/li&gt; &lt;li class="code-even"&gt;    [AbstractClass]&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MapperBaseText&lt;/span&gt;&amp;lt;V2&amp;gt; : MapReduceBase&amp;lt;V2&amp;gt;&lt;/li&gt; &lt;li class="code-even"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; MapperBaseText();&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, V2&amp;gt;&amp;gt; Map(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value);&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    [&lt;span style="color:#2b91af"&gt;Serializable&lt;/span&gt;]&lt;/li&gt; &lt;li&gt;    [AbstractClass]&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MapperBaseXml&lt;/span&gt;&amp;lt;V2&amp;gt; : MapReduceBase&amp;lt;V2&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; MapperBaseXml();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, V2&amp;gt;&amp;gt; Map(XElement element);&lt;/li&gt; &lt;li&gt;    }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    [&lt;span style="color:#2b91af"&gt;Serializable&lt;/span&gt;]&lt;/li&gt; &lt;li class="code-even"&gt;    [AbstractClass]&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MapperBaseBinary&lt;/span&gt;&amp;lt;V2&amp;gt; : MapReduceBase&amp;lt;V2&amp;gt;&lt;/li&gt; &lt;li class="code-even"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; MapperBaseBinary();&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, V2&amp;gt;&amp;gt; Map(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; filename, Stream document);&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    [&lt;span style="color:#2b91af"&gt;Serializable&lt;/span&gt;]&lt;/li&gt; &lt;li&gt;    [AbstractClass]&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;CombinerBase&lt;/span&gt;&amp;lt;V2&amp;gt; : MapReduceBase&amp;lt;V2&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; CombinerBase();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, V2&amp;gt;&amp;gt; Combine(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; key, &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;V2&amp;gt; values);&lt;/li&gt; &lt;li&gt;    }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    [&lt;span style="color:#2b91af"&gt;Serializable&lt;/span&gt;]&lt;/li&gt; &lt;li class="code-even"&gt;    [AbstractClass]&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;ReducerBase&lt;/span&gt;&amp;lt;V2, V3&amp;gt; : MapReduceBase&amp;lt;V2&amp;gt;&lt;/li&gt; &lt;li class="code-even"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; ReducerBase();&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, V3&amp;gt;&amp;gt; Reduce(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; key, &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;V2&amp;gt; values);&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The equivalent F# definitions are:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9c4f776f-b838-4c19-b4c4-2ad7b4cb52b0" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div class="code-titleblock"&gt;F# Abstract Classes&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; MapReduceBase&amp;lt;&amp;#39;V2&amp;gt;() =&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Setup: unit &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; unit&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;default&lt;/span&gt; this.Setup() = ()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Cleanup: unit &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * &amp;#39;V2&amp;gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;default&lt;/span&gt; this.Cleanup() = Seq.empty&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; MapperBaseText&amp;lt;&amp;#39;V2&amp;gt;() = &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapReduceBase&amp;lt;&amp;#39;V2&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Map: value:string &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * &amp;#39;V2&amp;gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; MapperBaseXml&amp;lt;&amp;#39;V2&amp;gt;() = &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapReduceBase&amp;lt;&amp;#39;V2&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Map: element:XElement &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * &amp;#39;V2&amp;gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; MapperBaseBinary&amp;lt;&amp;#39;V2&amp;gt;() = &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapReduceBase&amp;lt;&amp;#39;V2&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Map: filename:string &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; document:Stream &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * &amp;#39;V2&amp;gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; CombinerBase&amp;lt;&amp;#39;V2&amp;gt;() = &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapReduceBase&amp;lt;&amp;#39;V2&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Combine: key:string &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; values:IEnumerable&amp;lt;&amp;#39;V2&amp;gt; &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * &amp;#39;V2&amp;gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; ReducerBase&amp;lt;&amp;#39;V2, &amp;#39;V3&amp;gt;() = &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapReduceBase&amp;lt;&amp;#39;V2&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Reduce: key:string &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; values:IEnumerable&amp;lt;&amp;#39;V2&amp;gt; &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * &amp;#39;V3&amp;gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The objective in defining these base classes was to not only support creating .Net Mapper and Reducers but also to provide a means for Setup and Cleanup operations to support In-Place Mapper/Combiner/Reducer optimizations, utilize IEnumerable and sequences for publishing data from all classes, and finally provide a simple submission mechanism analogous to submitting Java based jobs.&lt;/p&gt;  &lt;p&gt;The usage of the Generic types V2 and V3 equate to the names used in the Java definitions. The current type of the input into the Mapper is a string (this normally being V1). This is needed as the mapper, in Streaming jobs, performs the projection from the textual input.&lt;/p&gt;  &lt;p&gt;For each class a Setup function is provided to allow one to perform tasks related to the instantiation of the class. The Mapper’s Map and Cleanup functions return an IEnumerable consisting of tuples with a Key/Value pair. It is these tuples that represent the mappers output. The returned types are written to file using binary serialization.&lt;/p&gt;  &lt;p&gt;The Combiner and Reducer takes in an IEnumerable, for each key, and reduces this into a key/value enumerable. Once again the Cleanup allows for return values, to allow for In-Reducer optimizations.&amp;#160; &lt;/p&gt;  &lt;h4&gt;Binary and XML Processing and Multiple Keys&lt;/h4&gt; As one can see from the abstract class definitions the framework also provides support for submitting jobs that support Binary and XML based Mappers. To support using Mappers derived from these types a “format” submission parameter is required. Supported values being Text, Binary, and XML; the default value being “Text”.&amp;#160; &lt;p&gt;To submit a binary streaming job one just has to use a Mapper derived from the MapperBaseBinary abstract class and use the binary format specification:&lt;/p&gt;  &lt;p&gt;-format Binary&lt;/p&gt;  &lt;p&gt;In this case the input into the Mapper will be a Stream object that represents a complete binary document instance.&lt;/p&gt;  &lt;p&gt;To submit an XML streaming job one just has to use a Mapper derived from the MapperBaseXml abstract class and use the XML format specification, along with a node to be processed within the XML documents:&lt;/p&gt;  &lt;p&gt;-format XML –nodename Node&lt;/p&gt;  &lt;p&gt;In this case the input into the Mapper will be an XElement node derived from the XML document based on the nodename parameter.&lt;/p&gt;  &lt;p&gt;Using multiple keys from the Mapper is a two-step process. Firstly the Mapper needs to be modified to output a string based key in the correct format. This is done by passing the set of string key values into the Utilities.FormatKeys() function. This concatenates the keys using the necessary tab character. Secondly, the job has to be submitted specifying the expected number of keys:&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;MSDN.Hadoop.Submission.Console.exe -input &amp;quot;stores/demographics&amp;quot; -output &amp;quot;stores/banking&amp;quot;      &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceFSharp.StoreXmlElementMapper, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceFSharp.StoreXmlElementReducer, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\Projects\MSDN.Hadoop.MapReduce\Release\MSDN.Hadoop.MapReduceFSharp.dll&amp;quot;       &lt;br /&gt;-nodename Store -format Xml &lt;strong&gt;-numberKeys 2&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This parameter equates to the necessary Hadoop job configuration parameter.&lt;/p&gt;  &lt;h4&gt;Samples&lt;/h4&gt;  &lt;p&gt;To demonstrate the submission framework, here are some sample Mappers and Reducers with the corresponding command line submissions:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;C# Mobile Phone Range (with In-Mapper optimization)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Calculates the mobile phone query time range for a device with an In-Mapper optimization yielding just the Min and Max values:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4b938918-c617-4e38-a31b-1407af62f69d" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div style="background: #ddd; max-height: 500px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; MSDN.Hadoop.MapReduceBase;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceCSharp&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MobilePhoneRangeMapper&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;MapperBaseText&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; ranges;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt; GetLineValue(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;try&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            {&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] splits = value.Split(&lt;span style="color:#a31515"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; devicePlatform = splits[3];&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt; queryTime = &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;.Parse(splits[1]);&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(devicePlatform, queryTime);&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;catch&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;Exception&lt;/span&gt;)&lt;/li&gt; &lt;li class="code-even"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;;&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Setup()&lt;/li&gt; &lt;li class="code-even"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.ranges = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/li&gt; &lt;li class="code-even"&gt;        }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; range = GetLineValue(value);&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (range != &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;/li&gt; &lt;li class="code-even"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (ranges.ContainsKey(range.Item1))&lt;/li&gt; &lt;li class="code-even"&gt;                {&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; original = ranges[range.Item1];&lt;/li&gt; &lt;li class="code-even"&gt;                    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (range.Item2 &amp;lt; original.Item1)&lt;/li&gt; &lt;li&gt;                    {&lt;/li&gt; &lt;li class="code-even"&gt;                        &lt;span style="color:#008000"&gt;// Update Min amount&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                        ranges[range.Item1] = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(range.Item2, original.Item2);&lt;/li&gt; &lt;li class="code-even"&gt;                    }&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (range.Item2 &amp;gt; original.Item2)&lt;/li&gt; &lt;li class="code-even"&gt;                    {&lt;/li&gt; &lt;li&gt;                        &lt;span style="color:#008000"&gt;//Update Max amount&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                        ranges[range.Item1] = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(original.Item1, range.Item2);&lt;/li&gt; &lt;li&gt;                    }&lt;/li&gt; &lt;li class="code-even"&gt;                }&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                {&lt;/li&gt; &lt;li&gt;                    ranges.Add(range.Item1, &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(range.Item2, range.Item2));&lt;/li&gt; &lt;li class="code-even"&gt;                }&lt;/li&gt; &lt;li&gt;            }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Enumerable&lt;/span&gt;.Empty&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/li&gt; &lt;li class="code-even"&gt;        }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; Cleanup()&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; range &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; ranges)&lt;/li&gt; &lt;li&gt;            {&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(range.Key, range.Value.Item1);&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(range.Key, range.Value.Item2);&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MobilePhoneRangeReducer&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;ReducerBase&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt;&amp;gt; Reduce(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; key, &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt; value)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; baseRange = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;.MaxValue, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;.MinValue);&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; rangeValue = value.Aggregate(baseRange, (accSpan, timespan) =&amp;gt;&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;((timespan &amp;lt; accSpan.Item1) ? timespan : accSpan.Item1, (timespan &amp;gt; accSpan.Item2) ? timespan : accSpan.Item2));&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt;(key, rangeValue);&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input &amp;quot;mobilecsharp/data&amp;quot; -output &amp;quot;mobilecsharp/querytimes&amp;quot;       &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceCSharp.MobilePhoneRangeMapper, MSDN.Hadoop.MapReduceCSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceCSharp.MobilePhoneRangeReducer, MSDN.Hadoop.MapReduceCSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\MSDN.Hadoop.MapReduceCSharp\Release\MSDN.Hadoop.MapReduceCSharp.dll&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;C# Mobile Min (with Mapper, Combiner, Reducer)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Calculates the mobile phone minimum time for a device with a combiner yielding just the Min value:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9411385d-68f1-4b30-9620-b72ca0ae60a4" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div style="background: #ddd; max-height: 500px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; MSDN.Hadoop.MapReduceBase;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceCSharp&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MobilePhoneMinMapper&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;MapperBaseText&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt; GetLineValue(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;try&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            {&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] splits = value.Split(&lt;span style="color:#a31515"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; devicePlatform = splits[3];&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt; queryTime = &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;.Parse(splits[1]);&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(devicePlatform, queryTime);&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;catch&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;Exception&lt;/span&gt;)&lt;/li&gt; &lt;li class="code-even"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;;&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value)&lt;/li&gt; &lt;li class="code-even"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; returnVal = GetLineValue(value);&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (returnVal != &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; returnVal;&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MobilePhoneMinCombiner&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;CombinerBase&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; Combine(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; key, &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt; value)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(key, value.Min());&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MobilePhoneMinReducer&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;ReducerBase&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; Reduce(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; key, &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt; value)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;TimeSpan&lt;/span&gt;&amp;gt;(key, value.Min());&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input &amp;quot;mobilecsharp/data&amp;quot; -output &amp;quot;mobilecsharp/querytimes&amp;quot;       &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinMapper, MSDN.Hadoop.MapReduceCSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinReducer, MSDN.Hadoop.MapReduceCSharp&amp;quot;       &lt;br /&gt;-combiner &amp;quot;MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinCombiner, MSDN.Hadoop.MapReduceCSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\MSDN.Hadoop.MapReduceCSharp\Release\MSDN.Hadoop.MapReduceCSharp.dll&amp;quot;&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;F# Mobile Phone Query&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Calculates the mobile phone range and average time for a device:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d355b032-a3a3-46eb-9338-62df3fb50fa4" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceFSharp&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; MobilePhoneQueryMapper() =&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapperBaseText&amp;lt;TimeSpan&amp;gt;()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Performs the split into key/value&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; splitInput (value:string) =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;try&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; splits = value.Split(&lt;span style="color:#800000"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; devicePlatform = splits.[3]&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; queryTime = TimeSpan.Parse(splits.[1])&lt;/li&gt; &lt;li&gt;            Some(devicePlatform, queryTime)&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        | :? System.ArgumentException &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; None&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Map the data from input name/value to output name/value&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; self.Map (value:string) =&lt;/li&gt; &lt;li&gt;        seq {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; result = splitInput value&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; result.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; result.Value&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; MobilePhoneQueryReducer() =&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; ReducerBase&amp;lt;TimeSpan, (TimeSpan*TimeSpan*TimeSpan)&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; self.Reduce (key:string) (values:seq&amp;lt;TimeSpan&amp;gt;) =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; initState = (TimeSpan.MaxValue, TimeSpan.MinValue, 0L, 0L)&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; (minValue, maxValue, totalValue, totalCount) =&lt;/li&gt; &lt;li&gt;            values |&amp;gt; &lt;/li&gt; &lt;li class="code-even"&gt;            Seq.fold (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; (minValue, maxValue, totalValue, totalCount) value &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                (min minValue value, max maxValue value, totalValue + (int64)(value.TotalSeconds), totalCount + 1L) ) initState&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        Seq.singleton (key, (minValue, TimeSpan.FromSeconds((float)(totalValue/totalCount)), maxValue))&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input &amp;quot;mobile/data&amp;quot; -output &amp;quot;mobile/querytimes&amp;quot;       &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryMapper, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryReducer, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\MSDN.Hadoop.MapReduceFSharp\Release\MSDN.Hadoop.MapReduceFSharp.dll&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;F# Store XML (XML in Samples)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Calculates the total revenue, within the store XML, based on demographic data; also demonstrating multiple keys:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:eefae971-06d3-497e-809a-36823f6c084e" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceFSharp&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Collections.Generic&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Linq&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.IO&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Text&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Xml&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Xml.Linq&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; StoreXmlElementMapper() =    &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapperBaseXml&amp;lt;decimal&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; self.Map (element:XElement) =&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; aw = &lt;span style="color:#800000"&gt;&amp;quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; demographics = element.Element(XName.Get(&lt;span style="color:#800000"&gt;&amp;quot;Demographics&amp;quot;&lt;/span&gt;)).Element(XName.Get(&lt;span style="color:#800000"&gt;&amp;quot;StoreSurvey&amp;quot;&lt;/span&gt;, aw))&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        seq {&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not(demographics = &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; business = demographics.Element(XName.Get(&lt;span style="color:#800000"&gt;&amp;quot;BusinessType&amp;quot;&lt;/span&gt;, aw)).Value&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; bank = demographics.Element(XName.Get(&lt;span style="color:#800000"&gt;&amp;quot;BankName&amp;quot;&lt;/span&gt;, aw)).Value&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; key = Utilities.FormatKeys(business, bank)&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; sales = Decimal.Parse(demographics.Element(XName.Get(&lt;span style="color:#800000"&gt;&amp;quot;AnnualSales&amp;quot;&lt;/span&gt;, aw)).Value)&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; (key, sales)&lt;/li&gt; &lt;li class="code-even"&gt;            }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; StoreXmlElementReducer() = &lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; ReducerBase&amp;lt;decimal, int&amp;gt;()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; self.Reduce (key:string) (values:seq&amp;lt;decimal&amp;gt;) =&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; totalRevenue =&lt;/li&gt; &lt;li&gt;            values |&amp;gt; Seq.sum            &lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        Seq.singleton (key, int totalRevenue)&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input &amp;quot;stores/demographics&amp;quot; -output &amp;quot;stores/banking&amp;quot;       &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceFSharp.StoreXmlElementMapper, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceFSharp.StoreXmlElementReducer, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\MSDN.Hadoop.MapReduceFSharp\bin\Release\MSDN.Hadoop.MapReduceFSharp.dll&amp;quot;       &lt;br /&gt;-nodename Store -format Xml&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;F# Binary Document (Word and PDF Documents)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Calculates the pages per author for a combination of Office Word and PDF documents:&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0ade9c45-d608-4384-a2eb-3810a51fcfd5" class="wlWriterEditableSmartContent"&gt; &lt;div class="code-container"&gt; &lt;div style="background: #ddd; max-height: 500px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 3em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceFSharp&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Collections.Generic&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Linq&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.IO&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Text&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Xml&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; System.Xml.Linq&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; DocumentFormat.OpenXml&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; DocumentFormat.OpenXml.Packaging&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; DocumentFormat.OpenXml.Wordprocessing&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; iTextSharp.text&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; iTextSharp.text.pdf&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;open&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; OfficePageMapper() =&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; MapperBaseBinary&amp;lt;int&amp;gt;()&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; (|WordDocument|PdfDocument|UnsupportedDocument|) extension = &lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.Equals(extension, &lt;span style="color:#800000"&gt;&amp;quot;.docx&amp;quot;&lt;/span&gt;, StringComparison.InvariantCultureIgnoreCase) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            WordDocument&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.Equals(extension, &lt;span style="color:#800000"&gt;&amp;quot;.pdf&amp;quot;&lt;/span&gt;, StringComparison.InvariantCultureIgnoreCase) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            PdfDocument&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            UnsupportedDocument&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; dc = XNamespace.Get(&lt;span style="color:#800000"&gt;&amp;quot;http://purl.org/dc/elements/1.1/&amp;quot;&lt;/span&gt;)&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; cp = XNamespace.Get(&lt;span style="color:#800000"&gt;&amp;quot;http://schemas.openxmlformats.org/package/2006/metadata/core-properties&amp;quot;&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; unknownAuthor = &lt;span style="color:#800000"&gt;&amp;quot;unknown author&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; authorKey = &lt;span style="color:#800000"&gt;&amp;quot;Author&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getAuthorsWord (document:WordprocessingDocument) =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; coreFilePropertiesXDoc = XElement.Load(document.CoreFilePropertiesPart.GetStream())&lt;/li&gt; &lt;li class="code-even"&gt;          &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#008000"&gt;// Take the first dc:creator element and split based on a &amp;quot;;&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; creators = coreFilePropertiesXDoc.Elements(dc + &lt;span style="color:#800000"&gt;&amp;quot;creator&amp;quot;&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; Seq.isEmpty creators &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            [| unknownAuthor |]&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; creator = (Seq.head creators).Value&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.IsNullOrWhiteSpace(creator) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                [| unknownAuthor |]&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                creator.Split(&lt;span style="color:#800000"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getPagesWord (document:WordprocessingDocument) =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#008000"&gt;// return page count&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        Int32.Parse(document.ExtendedFilePropertiesPart.Properties.Pages.Text)&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getAuthorsPdf (document:PdfReader) =          &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#008000"&gt;// For PDF documents perform the split on a &amp;quot;,&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; document.Info.ContainsKey(authorKey) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; creators = document.Info.[authorKey]&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.IsNullOrWhiteSpace(creators) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                [| unknownAuthor |]&lt;/li&gt; &lt;li class="code-even"&gt;            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                creators.Split(&lt;span style="color:#800000"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;)&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            [| unknownAuthor |]&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getPagesPdf (document:PdfReader) =&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#008000"&gt;// return page count&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        document.NumberOfPages&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Map the data from input name/value to output name/value&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; self.Map (filename:string) (document:Stream) =&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; result =&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; Path.GetExtension(filename) &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            | WordDocument &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Get access to the word processing document from the input stream&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; document = WordprocessingDocument.Open(document, &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Process the word document with the mapper&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; pages = getPagesWord document&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; authors = (getAuthorsWord document) &lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#008000"&gt;// close document&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                document.Close()&lt;/li&gt; &lt;li class="code-even"&gt;                Some(pages, authors)&lt;/li&gt; &lt;li&gt;            | PdfDocument &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#008000"&gt;// Get access to the pdf processing document from the input stream&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; document = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; PdfReader(document)&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#008000"&gt;// Process the pdf document with the mapper&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; pages = getPagesPdf document&lt;/li&gt; &lt;li class="code-even"&gt;                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; authors = (getAuthorsPdf document)       &lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// close document&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;                document.Close()&lt;/li&gt; &lt;li&gt;                Some(pages, authors)&lt;/li&gt; &lt;li class="code-even"&gt;            | UnsupportedDocument &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                None&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; result.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;/li&gt; &lt;li class="code-even"&gt;            snd result.Value&lt;/li&gt; &lt;li&gt;            |&amp;gt; Seq.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; author &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; (author, fst result.Value))&lt;/li&gt; &lt;li class="code-even"&gt;        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            Seq.empty&lt;/li&gt; &lt;li class="code-even"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; OfficePageReducer() = &lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; ReducerBase&amp;lt;int, int&amp;gt;()&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;    &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; self.Reduce (key:string) (values:seq&amp;lt;int&amp;gt;) =&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; totalPages =&lt;/li&gt; &lt;li class="code-even"&gt;            values |&amp;gt; Seq.sum&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li class="code-even"&gt;        Seq.singleton (key, totalPages)&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;p&gt;&lt;font face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input &amp;quot;office/documents&amp;quot; -output &amp;quot;office/authors&amp;quot;       &lt;br /&gt;-mapper &amp;quot;MSDN.Hadoop.MapReduceFSharp.OfficePageMapper, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-reducer &amp;quot;MSDN.Hadoop.MapReduceFSharp.OfficePageReducer, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-combiner &amp;quot;MSDN.Hadoop.MapReduceFSharp.OfficePageReducer, MSDN.Hadoop.MapReduceFSharp&amp;quot;       &lt;br /&gt;-file &amp;quot;%HOMEPATH%\MSDN.Hadoop.MapReduceFSharp\bin\Release\MSDN.Hadoop.MapReduceFSharp.dll&amp;quot;       &lt;br /&gt;-file &amp;quot;C:\Reference Assemblies\itextsharp.dll&amp;quot; -format Binary&lt;/font&gt;&lt;/p&gt;  &lt;h4&gt;Optional Parameters&lt;/h4&gt;  &lt;p&gt;To support some additional Hadoop Streaming options a few optional parameters are supported.&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;-numberReducers X&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;As expected this specifies the maximum number of reducers to use.&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;-debug&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The option turns on verbose mode and specifies a job configuration to keep failed task outputs.&lt;/p&gt;  &lt;p&gt;To view the the supported options one can use a help parameters, displaying:&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;Command Arguments:      &lt;br /&gt;-input (Required=true) : Input Directory or Files       &lt;br /&gt;-output (Required=true) : Output Directory       &lt;br /&gt;-mapper (Required=true) : Mapper Class       &lt;br /&gt;-reducer (Required=true) : Reducer Class       &lt;br /&gt;-combiner (Required=false) : Combiner Class (Optional)       &lt;br /&gt;-format (Required=false) : Input Format |Text(Default)|Binary|Xml|       &lt;br /&gt;-numberReducers (Required=false) : Number of Reduce Tasks (Optional)       &lt;br /&gt;-numberKeys (Required=false) : Number of MapReduce Keys (Optional)       &lt;br /&gt;-file (Required=true) : Processing Files (Must include Map and Reduce Class files)       &lt;br /&gt;-nodename (Required=false) : XML Processing Nodename (Optional)       &lt;br /&gt;-debug (Required=false) : Turns on Debugging Options&lt;/font&gt;&lt;/p&gt;  &lt;h4&gt;UI Submission&lt;/h4&gt;  &lt;p&gt;The provided submission framework works from a command-line. However there is nothing to stop one submitting the job using a UI; albeit a command console is opened. To this end I have put together a simple UI that supports submitting Hadoop jobs.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4527.image_5F00_3C3814FC.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0211.image_5F00_thumb_5F00_01706C26.png" width="500" height="393" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This simple UI supports all the necessary options for submitting jobs.&lt;/p&gt;  &lt;h4&gt;Code Download&lt;/h4&gt;  &lt;p&gt;As mentioned the actual Executables and Source code can be downloaded from:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7"&gt;http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The source includes, not only the .Net submission framework, but also all necessary Java classes for supporting the Binary and XML job submissions. This relies on a custom Streaming JAR which should be copied to the Hadoop lib directory, there are two versions of the Streaming jar; one for running in azure and one for when running local. The difference is that they have been compiled with different versions of the Java compiler. Just remember to use the appropriate version (dropping the –local and –azure prefixes) when copying to your Hadoop lib folder.&lt;/p&gt;  &lt;p&gt;To use the code one just needs to reference the EXE’s in the Release directory. This folder also contains the MSDN.Hadoop.MapReduceBase.dll that contains the abstract base class definitions. &lt;/p&gt;  &lt;h4&gt;Moving Forward&lt;/h4&gt;  &lt;p&gt;In a separate post I will cover what is actually happening under the covers.&lt;/p&gt;  &lt;p&gt;As always if you find the code useful and/or use this for your MapReduce jobs, or just have some comments, please do let me know.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10299979" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Azure/">Windows Azure</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+Development/">.Net Development</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+4-0/">.Net 4.0</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/C_2300_/">C#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IEnumerable/">IEnumerable</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop+Streaming/">Hadoop Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop/">Hadoop</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/XML+Streaming/">XML Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Binary+Streaming/">Binary Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/MapReduce/">MapReduce</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net/">.Net</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+Prgramming/">.Net Prgramming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/iTextSharp/">iTextSharp</category></item><item><title>Framework for Composing and Submitting .Net Hadoop MapReduce Jobs</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/04/16/framework-for-composing-and-submitting-net-hadoop-mapreduce-jobs.aspx</link><pubDate>Mon, 16 Apr 2012 19:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10294222</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10294222</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/04/16/framework-for-composing-and-submitting-net-hadoop-mapreduce-jobs.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;An updated version of this post can be found at:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/carlnol/archive/2012/04/29/generic-based-framework-for-net-hadoop-mapreduce-job-submission.aspx"&gt;http://blogs.msdn.com/b/carlnol/archive/2012/04/29/generic-based-framework-for-net-hadoop-mapreduce-job-submission.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you have been following my blog you will see that I have been putting together samples for writing .Net Hadoop MapReduce jobs; using Hadoop Streaming. However one thing that became apparent is that the samples could be reconstructed in a composable framework to enable one to submit .Net based MapReduce jobs whilst only writing Mappers and Reducers types.&lt;/p&gt;
&lt;p&gt;To this end I have put together a framework that allows one to submit MapReduce jobs using the following command line syntax:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input "mobile/data/debug/sampledata.txt" -output "mobile/querytimes/debug"&amp;nbsp; &lt;br /&gt;-mapper "MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryMapper, MSDN.Hadoop.MapReduceFSharp"&amp;nbsp; &lt;br /&gt;-reducer "MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryReducer, MSDN.Hadoop.MapReduceFSharp"&amp;nbsp; &lt;br /&gt;-file "%HOMEPATH%\MSDN.Hadoop.MapReduce\bin\Release\MSDN.Hadoop.MapReduceFSharp.dll"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Where the mapper and reducer parameters are .Net types that derive from a base Map and Reduce abstract classes. The input, output, and files options are analogous to the standard Hadoop streaming submissions. The mapper and reducer options (more on a combiner option later) allow one to define a .Net type derived from the appropriate abstract base classes.&lt;/p&gt;
&lt;p&gt;Under the covers standard Hadoop Streaming is being used, where controlling executables are used to handle the StdIn and StdOut operations and activating the required .Net types. The &amp;ldquo;&lt;span style="font-family: consolas;" face="Consolas"&gt;file&lt;/span&gt;&amp;rdquo; parameter is required to specify the DLL for the .Net type to be loaded at runtime, in addition to any other required files.&lt;/p&gt;
&lt;p&gt;As an aside the framework and base classes are all written in F#; with sample Mappers and Reducers, and abstract base classes being provided both in C# and F#. The code is based off the F# Streaming samples in my previous &lt;a title="Hadoop Streaming and F# MapReduce" href="http://blogs.msdn.com/b/carlnol/archive/2011/12/16/hadoop-streaming-and-f-mapreduce.aspx"&gt;blog posts&lt;/a&gt;. I will cover more of the semantics of the code in a later post, but I wanted to provide some usage samples of the code.&lt;/p&gt;
&lt;p&gt;As always the source can be downloaded from:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7" href="http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7"&gt;http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapper and Reducer Base Classes&lt;/h3&gt;
&lt;p&gt;The following definitions outline the abstract base classes from which one needs to derive.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C# Base&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cc27546e-43e3-4f9e-9fdc-6a99de046eef" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[AbstractClass]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MapReduceBase&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;protected&lt;/span&gt; MapReduceBase();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Cleanup();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; Setup();&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;C# Base Mapper&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:895776e7-64ec-4164-b56a-d31a7a5048e8" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MapperBaseText&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;MapReduceBase&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;protected&lt;/span&gt; MapperBaseText();&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Cleanup();&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; value);&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;C# Base Reducer&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e56c193d-c68d-4e8d-8581-75eaaae55202" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[AbstractClass]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ReducerBase&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;MapReduceBase&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;protected&lt;/span&gt; ReducerBase();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Reduce(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; key, &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;&amp;gt; values);&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;F# Base&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7e524285-3b80-42ae-bb0a-eeed9e37689d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; MapReduceBase() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Setup: unit &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; unit&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;default&lt;/span&gt; this.Setup() = ()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Cleanup: unit &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;default&lt;/span&gt; this.Cleanup() = Seq.empty&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;F# Base Mapper&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:05d84c81-442b-4b2f-a6d4-a5fbd23abd5b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; MapperBaseText() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapReduceBase()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Map: string &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Cleanup: unit &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;default&lt;/span&gt; this.Cleanup() = Seq.empty&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;F# Base Reducer&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:914fa94b-6a54-4c7b-b5d0-be771beac45e" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; ReducerBase() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapReduceBase()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Reduce: key:string &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; values:IEnumerable&amp;lt;string&amp;gt; &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The objective in defining these base classes was to not only support creating .Net Mapper and Reducers but also to provide a means for Setup and Cleanup operations to support In-Place Mapper optimizations, utilize IEnumerable and sequences for publishing data from the Mappers and Reducers, and finally provide a simple submission mechanism analogous to submitting Java based jobs.&lt;/p&gt;
&lt;p&gt;For each class a Setup function is provided to allow one to perform tasks related to the instantiation of each Mapper and/or Reducer. The Mapper&amp;rsquo;s Map and Cleanup functions return an IEnumerable consisting of tuples with a a Key/Value pair. It is these tuples that represent the mappers output. Currently the types of the key and value&amp;rsquo;s are respectively a String and an Object. These are then converted to strings for the streaming output.&lt;/p&gt;
&lt;p&gt;The Reducer takes in an IEnumerable of the Object String representations, created by the Mapper output, and reduces this into a Object value enumerable. Once again the Cleanup allows for return values to allow for In-Reducer optimizations.&lt;/p&gt;
&lt;h3&gt;Combiners&lt;/h3&gt;
&lt;p&gt;The support for Combiners is provided through one of two means. As is often the case, support is provided so one can reuse a Reducer as a Combiner. In addition explicit support is provided for a Combiner using the following abstract class definition:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C# Base Combiner&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f61d538b-8e3d-48f3-bbb9-24b469254b7c" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MobilePhoneMinCombiner&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;CombinerBase&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Combine(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; key, &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;&amp;gt; value)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(key, value.Select(timespan =&amp;gt; &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.Parse(timespan)).Min());&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;F# Base Combiner&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cf1deab2-73c6-4428-ab3c-88e915c372ec" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; CombinerBase() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapReduceBase()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Combine: key:string &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; values:IEnumerable&amp;lt;string&amp;gt; &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using a Combiner follows exactly the same pattern for using mappers and reducers, as example being:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas; font-size: x-small;" face="Consolas" size="2"&gt;-combiner "MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinCombiner, MSDN.Hadoop.MapReduceCSharp"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The prototype for the Combiner is essentially the same as that of the Reducer except the function called for each row of data is Combine, rather than Reduce.&lt;/p&gt;
&lt;h3&gt;Binary and XML Processing&lt;/h3&gt;
&lt;p&gt;In my previous posts on Hadoop Streaming I provided samples that allowed one to perform &lt;a title="Hadoop Binary Streaming and F# MapReduce" href="http://blogs.msdn.com/b/carlnol/archive/2011/12/30/hadoop-binary-streaming-and-f-mapreduce.aspx"&gt;Binary&lt;/a&gt; and &lt;a title="Hadoop XML Streaming and F# MapReduce" href="http://blogs.msdn.com/b/carlnol/archive/2012/01/21/hadoop-xml-streaming-and-f-mapreduce.aspx"&gt;XML&lt;/a&gt; based Mappers. The composable framework also provides support for submitting jobs that support Binary and XML based Mappers. To support this the following additional abstract classes have been defined:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C# Base Binary Mapper&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8bdd89c9-ddd8-45ef-85dc-037ac2af021d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[AbstractClass]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MapperBaseBinary&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;MapReduceBase&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;protected&lt;/span&gt; MapperBaseBinary();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; filename, &lt;span style="color: #2b91af;"&gt;Stream&lt;/span&gt; document);&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;C# Base XML Mapper&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0dd34d84-2ecb-411b-b4d7-45dfa442ae8d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[AbstractClass]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MapperBaseXml&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;MapReduceBase&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;protected&lt;/span&gt; MapperBaseXml();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color: #2b91af;"&gt;XElement&lt;/span&gt; element);&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;F# Base Binary Mapper&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b27a5a6e-715f-4d60-b43b-44356de80ba7" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; MapperBaseBinary() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapReduceBase()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Map: filename:string &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; document:Stream &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;F# Base XML Mapper&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:eb93221d-c413-4f5b-a397-ff3ba0ae91a9" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;[&amp;lt;AbstractClass&amp;gt;]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; MapperBaseXml() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapReduceBase()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;member&lt;/span&gt; Map: element:XElement &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; IEnumerable&amp;lt;string * obj&amp;gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To support using Mappers and Reducers derived from these types a &amp;ldquo;&lt;span style="font-family: consolas;" face="Consolas"&gt;format&lt;/span&gt;&amp;rdquo; submission parameter is required. Supported values being Text, Binary, and XML; the default value being &amp;ldquo;Text&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;To submit a binary streaming job one just has to use a Mapper derived from the MapperBaseBinary abstract class and use the binary &lt;span style="font-family: consolas;" face="Consolas"&gt;format&lt;/span&gt; specification:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas; font-size: x-small;" face="Consolas" size="2"&gt;-format Binary&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In this case&amp;nbsp; the input into the Mapper will be a Stream object that represents a complete binary document instance.&lt;/p&gt;
&lt;p&gt;To submit an XML streaming job one just has to use a Mapper derived from the MapperBaseXml abstract class and use the XML &lt;span style="font-family: consolas;" face="Consolas"&gt;format&lt;/span&gt; specification, along with a node to be processed within the XML documents:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas; font-size: x-small;" face="Consolas" size="2"&gt;-format XML &amp;ndash;nodename Node&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In this case the input into the Mapper will be an XElement node derived from the XML document based on the &lt;span style="font-family: consolas;" face="Consolas"&gt;nodename&lt;/span&gt; parameter.&lt;/p&gt;
&lt;h3&gt;Samples&lt;/h3&gt;
&lt;p&gt;To demonstrate the submission framework here are some sample Mappers and Reducers with the corresponding command line submissions:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C# Mobile Phone Range (with In-Mapper optimization)&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a28dc6e5-9ef5-445d-9067-afd48764fdf4" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 500px; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceCSharp&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MobilePhoneRangeMapper&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;MapperBaseText&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt; ranges;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt; GetLineValue(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; value)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;try&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;[] splits = value.Split(&lt;span style="color: #a31515;"&gt;'\t'&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; devicePlatform = splits[3];&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt; queryTime = &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.Parse(splits[1]);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;(devicePlatform, queryTime);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; &lt;/span&gt;&lt;span style="color: #808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; Define a Dictionary to hold the (Min, Max) tuple for each device platform.&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; &lt;/span&gt;&lt;span style="color: #808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; Setup()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.ranges = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; &lt;/span&gt;&lt;span style="color: #808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; Build the Dictionary of the (Min, Max) tuple for each device platform.&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; &lt;/span&gt;&lt;span style="color: #808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; value)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; range = GetLineValue(value);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (range != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (ranges.ContainsKey(range.Item1))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; original = ranges[range.Item1];&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (range.Item2 &amp;lt; original.Item1)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Update Min amount&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ranges[range.Item1] = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;(range.Item2, original.Item2);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (range.Item2 &amp;gt; original.Item2)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;//Update Max amount&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ranges[range.Item1] = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;(original.Item1, range.Item2);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ranges.Add(range.Item1, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;(range.Item2, range.Item2));&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Enumerable&lt;/span&gt;.Empty&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; &lt;/span&gt;&lt;span style="color: #808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; Return the Dictionary of the Min and Max values for each device platform.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #808080;"&gt;///&lt;/span&gt;&lt;span style="color: #008000;"&gt; &lt;/span&gt;&lt;span style="color: #808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Cleanup()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; range &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; ranges)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(range.Key, range.Value.Item1);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(range.Key, range.Value.Item2);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MobilePhoneRangeReducer&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;ReducerBase&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Reduce(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; key, &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;&amp;gt; value)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; baseRange = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.MaxValue, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.MinValue);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; rangeValue = value.Select(stringspan =&amp;gt; &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.Parse(stringspan)).Aggregate(baseRange, (accSpan, timespan) =&amp;gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&amp;gt;((timespan &amp;lt; accSpan.Item1) ? timespan : accSpan.Item1, (timespan &amp;gt; accSpan.Item2) ? timespan : accSpan.Item2));&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(key, rangeValue);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input "mobilecsharp/data" -output "mobilecsharp/querytimes" &lt;br /&gt;-mapper "MSDN.Hadoop.MapReduceCSharp.MobilePhoneRangeMapper, MSDN.Hadoop.MapReduceCSharp" &lt;br /&gt;-reducer "MSDN.Hadoop.MapReduceCSharp.MobilePhoneRangeReducer, MSDN.Hadoop.MapReduceCSharp" &lt;br /&gt;-file "%HOMEPATH%\MSDN.Hadoop.MapReduceCSharp\bin\Release\MSDN.Hadoop.MapReduceCSharp.dll"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C# Mobile Min (with Mapper, Combiner, Reducer)&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:78c3e95d-2ccc-4a26-965b-f0091cf9750b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 500px; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceCSharp&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MobilePhoneMinMapper&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;MapperBaseText&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt; GetLineValue(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; value)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;try&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;[] splits = value.Split(&lt;span style="color: #a31515;"&gt;'\t'&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; devicePlatform = splits[3];&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt; queryTime = &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.Parse(splits[1]);&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(devicePlatform, queryTime);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Map(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; value)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; returnVal = GetLineValue(value);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (returnVal != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; returnVal;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MobilePhoneMinCombiner&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;CombinerBase&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Combine(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; key, &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;&amp;gt; value)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(key, value.Select(timespan =&amp;gt; &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.Parse(timespan)).Min());&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MobilePhoneMinReducer&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;ReducerBase&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; Reduce(&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; key, &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;&amp;gt; value)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Tuple&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt;&amp;gt;(key, value.Select(timespan =&amp;gt; &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;.Parse(timespan)).Min());&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input "mobilecsharp/data" -output "mobilecsharp/querytimes" &lt;br /&gt;-mapper "MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinMapper, MSDN.Hadoop.MapReduceCSharp" &lt;br /&gt;-reducer "MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinReducer, MSDN.Hadoop.MapReduceCSharp" &lt;br /&gt;-combiner "MSDN.Hadoop.MapReduceCSharp.MobilePhoneMinCombiner, MSDN.Hadoop.MapReduceCSharp" &lt;br /&gt;-file "%HOMEPATH%\MSDN.Hadoop.MapReduceCSharp\bin\Release\MSDN.Hadoop.MapReduceCSharp.dll" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;F# Mobile Phone Query&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e3c6dc0d-5f86-4e1e-9ff5-b48bc6857ab3" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 500px; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceFSharp&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #008000;"&gt;// Extracts the QueryTime for each Platform Device&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; MobilePhoneQueryMapper() =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapperBaseText()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Performs the split into key/value&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; splitInput (value:string) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;try&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; splits = value.Split(&lt;span style="color: #800000;"&gt;'\t'&lt;/span&gt;)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; devicePlatform = splits.[3]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; queryTime = TimeSpan.Parse(splits.[1])&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Some(devicePlatform, box queryTime)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;with&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| :? System.ArgumentException &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; None&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Map the data from input name/value to output name/value&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; self.Map (value:string) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seq {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; result = splitInput value&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; result.IsSome &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; result.Value&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #008000;"&gt;// Calculates the (Min, Avg, Max) of the input stream query time (based on Platform Device)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; MobilePhoneQueryReducer() =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; ReducerBase()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; self.Reduce (key:string) (values:seq&amp;lt;string&amp;gt;) =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; initState = (TimeSpan.MaxValue, TimeSpan.MinValue, 0L, 0L)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; (minValue, maxValue, totalValue, totalCount) =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values |&amp;gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.fold (&lt;span style="color: #0000ff;"&gt;fun&lt;/span&gt; (minValue, maxValue, totalValue, totalCount) value &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(min minValue (TimeSpan.Parse(value)), max maxValue (TimeSpan.Parse(value)), totalValue + (int64)(TimeSpan.Parse(value).TotalSeconds), totalCount + 1L) ) initState&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.singleton (key, box (minValue, TimeSpan.FromSeconds((float)(totalValue/totalCount)), maxValue))&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input "mobile/data" -output "mobile/querytimes" &lt;br /&gt;-mapper "MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryMapper, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-reducer "MSDN.Hadoop.MapReduceFSharp.MobilePhoneQueryReducer, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-file "%HOMEPATH%\MSDN.Hadoop.MapReduceFSharp\bin\Release\MSDN.Hadoop.MapReduceFSharp.dll"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;F# Store XML (XML in Samples)&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3c7bae91-3f6b-46bc-9c39-3cce86be3ee0" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 500px; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceFSharp&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Collections.Generic&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Linq&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.IO&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Text&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Xml&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Xml.Linq&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #008000;"&gt;// Extracts the QueryTime for each Platform Device&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; StoreXmlElementMapper() =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapperBaseXml()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; self.Map (element:XElement) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; aw = &lt;span style="color: #800000;"&gt;"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; demographics = element.Element(XName.Get(&lt;span style="color: #800000;"&gt;"Demographics"&lt;/span&gt;)).Element(XName.Get(&lt;span style="color: #800000;"&gt;"StoreSurvey"&lt;/span&gt;, aw))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seq {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; not(demographics = &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; business = demographics.Element(XName.Get(&lt;span style="color: #800000;"&gt;"BusinessType"&lt;/span&gt;, aw)).Value&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; sales = Decimal.Parse(demographics.Element(XName.Get(&lt;span style="color: #800000;"&gt;"AnnualSales"&lt;/span&gt;, aw)).Value) |&amp;gt; box&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;yield&lt;/span&gt; (business, sales)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #008000;"&gt;// Calculates the Total Revenue of the store demographics&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; StoreXmlElementReducer() =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; ReducerBase()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; self.Reduce (key:string) (values:seq&amp;lt;string&amp;gt;) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; totalRevenue =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values |&amp;gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.fold (&lt;span style="color: #0000ff;"&gt;fun&lt;/span&gt; revenue value &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; revenue + Int32.Parse(value)) 0&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.singleton (key, box totalRevenue)&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input "stores/demographics" -output "stores/banking" &lt;br /&gt;-mapper "MSDN.Hadoop.MapReduceFSharp.StoreXmlElementMapper, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-reducer "MSDN.Hadoop.MapReduceFSharp.StoreXmlElementReducer, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-file "%HOMEPATH%\MSDN.Hadoop.MapReduceFSharp\bin\Release\MSDN.Hadoop.MapReduceFSharp.dll" &lt;br /&gt;-nodename Store -format Xml&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;F# Binary Document (Word and PDF Documents)&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fa9cade6-cb58-4445-89dd-8a40cd98ad0e" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 500px; overflow: auto;"&gt;&lt;ol style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; MSDN.Hadoop.MapReduceFSharp&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Collections.Generic&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Linq&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.IO&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Text&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Xml&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; System.Xml.Linq&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; DocumentFormat.OpenXml&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; DocumentFormat.OpenXml.Packaging&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; DocumentFormat.OpenXml.Wordprocessing&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; iTextSharp.text&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; iTextSharp.text.pdf&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #0000ff;"&gt;open&lt;/span&gt; MSDN.Hadoop.MapReduceBase&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #008000;"&gt;// Calculates the pages per author for a Word document&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; OfficePageMapper() =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; MapperBaseBinary()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; (|WordDocument|PdfDocument|UnsupportedDocument|) extension =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; String.Equals(extension, &lt;span style="color: #800000;"&gt;".docx"&lt;/span&gt;, StringComparison.InvariantCultureIgnoreCase) &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WordDocument&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; String.Equals(extension, &lt;span style="color: #800000;"&gt;".pdf"&lt;/span&gt;, StringComparison.InvariantCultureIgnoreCase) &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PdfDocument&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UnsupportedDocument&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; dc = XNamespace.Get(&lt;span style="color: #800000;"&gt;"http://purl.org/dc/elements/1.1/"&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; cp = XNamespace.Get(&lt;span style="color: #800000;"&gt;"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"&lt;/span&gt;)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; unknownAuthor = &lt;span style="color: #800000;"&gt;"unknown author"&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; authorKey = &lt;span style="color: #800000;"&gt;"Author"&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; getAuthorsWord (document:WordprocessingDocument) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; coreFilePropertiesXDoc = XElement.Load(document.CoreFilePropertiesPart.GetStream())&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Take the first dc:creator element and split based on a ";"&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; creators = coreFilePropertiesXDoc.Elements(dc + &lt;span style="color: #800000;"&gt;"creator"&lt;/span&gt;)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; Seq.isEmpty creators &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[| unknownAuthor |]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; creator = (Seq.head creators).Value&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; String.IsNullOrWhiteSpace(creator) &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[| unknownAuthor |]&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;creator.Split(&lt;span style="color: #800000;"&gt;';'&lt;/span&gt;)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; getPagesWord (document:WordprocessingDocument) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// return page count&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Int32.Parse(document.ExtendedFilePropertiesPart.Properties.Pages.Text)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; getAuthorsPdf (document:PdfReader) =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// For PDF documents perform the split on a ","&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; document.Info.ContainsKey(authorKey) &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; creators = document.Info.[authorKey]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; String.IsNullOrWhiteSpace(creators) &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[| unknownAuthor |]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;creators.Split(&lt;span style="color: #800000;"&gt;','&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[| unknownAuthor |]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; getPagesPdf (document:PdfReader) =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// return page count&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.NumberOfPages&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Map the data from input name/value to output name/value&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; self.Map (filename:string) (document:Stream) =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; result =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;match&lt;/span&gt; Path.GetExtension(filename) &lt;span style="color: #0000ff;"&gt;with&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| WordDocument &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Get access to the word processing document from the input stream&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;use&lt;/span&gt; document = WordprocessingDocument.Open(document, &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Process the word document with the mapper&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; pages = getPagesWord document&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; authors = (getAuthorsWord document)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// close document&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.Close()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Some(pages, authors)&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| PdfDocument &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Get access to the pdf processing document from the input stream&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; document = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; PdfReader(document)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// Process the pdf document with the mapper&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; pages = getPagesPdf document&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; authors = (getAuthorsPdf document)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;// close document&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.Close()&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Some(pages, authors)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| UnsupportedDocument &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;None&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; result.IsSome &lt;span style="color: #0000ff;"&gt;then&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;snd result.Value&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;gt; Seq.map (&lt;span style="color: #0000ff;"&gt;fun&lt;/span&gt; author &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; (author, (box &amp;lt;&amp;lt; fst) result.Value))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.empty&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&lt;span style="color: #008000;"&gt;// Calculates the total pages per author&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt; OfficePageReducer() =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;inherit&lt;/span&gt; ReducerBase()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;override&lt;/span&gt; self.Reduce (key:string) (values:seq&amp;lt;string&amp;gt;) =&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;let&lt;/span&gt; totalPages =&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values |&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.fold (&lt;span style="color: #0000ff;"&gt;fun&lt;/span&gt; pages value &lt;span style="color: #0000ff;"&gt;-&amp;gt;&lt;/span&gt; pages + Int32.Parse(value)) 0&lt;/li&gt;
&lt;li style="background: #f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Seq.singleton (key, box totalPages)&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;&lt;strong&gt;MSDN.Hadoop.Submission.Console.exe&lt;/strong&gt; -input "office/documents" -output "office/authors" &lt;br /&gt;-mapper "MSDN.Hadoop.MapReduceFSharp.OfficePageMapper, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-reducer "MSDN.Hadoop.MapReduceFSharp.OfficePageReducer, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-combiner "MSDN.Hadoop.MapReduceFSharp.OfficePageReducer, MSDN.Hadoop.MapReduceFSharp" &lt;br /&gt;-file "%HOMEPATH%\MSDN.Hadoop.MapReduceFSharp\bin\Release\MSDN.Hadoop.MapReduceFSharp.dll" &lt;br /&gt;-file "C:\Reference Assemblies\itextsharp.dll" -format Binary&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Optional Parameters&lt;/h3&gt;
&lt;p&gt;To support some additional Hadoop Streaming options a few optional parameters are supported.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;-numberReducers X&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As expected this specifies the maximum number of reducers to use.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;-debug&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The option turns on verbose mode and specifies a job configuration to keep failed task outputs.&lt;/p&gt;
&lt;p&gt;To view the the supported options one can use a &lt;span style="font-family: consolas;" face="Consolas"&gt;help&lt;/span&gt; parameters, displaying:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: consolas;" face="Consolas"&gt;Command Arguments: &lt;br /&gt;-input (Required=true) : Input Directory or Files &lt;br /&gt;-output (Required=true) : Output Directory &lt;br /&gt;-mapper (Required=true) : Mapper Class &lt;br /&gt;-reducer (Required=true) : Reducer Class &lt;br /&gt;-combiner (Required=false) : Combiner Class (Optional) &lt;br /&gt;-format (Required=false) : Input Format |Text(Default)|Binary|Xml| &lt;br /&gt;-numberReducers (Required=false) : Number of Reduce Tasks (Optional) &lt;br /&gt;-file (Required=true) : Processing Files (Must include Map and Reduce Class files) &lt;br /&gt;-nodename (Required=false) : XML Processing Nodename (Optional) &lt;br /&gt;-debug (Required=false) : Turns on Debugging Options&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;UI Submission&lt;/h3&gt;
&lt;p&gt;The provided submission framework works from a command-line. However there is nothing to stop one submitting the job using a UI; albeit a command console is opened. To this end I have put together a simple UI that supports submitting Hadoop jobs.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-76-metablogapi/0456.image_5F00_29CC240C.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-76-metablogapi/8272.image_5F00_thumb_5F00_1FB782E1.png" width="500" height="393" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This simple UI supports all the necessary options for submitting jobs.&lt;/p&gt;
&lt;h3&gt;Code Download&lt;/h3&gt;
&lt;p&gt;As mentioned the actual Executables and Source code can be downloaded from:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7" href="http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7"&gt;http://code.msdn.microsoft.com/Framework-for-Composing-af656ef7&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The source includes, not only the .Net submission framework, but also all necessary Java classes for supporting the Binary and XML job submissions. This relies on a custom Streaming JAR which should be copied to the Hadoop lib directory.&lt;/p&gt;
&lt;p&gt;To use the code one just needs to reference the EXE&amp;rsquo;s in the Release directory. This folder also contains the MSDN.Hadoop.MapReduceBase.dll that contains the abstract base class definitions.&lt;/p&gt;
&lt;h3&gt;Moving Forward&lt;/h3&gt;
&lt;p&gt;Moving forward there a few considerations for the code, that I will be looking at over time:&lt;/p&gt;
&lt;p&gt;Currently the abstract interfaces are all based on Object return types. Moving forward it would be beneficial if the types were based on Generics. This would allow a better serialization process. Currently value serialization is based on string representation of an objects value and the key is restricted to s string. Better serialization processes, such as &lt;a title="Google Protocol Buffers" href="https://developers.google.com/protocol-buffers/"&gt;Protocol Buffers&lt;/a&gt;, or .Net Serialization, would improve performance.&lt;/p&gt;
&lt;p&gt;Currently the code only supports a single key value, although the multiple keys are supported by the streaming interface. Various options are available for dealing with multiple keys which will next be on my investigation list.&lt;/p&gt;
&lt;p&gt;In a separate post I will cover what is actually happening under the covers.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10294222" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+Development/">.Net Development</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/C_2300_/">C#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IEnumerable/">IEnumerable</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop+Streaming/">Hadoop Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop/">Hadoop</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/XML+Streaming/">XML Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Binary+Streaming/">Binary Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/MapReduce/">MapReduce</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net/">.Net</category></item><item><title>Workflow Foundation (WF4) – Rehosting The Workflow Designer</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/03/26/workflow-foundation-wf4-rehosting-the-workflow-designer.aspx</link><pubDate>Mon, 26 Mar 2012 08:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10287469</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10287469</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/03/26/workflow-foundation-wf4-rehosting-the-workflow-designer.aspx#comments</comments><description>&lt;div class="ExternalClass2BF6FCCF86F84132A7BDABF33DC6ED1A"&gt;
&lt;p class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;​Rehosting the WF designer in an application outside of Visual Studio is nothing new and since WF4, nothing particularly difficult. In fact the WF product team has gone out of its way to make rehosting the designer as easy an experience as possible and they&amp;rsquo;ve done a great job. The &lt;a href="http://msdn.microsoft.com/en-us/library/dd483375.aspx"&gt;WCF and WF Samples for .NET Framework 4&lt;/a&gt; provides code samples for rehosting the designer with its corresponding toolbox and properties grid. The samples also cover handling validation errors, executing workflows and providing some level of debugging through workflow tracking &amp;ndash; most of what you need to write your own rehosted designer.&lt;/p&gt;
&lt;div class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;But to get a useable app you&amp;rsquo;re going to have to write some boiler plate code to stitch all these concepts together. You&amp;rsquo;ll need code to open, save and execute workflows. You&amp;rsquo;ll need to manage window layout, display workflow output and handle runtime exceptions. And wouldn't it be nice to support working with multiple workflows at the same time all in a windowing environment that supports docking and pinning?&lt;/div&gt;
&lt;div class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;Enter &lt;span style="font-style: italic;"&gt;Workflow Studio&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&amp;ndash; a simple, generic application that allows you to design and execute multiple XAML based workflows in a windowed environment akin with Visual Studio. Use it to design and test your workflows in environments where Visual Studio is not the right tool. You can even use it as a simple hosting environment. I&amp;rsquo;ve developed Workflow Studio as an application you can use out of the box, or you can use it as the basis for your own specialised implementation. You can download the source code &lt;a href="http://code.msdn.microsoft.com/Workflow-Studio-df1d7dc0"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;Features&lt;/h2&gt;
&lt;div class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;The following image shows the Workflow Studio environment:&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0081.Workflow20Studio_5F00_0953E693.png"&gt;&lt;img style="display: inline; background-image: none;" title="Workflow%20Studio" border="0" alt="Workflow%20Studio" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5340.Workflow20Studio_5F00_thumb_5F00_7B34F795.png" width="806" height="472" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;&lt;span&gt;Here&amp;rsquo;s a rundown of its features and where appropriate I've provided references to sample code should you want to understand more about the implementation detail.&lt;/span&gt;&lt;/p&gt;
&lt;div class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;&lt;/div&gt;
&lt;div class="ExternalClass8B937C1B6CC748D793CCF29A3D31CA37"&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Develop XAML Based Workflows And Workflow Services&lt;/strong&gt; &lt;br /&gt;Use the fully fledged WF designer to develop XAML based workflows and workflow services just as you would in Visual Studio. Interaction between the toolbox and properties box is just as in Visual Studio. For workflow services, add any WCF configuration to the Workflow Studio app config file. The solution comes with a test workflow service and client with appropriate configuration in the app config file as an example. Look at the &lt;a href="http://msdn.microsoft.com/en-us/library/dd699776.aspx"&gt;Designer Rehosting&lt;/a&gt; example in &lt;a href="http://msdn.microsoft.com/en-us/library/dd483375.aspx"&gt;WCF and WF Samples for .NET Framework 4&lt;/a&gt; that demonstrates the basis for this implementation. Also, &lt;a href="http://www.apress.com/9781430227212"&gt;Pro WF Windows Workflow in .NET 4&lt;/a&gt; by Bruce Bukovics has a great chapter on designer rehosting. Should you wish to execute other XAML based child workflows from a workflow then you can use the ExecuteXamlWorkflow custom activity I described in &lt;a href="http://blogs.msdn.com/b/mcsuksoldev/archive/2011/06/10/workflow-foundation-wf4-custom-activity-to-invoke-xaml-based-child-workflows-part-1.aspx"&gt;my previous post&lt;/a&gt;. &lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Work On More Than One Workflow At The Same Time&lt;/strong&gt; &lt;br /&gt;Workflow Studio allows you to develop multiple workflows in a single application. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Toolbox Support For All Standard WF Activities&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;All standard WF 4.0 activities are supported. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Add Custom Activities To The Toolbox&lt;/strong&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;To add custom activities to the toolbox, copy the custom activity DLL to the bin folder of Workflow Studio, select the "Add Reference &amp;hellip;" option and locate the DLL file. The custom activity will then become available in the toolbox. If your workflow references custom activities then these will be automatically loaded and added to the toolbox when the workflow is loaded providing the referenced DLL has been previously copied to the bin folder. The section on designer rehosting in &lt;a href="http://www.apress.com/9781430227212"&gt;Pro WF Windows Workflow in .NET 4&lt;/a&gt; by Bruce Bukovics, providing the details of toolbox manipulation that I used as basis for Workflow Studio.&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Execute Workflows Concurrently&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;You can execute one or more workflows or workflow services concurrently by either selecting "Start Debugging" or "Start Without Debugging" from the debug menu. Running workflows can be stopped by selecting "Abort" from the same menu. Each workflow has its own independent output window where WriteLine activity or exception stack trace output is written. You can also capture output through a trace source and associate a listener to log the output. We're using standard .NET diagnostics here, so it's totally flexible. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Show Workflow Validation Errors&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;Any validation errors detected by the designer are displayed in the error window along with error code and severity. Each workflow has its own independent window. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debug Workflows&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;This isn't fully fledged Visual Studio debugging - it's workflow tracking. You'll see the currently executing activity highlighted in the designer so you'll be able to visually track the execution path of your workflow in real time. As each activity executes the activity name, id, state and workflow instance id are written to the workflow's debug window. Clicking on a row in the debug window will focus the designer on the corresponding activity. Similar to workflow output, the debug window output is also captured through a trace source so that output can be logged. Check out &lt;a href="http://msdn.microsoft.com/en-us/library/ee624139.aspx"&gt;Visual Workflow Tracking&lt;/a&gt; in &lt;a href="http://msdn.microsoft.com/en-us/library/dd483375.aspx"&gt;WCF and WF Samples for .NET Framework 4&lt;/a&gt; which demonstrates how to implement visual tracking in the designer. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio Like Window Docking And Pinning&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;One of the key features of Workflow Studio is to offer full window docking and pinning functionality that you find in Visual Studio. This functionality is provided by the &lt;a href="http://avalondock.codeplex.com/"&gt;AvalonDock&lt;/a&gt; open source WPF docking framework. This is a great framework but took some jumping through hoops to get working. I started out wanting to make this a pure MVVM application but soon discovered this wasn't easy, if at all possible. Apparently this is addressed with the up and coming 2.0 release along with other improvements. Note that you'll need to download and install AvalonDock independently of Workflow Studio since I don't redistribute it here - don't worry this is simple. Unfortunately there's no NuGet package available as yet so please follow instructions below.&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;Other Features&lt;/h2&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;h3&gt;Persistence&lt;/h3&gt;
&lt;div&gt;&lt;span&gt;Persistence for Workflows other than workflow services is not currently supported. Workflows are hosted using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.workflowapplication.aspx"&gt;WorkflowApplication&lt;/a&gt; class and persistence makes little sense unless you can implement code that interacts with the host to load and unload instances and this is not possible with Workflow Studio currently.&lt;/span&gt;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;On the other hand, persistence for Workflow services is supported. Here, interaction with the host is not required since persistence is triggered through service interaction. Workflow services are hosted using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.workflowservicehost.aspx"&gt;WorkflowServiceHost&lt;/a&gt; class and this allows all persistence behaviour to be configured in the app config file. I used Leon Welicki's great post on &lt;a href="http://msdn.microsoft.com/en-us/magazine/ff646977.aspx"&gt;long running workflows with WCF&lt;/a&gt; to see how this would work and whether the debugging mode could help trace workflow execution. Here's how it looked:&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6724.Debugging_5F00_11A7961D.png"&gt;&lt;img style="display: inline; background-image: none;" title="Debugging" border="0" alt="Debugging" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2086.Debugging_5F00_thumb_5F00_0792F4F2.png" width="808" height="624" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;Sending the debug output to a file (see below) really comes into its own here as you can sort and filter the output in an application such as Excel to look at the execution sequence of individual workflow instances.&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;h3&gt;Localization&lt;/h3&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;Workflow studio is easily localizable. All text strings are defined in the resources.resx file that can be found in the solution properties folder. Simply translate this to your required language and rename using the naming convention for resource files. Resources are selected according to your current locale, so if you need the ability to select locales other than your current one you will need to implement this feature yourself.&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;h3&gt;Output Logging&lt;/h3&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;As mentioned previously, all workflow output and debug tracking output is captured using trace sources that can be associated with listeners that log output. Output can be captured either per workflow or collectively.&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;Here's an example from the supplied app config file:&lt;/div&gt;
&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 83.19%; height: 210px; text-align: left; line-height: 12pt; overflow: auto; font-family: 'courier new', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;" id="codeSnippetWrapper"&gt;
&lt;div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;" id="codeSnippet"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #008000;"&gt;&amp;lt;!-- for output, add new sources here where name must match workflow name without file extension, suffixed with "Output" --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt;            &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;source&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="TestLoopWithDelayOutput"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt;              &lt;span style="color: #ff0000;"&gt;switchType&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="System.Diagnostics.SourceSwitch"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt;              &lt;span style="color: #ff0000;"&gt;switchName&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="verboseSwitch"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt;                &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;listeners&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt;                    &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="testLoopWithDelayOutputListener"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt;                      &lt;span style="color: #ff0000;"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="System.Diagnostics.TextWriterTraceListener"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt;                      &lt;span style="color: #ff0000;"&gt;initializeData&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="TestLoopWithDelayOutput.log"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt;                    &lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;add&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 80.08%; height: 16px; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt;                    &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;remove&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="Default"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum11"&gt; 11:&lt;/span&gt;                &lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;listeners&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum12"&gt; 12:&lt;/span&gt;            &lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;source&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;In the above example, the workflow document tab with the name "TestLoopWithDelay.xaml" will write its output to the file TestLoopWithDelayOutput.log. The source name must match the workflow document name, excluding the extension and suffixed with &amp;ldquo;Output&amp;rdquo;.&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;Each workflow will also write its output to a single shared output file, so you don&amp;rsquo;t have to configure the above if your don&amp;rsquo;t require the output in a separate file:&lt;/div&gt;
&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 83.3%; height: 210px; text-align: left; line-height: 12pt; overflow: auto; font-family: 'courier new', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;" id="codeSnippetWrapper"&gt;
&lt;div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;" id="codeSnippet"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #008000;"&gt;&amp;lt;!-- The AllOutput source captures output for all workflows --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;source&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="AllOutput"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt;               &lt;span style="color: #ff0000;"&gt;switchType&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="System.Diagnostics.SourceSwitch"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt;               &lt;span style="color: #ff0000;"&gt;switchName&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="verboseSwitch"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;listeners&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt;                     &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="allOutputListener"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt;                       &lt;span style="color: #ff0000;"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="System.Diagnostics.TextWriterTraceListener"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt;                       &lt;span style="color: #ff0000;"&gt;initializeData&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="AllOutput.log"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt;                     &lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;add&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt;                     &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;remove&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="Default"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #606060;" id="lnum11"&gt; 11:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;listeners&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'courier new', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&lt;span style="color: #606060;" id="lnum12"&gt; 12:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;source&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;A trace source is also associated with exception handling. In the same config section you'll notice that a listener logs all exceptions to the Error.log file of the bin folder.&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;Similar to workflow output, debug tracking output is captured using trace sources and each workflow can have it&amp;rsquo;s tracking captured independently or collectively. Where specifying the trace source for debug tracking the source name must match the workflow document name, excluding the extension and suffixed with &amp;ldquo;Debug&amp;rdquo;. Collective output is written to &amp;ldquo;AllDebug.csv&amp;rdquo;. The configuration uses the &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.delimitedlisttracelistener.aspx"&gt;System.Diagnostics.DelimitedListTraceListener&lt;/a&gt; that writes output to a comma delimited file. This is ideal for loading into say Excel, where you can filter and sort to see the execution path of a specific workflow instance.&lt;/div&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;h3&gt;Controlling Debug Output&lt;/h3&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;The following settings in the Workflow Studio app config file allow you to control the tracking output behaviour: &lt;br /&gt; &lt;/div&gt;
&lt;table style="width: 100%;" border="1" cellspacing="0" cellpadding="2"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="269"&gt;&lt;strong&gt;PauseBetweenDebugStepsInMilliseconds&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="523"&gt;The number of milliseconds to pause before moving onto the next activity. This allows you to see the execution path more easily as the workflow executes in real time.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="273"&gt;&lt;strong&gt;DisableDebugViewOutput​&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="523"&gt;You may only be interested in tracking output sent to a file in which case you can disable interactive tracking by setting this value to true.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;Installing AvalonDock&lt;/h2&gt;
&lt;div class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;As previously mentioned, AvalonDock is not distributed with Workflow Studio so you need to download and install it first. This version of Workflow Studio has been developed with version 1.3.3571 of AvalonDock so please ensure you install this version. The steps are simple:&lt;/div&gt;
&lt;ol class="ms-rteThemeFontFace-1 ms-rteFontSize-1"&gt;
&lt;li style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span&gt;Download AvalonDock version 1.3.3571 from &lt;/span&gt;&lt;a href="http://avalondock.codeplex.com/releases/48794/download/131885"&gt;&lt;span&gt;http://avalondock.codeplex.com/releases/48794/download/131885&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span&gt;Run the installer. This will GAC the AvalonDock assembly.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span&gt;Build the solution. You should not need to modify any references.&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Hopefully you&amp;rsquo;ll find Workflow Studio a useful application for designing and debugging workflows in environments where Visual Studio is not a viable option. You can even use it for simple workflow hosting. It&amp;rsquo;ll save you writing a lot of boiler plate code and can serve as a starting point for your own implementation should you require something more specialized. I&amp;rsquo;d be interested to hear if you find Workflow Studio useful and welcome any feedback for possible enhancements. Also, please let me know of any bugs you may find.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Christopher+Owczarek/default.aspx"&gt;Christopher Owczarek&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10287469" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Workflow+Services/">Workflow Services</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/WF+4-0/">WF 4.0</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Christopher+Owczarek/">Christopher Owczarek</category></item><item><title>Stream join aggregates using SQL Server Stream Insight</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/03/16/stream-join-aggregates-using-sql-server-stream-insight.aspx</link><pubDate>Fri, 16 Mar 2012 12:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10284183</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10284183</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/03/16/stream-join-aggregates-using-sql-server-stream-insight.aspx#comments</comments><description>&lt;div class="ExternalClass5131E70000DF465C995472701E5D03ED"&gt;&lt;/div&gt;
&lt;p class="ExternalClass5131E70000DF465C995472701E5D03ED"&gt;Lately I have been working with StreamInsight and thought it was about time to share some of my observations and key points.&lt;/p&gt;
&lt;p class="ExternalClass5131E70000DF465C995472701E5D03ED"&gt;This is loosely based upon a requirement to aggregate Financial risk vectors and deliver changes to clients in an event based manner. When working through this I was primarily interested in the following factors:&lt;/p&gt;
&lt;div class="ExternalClass5131E70000DF465C995472701E5D03ED"&gt;
&lt;ul&gt;
&lt;li&gt;Joining the two streams in a timely manner, with the results being &amp;lsquo;lively&amp;rsquo; (that is released as quickly as possible)&lt;/li&gt;
&lt;li&gt;What sort of performance could be achieved (without much effort)&lt;/li&gt;
&lt;li&gt;How I could inject queries into the engine at runtime to enable a &amp;lsquo;service based model&amp;rsquo; for clients.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;Think of risk vectors simply as curves - a series of values plotted over a set of time points (arrays of doubles over distinct points in time). For example, look at the following 'curve' which shows the Bank Of England base rates I took at a specific point in time.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5228.image_5F00_2BD0B030.png"&gt;&lt;img style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4130.image_5F00_thumb_5F00_0A710A94.png" width="505" height="404" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Normally over time longer term rates are higher than shorter term rates.&lt;/p&gt;
&lt;p&gt;Essentially I have two streams of data which I want to correlate. One stream is of risk vector arrays - which have been calculated based upon a number of inputs upstream, usually by some form of compute grid.&lt;/p&gt;
&lt;p&gt;The second stream is the attribution of the vectors - the things we may want to analyse or aggregate by - Trade, Portfolio etc. with a join key which relates the Trade to the Risk. Once combined I multiply a nominal amount by the corresponding rate and that is my risk. The basic idea for each Trade is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Join to the array of doubles;&lt;/li&gt;
&lt;li&gt;Multiply a nominal amount by each double;&lt;/li&gt;
&lt;li&gt;Dequeue the result&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is summarized in the below diagram.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1425.image_5F00_07E7D8D6.png"&gt;&lt;img style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1184.image_5F00_thumb_5F00_0AAD8DC9.png" width="658" height="233" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The data sources are as shown below.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;strong&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5282.image_5F00_44BC5AA8.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6011.image_5F00_thumb_5F00_61099CC8.png" width="530" height="351" /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5417.image_5F00_3C18AFC4.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5482.image_5F00_thumb_5F00_40AEBA7E.png" width="214" height="293" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;strong&gt;Basic Plumbing&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The first thing to do is to build out the 'infrastructure' using the StreamInsight programming model.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This means creating my adapters (Risk, Trade and Output). I won't describe the details of the programming model. You can review the code sample and the Stream Insight documentation for this. However, for this scenario there a couple of key points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Both Trade and Risk must be either Interval or Edge event types. This is because I am joining streams across time and the cardinality of the relationship is many to many. A vector will apply to many Trades, and a Trade can apply to many vectors. A join on two point events would not support this (once the Point event is released it is gone).&lt;/li&gt;
&lt;li&gt;For aggregate queries I want to release the events whenever there is an update (new source event which contributes to it). This means using the SnapshotWindow &amp;ndash; using Hopping or Tumbling will not support this.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;strong&gt;Joining Streams&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It is worth briefly describing the management of application time. This is a fundamental concept to understand in Stream Insight. Common Time Increments (CTI) events are used as a basis for advancing application time. The CTI is effectively an assertion that there will be no more events beyond this time - and this tells the engine that it is ok to dequeue events. For example if I enqueue 3 events with times of T1, T2 and T3 (assuming Point events) and enqueue them to the engine, they will be dequeued when I assert a CTI of T4.&lt;/p&gt;
&lt;p&gt;There are a few ways of managing application time in Stream Insight:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Declaratively - using AdvancedTimeSettings&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Using a heartbeat mechanism - such as a timer&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Declaratively using an AdvancedTimeImport&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When joining streams what is important to realize is that a &amp;lsquo;join event&amp;rsquo; is only released to the output after a CTI has been inserted into each of the source streams.&lt;/p&gt;
&lt;p&gt;In my example I used the following input files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Trades &amp;ndash; 5000 trades, each with a join to a single array&lt;/li&gt;
&lt;li&gt;Risk &amp;ndash; 40 vectors, each an array of 20 values&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This means that we will produce 100,000 events (5000 x 20).&lt;/p&gt;
&lt;p&gt;Firstly, I looked at using &lt;strong&gt;AdvancedTimeSettings&lt;/strong&gt;, defining the same time policy for each stream. The problem here is that - unless your streams have the same number of events which are enqueued with the same occurrence of CTIs (very unlikely!) - at a certain point in time the slower stream will enqueue all of its events. As mentioned above, this means that there are no more events to enqueue and, as we are using declarative approach to time management, there will be no further CTIs produced. So we could enqueue all of the Risk, more Trades could arrive which have a matching join already enqueued, but they will not be released &amp;ndash; because there is no CTI inserted to the Risk stream.&lt;/p&gt;
&lt;p&gt;The second option is to manage things manually using a &amp;lsquo;heartbeat&amp;rsquo; CTI injection approach &amp;ndash; essentially each adapter injecting CTIs using a Timer. This is an approach which does work but you have to be careful to make sure your streams are in sync and you do not end up with CTI violations &amp;ndash; whereby you try to insert a CTI with a timestamp greater than an already enqueued event. I took a simple approach with a singleton to hold state which both streams would call a method of to advance time.&lt;/p&gt;
&lt;p&gt;The third option is to use &lt;strong&gt;AdvancedTimeImport&lt;/strong&gt;. This allows us to synchronize two streams &amp;ndash; the &amp;lsquo;slower&amp;rsquo; stream importing CTIs from the &amp;lsquo;faster&amp;rsquo; stream. An example is shown below.&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c865deca-ddc7-4e4f-80a5-bf20f2e2b49b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 400px; overflow: auto;"&gt;&lt;ol style="background: #c0c0c0; margin: 0; padding: 0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;#region&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; Time Settings&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; atgs = &lt;/span&gt;&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AdvanceTimeGenerationSettings&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;(1, &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;.FromTicks(1),&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; ats = &lt;/span&gt;&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AdvanceTimeSettings&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;(atgs, &lt;/span&gt;&lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;, &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AdvanceTimePolicy&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;.Adjust);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #008000;"&gt;//These settings will import CTIs from the Risk Stream&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; timeImportSettings = &lt;/span&gt;&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AdvanceTimeSettings&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;, &lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AdvanceTimeImportSettings&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;(&lt;/span&gt;&lt;span style="color: #a31515;"&gt;"TradeStream"&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;), &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AdvanceTimePolicy&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;.Adjust);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;#endregion&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;#region&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; Streams&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #008000;"&gt;//Create the inputstreams&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; tStream = &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;CepStream&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Trade&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;&amp;gt;.Create(&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;"TradeStream"&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;typeof&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;(&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;TradeAdapteFactory&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;),&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;tconfig,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;EventShape&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;.Interval&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;,ats&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #008000;"&gt;//Import timeimport from trade&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt;&lt;span style="color: #ffffff;"&gt; rStream = &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;CepStream&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Risk&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;&amp;gt;.Create(&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;"RiskStream"&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;typeof&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;(&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;RiskAdapteFactory&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;),&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;rconfig,&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;EventShape&lt;/span&gt;&lt;span style="color: #ffffff;"&gt;.Interval&lt;/span&gt;&lt;span style="color: #008000;"&gt;//,timeImportSettings&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;,timeImportSettings&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #ffffff;"&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;#endregion&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In my example there is a subtlety here &amp;ndash; which stream is the &amp;lsquo;slow&amp;rsquo; one? From a logical perspective I should expect Trade events to arrive before Risk (Risk events are produced elsewhere using Trade as an input). If I consider the cardinality and volume of my data I have 5000 Trades and 800 Risk points. This means that Trade is the fast stream because I will have finished enqueuing Risk before I have finished enqueing all my Trade events. Thus, I generate CTIs in the Risk stream for any new Trades imported, thereby releasing any &amp;lsquo;join events&amp;rsquo;. Whereas this is fine, and works completely as expected, it forced me to think about the timeliness of the arrival of data in the source streams in real life. The two streams are from different sources and completely independent. Event though Trade is the &amp;lsquo;fast&amp;rsquo; stream here what happens if there is a gap in the enqueuing of Trades, perhaps due to a system failure? I may get new Risk events arrive which have an existing Trade match but the join events will not be released. If this is not desirable, and you do not want gaps/delays in the fast stream causing delays on valid events being released then a manual approach to time management is probably preferable.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2656.image_5F00_24BD8586.png"&gt;&lt;img style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1680.image_5F00_thumb_5F00_1BED7D3A.png" width="699" height="353" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;strong&gt;Performance (and &amp;lsquo;null&amp;rsquo; adapters)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;One of my goals was to see what sort of &amp;lsquo;raw&amp;rsquo; performance I could get with StreamInsight. As I was interested in the raw performance of the engine rather than how well (or badly) I could write input and output adapters I used simple csv source files and accessed them using a StreamReader. For the output adapter I came up with the idea of a &amp;lsquo;NULL adapter&amp;rsquo; whereby I dequeue events but then do not do anything further with them (outputting them to console for example, which is what I started with, is just far too slow). I could use the Event Flow Debugger and &lt;strong&gt;server.GetDiagnosticView &lt;/strong&gt;to validate that all of the events had been enqueued and released.&lt;/p&gt;
&lt;p&gt;So with two StreamReader Input Adapters, and one &amp;lsquo;Null Adapter&amp;rsquo; what sort of performance could I get on my laptop?&lt;/p&gt;
&lt;p&gt;Without much (ok, any!) effort I was able to process and release all events within 2.5 seconds. That is 40,000 a second or, from a &amp;lsquo;released vectors&amp;rsquo; perspective, 2000! This was way in excess of my expected target (400). This hardly represents a soak test with a steady state but there is an important point I took away from this. The StreamInsight engine is &lt;strong&gt;&lt;em&gt;&lt;span style="font-size: xx-small;" size="1"&gt;very&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt; performant &amp;ndash; it is up to you as the adapter writer to try to keep up! I think the &amp;lsquo;null adapter&amp;rsquo; approach is a useful way to benchmark the kind of output performance you should be trying to get near too. The reality will always be at least a little slower depending on your event sink (Database, Service, Client etc.).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;strong&gt;Injecting Queries&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;StreamInsight has LINQ support for writing queries.&lt;/p&gt;
&lt;p&gt;An aggregate query based upon my join query is shown below. As noted above, it must use SnapshotWindow in order to produce the &amp;lsquo;event based result&amp;rsquo; I needed.&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:12409729-abe5-46f2-a9c7-5677a695543d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 400px; overflow: auto;"&gt;&lt;ol style="background: #c0c0c0; margin: 0; padding: 0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color: #008000;"&gt;//SUM by CounterParty over a snapshot to get some aggregates&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; CPartyQuery = &lt;span style="color: #0000ff;"&gt;from&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; joinedrisk&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;group&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;by&lt;/span&gt; c.CounterParty &lt;span style="color: #0000ff;"&gt;into&lt;/span&gt; CpGroup&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;from&lt;/span&gt; window &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; CpGroup.SnapshotWindow(&lt;span style="color: #2b91af;"&gt;SnapshotWindowOutputPolicy&lt;/span&gt;.Clip)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;select&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; { Sum = window.Sum(e =&amp;gt; e.Amount), CounterParty=CpGroup.Key };&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is great, but it quickly led me to think about how can you bind queries to the engine &amp;ndash; to support a scenario of having CEP &amp;lsquo;as a service&amp;rsquo; which clients can bind to, for example. After some poking around there is some support for this. There is a property of a QueryTemplate (Definition) which returns an XML definition of the query. An example query is shown below.&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b53d91ce-0301-493f-8ad3-7a8acb429f49" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #ddd; max-height: 400px; overflow: auto;"&gt;&lt;ol style="background: #c0c0c0; margin: 0 0 0 2.5em; padding: 0 0 0 5px;" start="1"&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;QueryTemplate&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;cep:/Server/Application/RiskAggregateService/QueryTemplate/filterLogic&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Description&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;filtered&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;http://schemas.microsoft.com/ComplexEventProcessing/2010/01/Metadata&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;- &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Import&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;filterInput&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Type&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;cep:/Server/Application/RiskAggregateService/EventType/RealTimeRiskCEPApplication.Events.Risk%2C%20RealTimeRiskCEPApplication%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;OutputStream&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;Import.2.0&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Import&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;- &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Export&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;OutputAdapter&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;InputStream&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;Select.1.1&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Export&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;- &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Select&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;Select.1.1&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;InputStream&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;Import.2.0&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;OutputStream&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;Select.1.1&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;FilterExpression&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Equal&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;InputField&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;RiskId&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;StreamName&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;Import.2.0&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Constant&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Type&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;System.Int32&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Nullable&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; &lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;=&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt;1&lt;/span&gt;"&lt;span style="color: #0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Equal&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;FilterExpression&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Select&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;QueryTemplate&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Once you have this, you can bind queries from XML, as per the below.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:061eb9ec-c3de-4367-9a42-c44036146f5b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: #fff; max-height: 400px; overflow: auto;"&gt;&lt;ol style="background: #c0c0c0; margin: 0; padding: 0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color: #008000;"&gt;//Create the query template, and bind it&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; dummyTemplate1 = application.CreateQueryTemplate(&lt;span style="color: #a31515;"&gt;"dummyTemplate1"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"Description..."&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;CepStream&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TradeDetail&lt;/span&gt;&amp;gt;.Create(&lt;span style="color: #a31515;"&gt;"input1"&lt;/span&gt;));&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; dummyTemplate2 = application.CreateQueryTemplate(&lt;span style="color: #a31515;"&gt;"dummyTemplate2"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"Description..."&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;CepStream&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Risk&lt;/span&gt;&amp;gt;.Create(&lt;span style="color: #a31515;"&gt;"input2"&lt;/span&gt;));&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #2b91af;"&gt;XmlReader&lt;/span&gt; riskFilter = &lt;span style="color: #2b91af;"&gt;XmlReader&lt;/span&gt;.Create(fileDir + &lt;span style="color: #a31515;"&gt;"RealTimeRiskCEPApplication\\RiskJoin.xml"&lt;/span&gt;);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #2b91af;"&gt;QueryTemplate&lt;/span&gt; filterQT = application.CreateQueryTemplate(riskFilter);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #2b91af;"&gt;QueryBinder&lt;/span&gt; queryBinder = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;QueryBinder&lt;/span&gt;(filterQT);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #008000;"&gt;//Bind to the input adapters&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;queryBinder.BindProducer&amp;lt;&lt;span style="color: #2b91af;"&gt;Risk&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515;"&gt;"RiskStream"&lt;/span&gt;, RiskInputAdapter, rconfig, &lt;span style="color: #2b91af;"&gt;EventShape&lt;/span&gt;.Interval, timeImportSettings);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;queryBinder.BindProducer&amp;lt;&lt;span style="color: #2b91af;"&gt;TradeDetail&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515;"&gt;"TradeStream"&lt;/span&gt;, TradeInputAdapter, tconfig, &lt;span style="color: #2b91af;"&gt;EventShape&lt;/span&gt;.Interval);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&lt;span style="color: #008000;"&gt;//Bind to the output&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;queryBinder.AddConsumer(&lt;span style="color: #a31515;"&gt;"ConsoleOutput"&lt;/span&gt;, ConsoleOutAdapter, conbaseriskconfig, &lt;span style="color: #2b91af;"&gt;EventShape&lt;/span&gt;.Point, &lt;span style="color: #2b91af;"&gt;StreamEventOrder&lt;/span&gt;.FullyOrdered);&lt;/li&gt;
&lt;li style="background: #b4b4b4;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: #2b91af;"&gt;Query&lt;/span&gt; basequery = application.CreateQuery(&lt;span style="color: #a31515;"&gt;"BaseRisk"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"Base risk join query"&lt;/span&gt;, queryBinder);&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One wrinkle I found is that you have to have a couple of dummy query templates with the same event type as you use in BindProducer. Otherwise it does not work.&lt;/p&gt;
&lt;p&gt;It is also worth noting that there are some limitations to this query binding technique &amp;ndash; lambda expressions in the query being a notable one. It is also worth noting that none of this (including the XML structure for queries) was documented, even through it is in the API.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;strong&gt;In Summary&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In summary, SQL Server StreamInsight is a highly performant CEP engine. The adapter model is relatively straightforward. Generally speaking the engine will be as performant as the adapters you write for it - The &amp;lsquo;null adapter&amp;rsquo; approach is worth considering just to get a baseline on the hardware you are running. The semantics of time, and understanding the affects of CTI injection on result liveliness are probably the most important concepts to get to grips with. And I found the Event Flow Debugger essential in understanding what was going on in the engine when results were not as I was expecting.&lt;/p&gt;
&lt;p&gt;It is possible to inject queries at runtime, though this was not that obvious. Nonetheless the support is there for developing a service layer which allows clients bind the queries which there are interested in. The results to these could then be published using a message based technology to clients.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Terry+Room/default.aspx"&gt;Terry Room&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10284183" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+Development/">.Net Development</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/-Net+4-0/">.Net 4.0</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/C_2300_/">C#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+Server+2008+R2/">SQL Server 2008 R2</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+StreamInsight/">SQL StreamInsight</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Terry+Room/">Terry Room</category></item><item><title>Hadoop Binary Streaming and F# MapReduce</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/01/08/hadoop-binary-streaming-and-f-mapreduce.aspx</link><pubDate>Sun, 08 Jan 2012 10:38:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10254343</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10254343</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2012/01/08/hadoop-binary-streaming-and-f-mapreduce.aspx#comments</comments><description>&lt;p&gt;As mentioned in my previous &lt;a title="Hadoop Streaming and F# MapReduce" href="http://blogs.msdn.com/b/carlnol/archive/2011/12/16/hadoop-streaming-and-f-mapreduce.aspx"&gt;post&lt;/a&gt; Hadoop Streaming not only supports text streaming, but it also supports Binary Streaming. As such I wanted to put together a sample that supports processing Office documents. As before the code can be downloaded from:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850" href="http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850"&gt;http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Putting together this sample involved a bit more work than the text streaming case as one needed to put together an implementation of the Java classes to support binary streaming; namely FileInputFormat and RecordReader. The purpose of these implementations is to support Binary Streaming of the document such that it is not split on the usual line boundaries. More on the Java code later.&lt;/p&gt;  &lt;p&gt;The implemented Java classes are written, with a key value type pairing of &amp;lt;Text, BytesWritable&amp;gt;, which writes out the data for the mapper in the following format:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Filename &lt;/li&gt;    &lt;li&gt;Tab character &lt;/li&gt;    &lt;li&gt;UTF8 Encoded Document &lt;/li&gt;    &lt;li&gt;Linefeed character &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The Mapper code will get called with this format for each document in the specified input directories.&lt;/p&gt;  &lt;h3&gt;Map and Reduce Classes&lt;/h3&gt;  &lt;p&gt;The goal of the sample code is to support a Map and Reduce with the following prototypes:&lt;/p&gt;  &lt;pre&gt;Map : WordprocessingDocument –&amp;gt; seq&amp;lt;string * obj&amp;gt;&lt;/pre&gt;

&lt;pre&gt;Reduce : string -&amp;gt; seq&amp;lt;string&amp;gt; -&amp;gt; obj option&lt;/pre&gt;

&lt;p&gt;The idea is the Mapper takes in a Word document and projects this into a sequence of keys and values. The Reducer, as in the text streaming case, takes in a key value pair and returns an optional reduced value.&lt;/p&gt;

&lt;p&gt;The use of the obj type is, as in the text streaming case, to support serializing the output values.&lt;/p&gt;

&lt;p&gt;As an example, I have put together a MapReduce to process Word documents, where the word document is mapped into the number of pages per author and where multiple authors are credited with the same number of pages.&lt;/p&gt;

&lt;p&gt;The sample Mapper code is as follows:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:444bb839-8feb-40ee-96b3-1aa254a2f681" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; OfficeWordPageMapper =&lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; dc = XNamespace.Get(&lt;span style="color:#800000"&gt;&amp;quot;http://purl.org/dc/elements/1.1/&amp;quot;&lt;/span&gt;)&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; cp = XNamespace.Get(&lt;span style="color:#800000"&gt;&amp;quot;http://schemas.openxmlformats.org/package/2006/metadata/core-properties&amp;quot;&lt;/span&gt;)&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; unknownAuthor = &lt;span style="color:#800000"&gt;&amp;quot;unknown author&amp;quot;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getAuthors (document:WordprocessingDocument) =&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; coreFilePropertiesXDoc = XElement.Load(document.CoreFilePropertiesPart.GetStream()); &lt;br&gt;
          &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Take the first dc:creator element and split based on a &amp;quot;;&amp;quot;&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; creators = coreFilePropertiesXDoc.Elements(dc + &lt;span style="color:#800000"&gt;&amp;quot;creator&amp;quot;&lt;/span&gt;)&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; Seq.isEmpty creators &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
            [| unknownAuthor |]&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; creator = (Seq.head creators).Value&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.IsNullOrWhiteSpace(creator) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                [| unknownAuthor |]&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                creator.Split(&lt;span style="color:#800000"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;)&lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getPages (document:WordprocessingDocument) =&lt;br&gt;
        &lt;span style="color:#008000"&gt;// return page count&lt;/span&gt;&lt;br&gt;
        Int32.Parse(document.ExtendedFilePropertiesPart.Properties.Pages.Text)&lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#008000"&gt;// Map the data from input name/value to output name/value&lt;/span&gt;&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Map (document:WordprocessingDocument) =&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; pages = getPages document&lt;br&gt;
        (getAuthors document)&lt;br&gt;
        |&amp;gt; Seq.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; author &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; (author, pages))&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;As you can see the majority code is needed to pull out the document properties. If one wanted to process the words within the document one would use the following code:&lt;/p&gt;

&lt;pre&gt;document.MainDocumentPart.Document.Body.InnerText&lt;/pre&gt;

&lt;p&gt;To run this code it is worth noting there is a dependency on installing the &lt;a title="Open XML SDK 2.0 for Microsoft Office" href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=5124" target="_blank"&gt;Open XML SDK 2.0 for Microsoft Office&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally, the Reducer code is as follows:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f5bc55e7-620e-4aa0-aeaf-6170bcad1a91" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; OfficePageReducer = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Reduce (key:string) (values:seq&amp;lt;string&amp;gt;) =&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; totalPages =&lt;br&gt;
            values |&amp;gt; &lt;br&gt;
            Seq.fold (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; pages value &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; pages + Int32.Parse(value)) 0&lt;br&gt;
&lt;br&gt;
        Some(totalPages)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Again, as in the text streaming application, both the mapper and the reducer are executables that read the input from StdIn and emit the output to StdOut. In the case of the mapper the console application will need to do multiple Console.ReadByte() calls to get the data, and then perform a Console.WriteLine() to emit the output. The reducer will do a Console.ReadLine() to get the data, and perform a Console.WriteLine() to emit the output.&lt;/p&gt;

&lt;p&gt;The previous post covers the schematics of creating console applications for F#; so I will not cover this again but assume the same program structure.&lt;/p&gt;

&lt;h3&gt;Mapper Executable&lt;/h3&gt;

&lt;p&gt;As previously mentioned the purpose of the Mapper code is to perform Input Format Parsing, Projection, and Filtering. In the Mapper for a Word document the bytes are used to create a WordprocessingDocument, with invalid documents ignored, these are then projected into a key/value sequence using the Map function:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ab15f38f-24b4-4b75-9109-36b35821f401" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Controller = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run (args:string array) =    &lt;br&gt;
    &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Define what arguments are expected&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; defs = [&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Input File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Output File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; } ]&lt;br&gt;
 &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse Arguments into a Dictionary&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = Arguments.ParseArgs args defs        &lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Ensure Standard Input/Output and allow for debug configuration&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; builder = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StringBuilder()&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; encoder = Text.UTF8Encoding()&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reader = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                builder.Append(Path.GetFileName(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;])) |&amp;gt; ignore&lt;br&gt;
                File.Open(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;]), FileMode.Open) :&amp;gt; Stream&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; stream = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; MemoryStream()&lt;br&gt;
&lt;br&gt;
                &lt;span style="color:#008000"&gt;// Ignore bytes until one hits a tab&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; readTab() = &lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; inByte = Console.OpenStandardInput().ReadByte()&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; inByte &amp;lt;&amp;gt; 0x09 &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;                        &lt;br&gt;
                        builder.Append(encoder.GetString([| (byte)inByte |])) |&amp;gt; ignore&lt;br&gt;
                        readTab()&lt;br&gt;
                readTab()&lt;br&gt;
&lt;br&gt;
                &lt;span style="color:#008000"&gt;// Copy the rest of the stream and truncate the last linefeed char&lt;/span&gt;&lt;br&gt;
                Console.OpenStandardInput().CopyTo(stream)&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (stream.Length &amp;gt; 0L) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    stream.SetLength(stream.Length - 1L)&lt;br&gt;
                stream.Position &amp;lt;- 0L&lt;br&gt;
&lt;br&gt;
                stream :&amp;gt; Stream&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; writer =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Console.OpenStandardOutput(), AutoFlush = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;)&lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; filename = builder.ToString()&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Combine the name/value output into a string&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; outputCollector (outputKey, outputValue) =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; output = sprintf &lt;span style="color:#800000"&gt;&amp;quot;%s&amp;#92;t%O&amp;quot;&lt;/span&gt; outputKey outputValue&lt;br&gt;
            writer.WriteLine(output)&lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Check we do not have a null document&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (reader.Length &amp;gt; 0L) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;try&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#008000"&gt;// Get access to the word processing document from the input stream&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; document = WordprocessingDocument.Open(reader, &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;)&lt;br&gt;
&lt;br&gt;
                &lt;span style="color:#008000"&gt;// Process the word document with the mapper&lt;/span&gt;&lt;br&gt;
                OfficeWordPageMapper.Map document&lt;br&gt;
                |&amp;gt; Seq.iter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; value &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; outputCollector value)&lt;br&gt;
        &lt;br&gt;
                &lt;span style="color:#008000"&gt;// close document&lt;/span&gt;&lt;br&gt;
                document.Close()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;
            | :? System.IO.FileFormatException &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#008000"&gt;// Ignore invalid files formats&lt;/span&gt;&lt;br&gt;
                ()&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Close the streams&lt;/span&gt;&lt;br&gt;
        reader.Close()&lt;br&gt;
        writer.Close()&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;There are a few things of note in the code.&lt;/p&gt;

&lt;p&gt;When pulling out the filename of the document that is being processed, it is assumed that UTF8 encoding has been used and that a Tab character is used as a delimiter between the filename and the documents bytes.&lt;/p&gt;

&lt;p&gt;In building the Stream that is to be used for creating the WordprocessingDocument a MemoryStream is used. There are several reasons for this. Firstly one needs to remove the last Newline character from the Stream, and secondly when creating a WordprocessingDocument a Stream is needed that supports Seek operations; unfortunately this is not the case for StdIn.&lt;/p&gt;

&lt;p&gt;At the moment the code does not use the Filename. However in future posts I will extend the code to also support processing PDF documents.&lt;/p&gt;

&lt;h3&gt;Reducer Executable&lt;/h3&gt;

&lt;p&gt;After running the Mapper, the data being parsed into the Reducer will be a key/value pair delimited with a Tab. Using the above Map, a sample input dataset for the Reducer would be:&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: consolas; font-size: x-small" face="Consolas" size="2"&gt;&lt;span style="font-size: x-small" size="2"&gt;&lt;font size="2"&gt;Brad Sarsfield&amp;#160;&amp;#160;&amp;#160; 44 
        &lt;br /&gt;Carl Nolan&amp;#160;&amp;#160;&amp;#160; 1&amp;#160; &lt;br /&gt;Marie West&amp;#160;&amp;#160;&amp;#160; 1 

        &lt;br /&gt;Carl Nolan 9&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Thus in this case, the code for the Reducer will be the same as in the text streaming case:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:efbcd13c-faad-4cc1-bafc-ad4bc85878dd" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Controller = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run (args:string array) = &lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Define what arguments are expected&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; defs = [&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Input File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Output File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; } ]&lt;br&gt;
 &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse Arguments into a Dictionary&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = Arguments.ParseArgs args defs&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Ensure Standard Input/Output and allow for debug configuration&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reader = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(Console.OpenStandardInput())&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; writer =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Console.OpenStandardOutput(), AutoFlush = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;)&lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Combine the name/value output into a string&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; outputCollector outputKey outputValue =            &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; output = sprintf &lt;span style="color:#800000"&gt;&amp;quot;%s&amp;#92;t%O&amp;quot;&lt;/span&gt; outputKey outputValue&lt;br&gt;
            writer.WriteLine(output)&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Read the next line of the input stream&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; readLine() = &lt;br&gt;
            reader.ReadLine()&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse the input into the required name/value pair&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parseLine (input:string) = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; keyValue = input.Split(&lt;span style="color:#800000"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;)&lt;br&gt;
            (keyValue.[0].Trim(), keyValue.[1].Trim())&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Converts a input line into an option&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getInput() = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; input = readLine()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not(String.IsNullOrWhiteSpace(input)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                Some(parseLine input)&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                None&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Creates a sequence of the input based on the provided key&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; lastInput = ref None&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; continueDo = ref &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; inputsByKey key firstValue = seq {&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Yield any value from previous read&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; firstValue&lt;br&gt;
&lt;br&gt;
            continueDo := &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;while&lt;/span&gt; !continueDo &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; getInput() &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;
                | Some(input) &lt;span style="color:#0000ff"&gt;when&lt;/span&gt; (fst input) = key &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#008000"&gt;// Yield found value and remainder of sequence&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; (snd input)                    &lt;br&gt;
                | Some(input) &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#008000"&gt;// Have a value but different key&lt;/span&gt;&lt;br&gt;
                    lastInput := Some(fst input, snd input)&lt;br&gt;
                    continueDo := &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
                | None &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#008000"&gt;// Have no more entries&lt;/span&gt;&lt;br&gt;
                    lastInput := None&lt;br&gt;
                    continueDo := &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
        }&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Controls the calling of the reducer&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; processInput (input:(string*string) option) =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; input.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; key = fst input.Value&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; value = OfficePageReducer.Reduce key (inputsByKey key (snd input.Value))&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; value.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    outputCollector key value.Value&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; lastInput.contents.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    processInput lastInput.contents&lt;br&gt;
&lt;br&gt;
        processInput (getInput())&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Once run, the reduced output would be:&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: consolas; font-size: x-small" face="Consolas" size="2"&gt;&lt;span style="font-size: x-small" size="2"&gt;&lt;font size="2"&gt;Brad Sarsfield&amp;#160;&amp;#160;&amp;#160; 44 
        &lt;br /&gt;Carl Nolan&amp;#160;&amp;#160;&amp;#160; 10 

        &lt;br /&gt;Marie West&amp;#160;&amp;#160;&amp;#160; 1&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Once again the only complexity in the code is the fact the Seq.groupBy function cannot be used. Also, as in the text streaming case there is a fair amount of code controlling the input and output streams for calling the Map and Reduce functions, that can be reused for all Hadoop Binary Streaming jobs.&lt;/p&gt;

&lt;h3&gt;Running the Executables&lt;/h3&gt;

&lt;p&gt;In the case of Binary Streaming the command parameters are a little different to the text streaming case:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e66b9812-8ff0-4123-9c40-5dbe9491225a" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;C:&amp;#92;Apps&amp;#92;dist&amp;#92;hadoop.cmd jar lib/hadoop-streaming-ms.jar&lt;br&gt;
 -input &amp;quot;/office/documents&amp;quot; &lt;br&gt;
 -output &amp;quot;/office/authors&amp;quot; &lt;br&gt;
 -mapper &amp;quot;..&amp;#92;..&amp;#92;jars&amp;#92;FSharp.Hadoop.MapperOffice.exe&amp;quot; &lt;br&gt;
 -combiner &amp;quot;..&amp;#92;..&amp;#92;jars&amp;#92;FSharp.Hadoop.ReducerOffice.exe&amp;quot; &lt;br&gt;
 -reducer &amp;quot;..&amp;#92;..&amp;#92;jars&amp;#92;FSharp.Hadoop.ReducerOffice.exe&amp;quot; &lt;br&gt;
 -file &amp;quot;C:&amp;#92;Users&amp;#92;carlnol&amp;#92;Projects&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.MapperOffice&amp;#92;bin&amp;#92;Release&amp;#92;FSharp.Hadoop.MapperOffice.exe&amp;quot; &lt;br&gt;
 -file &amp;quot;C:&amp;#92;Users&amp;#92;carlnol&amp;#92;Projects&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.ReducerOffice&amp;#92;bin&amp;#92;Release&amp;#92;FSharp.Hadoop.ReducerOffice.exe&amp;quot; &lt;br&gt;
 -file &amp;quot;C:&amp;#92;Users&amp;#92;carlnol&amp;#92;Projects&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;bin&amp;#92;Release&amp;#92;FSharp.Hadoop.MapReduce.dll&amp;quot; &lt;br&gt;
 -file &amp;quot;C:&amp;#92;Users&amp;#92;carlnol&amp;#92;Projects&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.Utilities&amp;#92;bin&amp;#92;Release&amp;#92;FSharp.Hadoop.Utilities.dll&amp;quot; &lt;br&gt;
 -inputformat com.microsoft.hadoop.mapreduce.lib.input.BinaryDocumentWithNameInputFormat&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The first difference is the use of the hadoop-streaming-ms.jar. This file contains the InputFormat class specified by the inputformat parameter; the later Java Classes section discusses how this is created. This is needed to support Binary Streaming.&lt;/p&gt;

&lt;p&gt;One other difference to my previous text streaming case is the use of the Reducer class as a Combiner. As the output types from the mapper are the same as the reducer then this is possible.&lt;/p&gt;

&lt;h3&gt;Tester Application&lt;/h3&gt;

&lt;p&gt;For completeness I have included the base code for the tester application; albeit the full code is included in the download. The code is very similar to the tester application mentioned in my previous &lt;a title="MapReduce Tester: A Quick Word" href="http://blogs.msdn.com/b/carlnol/archive/2011/12/29/mapreduce-tester-a-quick-word.aspx"&gt;post&lt;/a&gt;, with the exception of how the mapper executable is called:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:95aafba4-2b4c-4c30-b28f-3f655e8f3746" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; MapReduceConsole =&lt;br&gt;
        &lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run args =&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Define what arguments are expected&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; defs = [            &lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Input File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;true&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Output File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;true&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;tempPath&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Temp File Path&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;true&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;mapper&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Mapper EXE&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;true&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;reducer&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Reducer EXE&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;true&lt;/span&gt; }; ]&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse Arguments into a Dictionary&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = Arguments.ParseArgs args defs&lt;br&gt;
        Arguments.DisplayArgs parsedArgs&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// define the executables&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; mapperExe = Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;mapper&amp;quot;&lt;/span&gt;])&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; reducerExe = Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;reducer&amp;quot;&lt;/span&gt;])&lt;br&gt;
&lt;br&gt;
        Console.WriteLine()&lt;br&gt;
        Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;The Mapper file is:&amp;#92;t%O&amp;quot;&lt;/span&gt; mapperExe)&lt;br&gt;
        Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;The Reducer file is:&amp;#92;t%O&amp;quot;&lt;/span&gt; reducerExe)&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Get the file names&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; inputpath = Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;])&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; outputfile = Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;])&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; tempPath = Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;tempPath&amp;quot;&lt;/span&gt;])&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; tempFile = Path.Combine(tempPath, Path.GetFileName(outputfile))&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; mappedfile = Path.ChangeExtension(tempFile, &lt;span style="color:#800000"&gt;&amp;quot;mapped&amp;quot;&lt;/span&gt;)&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; reducefile = Path.ChangeExtension(tempFile, &lt;span style="color:#800000"&gt;&amp;quot;reduced&amp;quot;&lt;/span&gt;)&lt;br&gt;
&lt;br&gt;
        Console.WriteLine()&lt;br&gt;
        Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;The input path is:&amp;#92;t&amp;#92;t%O&amp;quot;&lt;/span&gt; inputpath)&lt;br&gt;
        Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;The mapped temp file is:&amp;#92;t%O&amp;quot;&lt;/span&gt; mappedfile)&lt;br&gt;
        Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;The reduced temp file is:&amp;#92;t%O&amp;quot;&lt;/span&gt; reducefile)&lt;br&gt;
        Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;The output file is:&amp;#92;t&amp;#92;t%O&amp;quot;&lt;/span&gt; outputfile)&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Give the user an option to continue&lt;/span&gt;&lt;br&gt;
        Console.WriteLine()&lt;br&gt;
        Console.WriteLine(&lt;span style="color:#800000"&gt;&amp;quot;Hit ENTER to continue...&amp;quot;&lt;/span&gt;)&lt;br&gt;
        Console.ReadLine() |&amp;gt; ignore&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; CHUNK = 1024&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; buffer:byte array = Array.zeroCreate CHUNK&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Call the mapper with the input file&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; mapperProcessLoop inputfile =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapper = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Process()&lt;br&gt;
            mapper.StartInfo.FileName &amp;lt;- mapperExe&lt;br&gt;
            mapper.StartInfo.UseShellExecute &amp;lt;- &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
            mapper.StartInfo.RedirectStandardInput &amp;lt;- &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
            mapper.StartInfo.RedirectStandardOutput &amp;lt;- &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
            mapper.Start() |&amp;gt; ignore&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapperInput = mapper.StandardInput.BaseStream&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapperOutput = mapper.StandardOutput &lt;br&gt;
        &lt;br&gt;
            &lt;span style="color:#008000"&gt;// Map the reader to a background thread so processing can happen in parallel&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; taskMapperFunc() = &lt;br&gt;
                &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapperWriter = File.AppendText(mappedfile)&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;while&lt;/span&gt; not mapperOutput.EndOfStream &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;
                    mapperWriter.WriteLine(mapperOutput.ReadLine())&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; taskMapperWriting = Task.Factory.StartNew(Action(taskMapperFunc)) &lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Pass the file into the mapper process and close input stream when done          &lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapperReader = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; BinaryReader(File.OpenRead(inputfile))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; readLoop() = &lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; bytesread = mapperReader.Read(buffer, 0, CHUNK)&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; bytesread &amp;gt; 0 &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    mapperInput.Write(buffer, 0, bytesread)&lt;br&gt;
                    readLoop()&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Write out a Filename/Tab/Document/LineFeed&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; filename = Path.GetFileName(inputfile)&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; encoding = Text.UTF8Encoding();&lt;br&gt;
            mapperInput.Write(encoding.GetBytes(filename), 0, encoding.GetByteCount(filename))&lt;br&gt;
            mapperInput.Write([| 0x09uy |], 0, 1)&lt;br&gt;
            readLoop()&lt;br&gt;
            mapperInput.Write([| 0x0Auy |], 0, 1)&lt;br&gt;
&lt;br&gt;
            mapperInput.Close()&lt;br&gt;
            taskMapperWriting.Wait()&lt;br&gt;
            mapperOutput.Close()&lt;br&gt;
&lt;br&gt;
            mapper.WaitForExit()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; result = &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; mapper.ExitCode &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; | 0 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color:#0000ff"&gt;true&lt;/span&gt; | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
            mapper.Close()&lt;br&gt;
            result&lt;br&gt;
      &lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; mapperProcess() = &lt;br&gt;
            Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Mapper Processing Starting...&amp;quot;&lt;/span&gt;  &lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Create the output file&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; File.Exists(mappedfile) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; File.Delete(mappedfile)&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapperWriter = File.CreateText(mappedfile)&lt;br&gt;
            mapperWriter.Close()&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#008000"&gt;// function to determine if valid document extension&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; isValidFile inputfile = &lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.Equals(Path.GetExtension(inputfile), &lt;span style="color:#800000"&gt;&amp;quot;.docx&amp;quot;&lt;/span&gt;, StringComparison.InvariantCultureIgnoreCase) ||&lt;br&gt;
                   String.Equals(Path.GetExtension(inputfile), &lt;span style="color:#800000"&gt;&amp;quot;.pdf&amp;quot;&lt;/span&gt;, StringComparison.InvariantCultureIgnoreCase) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Process the files in the directory&lt;/span&gt;&lt;br&gt;
            Directory.GetFiles(inputpath)&lt;br&gt;
            |&amp;gt; Array.filter isValidFile&lt;br&gt;
            |&amp;gt; Array.fold (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; result inputfile &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; result &amp;amp;&amp;amp; (mapperProcessLoop inputfile)) &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Sort the mapped file by the first field - mimic the role of Hadoop&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; hadoopProcess() = &lt;br&gt;
            Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Hadoop Processing Starting...&amp;quot;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; unsortedValues = seq {&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reader = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(File.OpenRead(mappedfile))&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;while&lt;/span&gt; not reader.EndOfStream &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; input = reader.ReadLine()&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; keyValue = input.Split(&lt;span style="color:#800000"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;)&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; (keyValue.[0].Trim(), keyValue.[1].Trim())&lt;br&gt;
                reader.Close()&lt;br&gt;
                }&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; writer = File.CreateText(reducefile)&lt;br&gt;
            unsortedValues&lt;br&gt;
            |&amp;gt; Seq.sortBy fst&lt;br&gt;
            |&amp;gt; Seq.iter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; (key, value) &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; writer.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;%O&amp;#92;t%O&amp;quot;&lt;/span&gt; key value))&lt;br&gt;
            writer.Close()&lt;br&gt;
&lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Finally call the reducer process&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; reducerProcess() =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reducer = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Process()&lt;br&gt;
            reducer.StartInfo.FileName &amp;lt;- reducerExe&lt;br&gt;
            reducer.StartInfo.UseShellExecute &amp;lt;- &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
            reducer.StartInfo.RedirectStandardInput &amp;lt;- &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
            reducer.StartInfo.RedirectStandardOutput &amp;lt;- &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
            reducer.Start() |&amp;gt; ignore&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reducerInput = reducer.StandardInput&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reducerOutput = reducer.StandardOutput &lt;br&gt;
        &lt;br&gt;
            &lt;span style="color:#008000"&gt;// Map the reader to a background thread so processing can happen in parallel&lt;/span&gt;&lt;br&gt;
            Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Reducer Processing Starting...&amp;quot;&lt;/span&gt; &lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; taskReducerFunc() = &lt;br&gt;
                &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reducerWriter = File.CreateText(outputfile)&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;while&lt;/span&gt; not reducerOutput.EndOfStream &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;
                    reducerWriter.WriteLine(reducerOutput.ReadLine())&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; taskReducerWriting = Task.Factory.StartNew(Action(taskReducerFunc)) &lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Pass the file into the mapper process and close input stream when done&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reducerReader = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(File.OpenRead(reducefile))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;while&lt;/span&gt; not reducerReader.EndOfStream &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;
                reducerInput.WriteLine(reducerReader.ReadLine())&lt;br&gt;
&lt;br&gt;
            reducerInput.Close()&lt;br&gt;
            taskReducerWriting.Wait()&lt;br&gt;
            reducerOutput.Close()&lt;br&gt;
&lt;br&gt;
            reducer.WaitForExit()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; result = &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; reducer.ExitCode &lt;span style="color:#0000ff"&gt;with&lt;/span&gt; | 0 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color:#0000ff"&gt;true&lt;/span&gt; | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
            reducer.Close()&lt;br&gt;
            result&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Finish test&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; mapperProcess() &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
            Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Mapper Processing Complete...&amp;quot;&lt;/span&gt;  &lt;br&gt;
&lt;br&gt;
            hadoopProcess()&lt;br&gt;
            Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Hadoop Processing Complete...&amp;quot;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; reducerProcess() &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Reducer Processing Complete...&amp;quot;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
                Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Processing Complete...&amp;quot;&lt;/span&gt;     &lt;br&gt;
                   &lt;br&gt;
        Console.ReadLine() |&amp;gt; ignore&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;When calling the mapper it is no longer the case that the mapper executable is called once, with each line being redirected into the executables StdIn. In the binary case the mapper executable is called once for each document, where for each document the data is then redirected into the executables StdIn. As mentioned the format defined is the filename, delimitated with a Tab, followed by the documents bytes, and finally the Newline character:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:67773899-e41d-49a7-bd49-d260ee3706b0" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#008000"&gt;// Pass the file into the mapper process and close input stream when done          &lt;/span&gt;&lt;br&gt;
&lt;span style="color:#0000ff"&gt;use&lt;/span&gt; mapperReader = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; BinaryReader(File.OpenRead(inputfile))&lt;br&gt;
&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; readLoop() = &lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; bytesread = mapperReader.Read(buffer, 0, CHUNK)&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; bytesread &amp;gt; 0 &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
        mapperInput.Write(buffer, 0, bytesread)&lt;br&gt;
        readLoop()&lt;br&gt;
&lt;br&gt;
&lt;span style="color:#008000"&gt;// Write out a Filename/Tab/Document/LineFeed&lt;/span&gt;&lt;br&gt;
&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; filename = Path.GetFileName(inputfile)&lt;br&gt;
&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; encoding = Text.UTF8Encoding();&lt;br&gt;
mapperInput.Write(encoding.GetBytes(filename), 0, encoding.GetByteCount(filename))&lt;br&gt;
mapperInput.Write([| 0x09uy |], 0, 1)&lt;br&gt;
readLoop()&lt;br&gt;
mapperInput.Write([| 0x0Auy |], 0, 1)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This code is code for each document found in the directory specified in the input argument.&lt;/p&gt;

&lt;p&gt;The previous post discussed the threading and stream processing needed for testing in a little more detail.&lt;/p&gt;

&lt;h3&gt;Java Classes&lt;/h3&gt;

&lt;p&gt;To complete the post here is the full listing for the Java class implementations:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:22b52026-e30f-4e60-8a41-0f1eea6e7250" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;FileInputFormat&lt;/div&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;package com.microsoft.hadoop.mapreduce.lib.input;&lt;br&gt;
&lt;br&gt;
import java.io.IOException;&lt;br&gt;
&lt;br&gt;
import org.apache.hadoop.fs.Path;&lt;br&gt;
import org.apache.hadoop.fs.FileSystem;&lt;br&gt;
&lt;br&gt;
import org.apache.hadoop.io.BytesWritable;&lt;br&gt;
import org.apache.hadoop.io.NullWritable;&lt;br&gt;
import org.apache.hadoop.io.Text;&lt;br&gt;
&lt;br&gt;
import org.apache.hadoop.mapred.FileSplit;&lt;br&gt;
import org.apache.hadoop.mapred.FileInputFormat;&lt;br&gt;
import org.apache.hadoop.mapred.InputSplit;&lt;br&gt;
import org.apache.hadoop.mapred.JobConf;&lt;br&gt;
import org.apache.hadoop.mapred.RecordReader;&lt;br&gt;
import org.apache.hadoop.mapred.Reporter;&lt;br&gt;
import org.apache.hadoop.mapreduce.InputFormat;&lt;br&gt;
import org.apache.hadoop.mapreduce.JobContext;&lt;br&gt;
&lt;br&gt;
public class BinaryDocumentWithNameInputFormat&lt;br&gt;
    extends FileInputFormat&amp;lt;Text, BytesWritable&amp;gt; {&lt;br&gt;
&lt;br&gt;
    public BinaryDocumentWithNameInputFormat() {&lt;br&gt;
        super();&lt;br&gt;
    }&lt;br&gt;
    &lt;br&gt;
    protected boolean isSplitable(FileSystem fs, Path filename) {&lt;br&gt;
        return false;&lt;br&gt;
    }&lt;br&gt;
&lt;br&gt;
    @Override&lt;br&gt;
    public RecordReader&amp;lt;Text, BytesWritable&amp;gt; getRecordReader(&lt;br&gt;
            InputSplit split, JobConf job, Reporter reporter) throws IOException {&lt;br&gt;
        &lt;br&gt;
        return new BinaryDocumentWithNameRecordReader((FileSplit) split, job);        &lt;br&gt;
    }&lt;br&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3d0990bf-c4e2-46ce-b788-d5389c82f4c7" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;RecordReader&lt;/div&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;package com.microsoft.hadoop.mapreduce.lib.input;&lt;br&gt;
&lt;br&gt;
import java.io.IOException;&lt;br&gt;
import java.util.Arrays;&lt;br&gt;
&lt;br&gt;
import org.apache.hadoop.conf.Configuration;&lt;br&gt;
import org.apache.hadoop.fs.FSDataInputStream;&lt;br&gt;
import org.apache.hadoop.fs.FileSystem;&lt;br&gt;
import org.apache.hadoop.fs.Path;&lt;br&gt;
&lt;br&gt;
import org.apache.hadoop.io.BytesWritable;&lt;br&gt;
import org.apache.hadoop.io.DataOutputBuffer;&lt;br&gt;
import org.apache.hadoop.io.NullWritable;&lt;br&gt;
import org.apache.hadoop.io.Text;&lt;br&gt;
&lt;br&gt;
import org.apache.hadoop.mapred.JobConf;&lt;br&gt;
import org.apache.hadoop.mapred.RecordReader;&lt;br&gt;
import org.apache.hadoop.mapred.FileSplit;&lt;br&gt;
import org.apache.hadoop.mapred.Reporter;&lt;br&gt;
&lt;br&gt;
public class BinaryDocumentWithNameRecordReader implements RecordReader&amp;lt;Text, BytesWritable&amp;gt; {&lt;br&gt;
    &lt;br&gt;
    private FileSplit fileSplit;&lt;br&gt;
    private Configuration conf;&lt;br&gt;
    private boolean processed = false;&lt;br&gt;
    &lt;br&gt;
    public BinaryDocumentWithNameRecordReader(FileSplit fileSplit, Configuration conf)&lt;br&gt;
        throws IOException {&lt;br&gt;
        this.fileSplit = fileSplit;&lt;br&gt;
        this.conf = conf;&lt;br&gt;
    }&lt;br&gt;
&lt;br&gt;
    @Override&lt;br&gt;
    public Text createKey() {&lt;br&gt;
        return new Text();&lt;br&gt;
    }&lt;br&gt;
&lt;br&gt;
    @Override&lt;br&gt;
    public BytesWritable createValue() {&lt;br&gt;
        return new BytesWritable();&lt;br&gt;
    }&lt;br&gt;
      &lt;br&gt;
    @Override&lt;br&gt;
    public long getPos() throws IOException {&lt;br&gt;
        return this.processed ? this.fileSplit.getLength() : 0;&lt;br&gt;
    }&lt;br&gt;
    &lt;br&gt;
    @Override&lt;br&gt;
    public float getProgress() throws IOException {&lt;br&gt;
        return this.processed ? 1.0f : 0.0f;&lt;br&gt;
    }&lt;br&gt;
    &lt;br&gt;
    @Override&lt;br&gt;
    public boolean next(Text key, BytesWritable value) throws IOException {&lt;br&gt;
        if (!this.processed) {&lt;br&gt;
            byte[] contents = new byte[(int) this.fileSplit.getLength()];&lt;br&gt;
            Path file = this.fileSplit.getPath();&lt;br&gt;
            FileSystem fs = file.getFileSystem(this.conf);&lt;br&gt;
            FSDataInputStream in = null;&lt;br&gt;
            &lt;br&gt;
            try {&lt;br&gt;
                in = fs.open(file);&lt;br&gt;
                in.readFully(contents, 0, contents.length);&lt;br&gt;
                &lt;br&gt;
                key.set(file.getName());&lt;br&gt;
                value.set(contents, 0, contents.length);&lt;br&gt;
            }&lt;br&gt;
            finally {&lt;br&gt;
                in.close();&lt;br&gt;
            }&lt;br&gt;
            &lt;br&gt;
            this.processed = true;&lt;br&gt;
            return true;&lt;br&gt;
        }&lt;br&gt;
        else {&lt;br&gt;
            return false;&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
&lt;br&gt;
    @Override&lt;br&gt;
    public void close() throws IOException {&lt;br&gt;
    }&lt;br&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Once the Java classes have been compiled they need to be merged into a copy of the hadoop-streaming.jar file. In my case I have created a file called hadoop-streaming-ms.jar. This file is a copy of the base file into which I have copied the classes, as the JAR file is just a ZIP file; although one can also use the JAR tool. One just has to remember to use the package path:&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: courier new" face="Courier New"&gt;com\microsoft\hadoop\mapreduce\lib\input&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;To use this new streaming package the file needs to be copied to the Hadoop install lib directory; in my case:&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: courier new" face="Courier New"&gt;C:\Apps\dist\lib&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;If you download the code there is also an implementation of these classes that support a key value type pairing of &amp;lt;NullWritable, BytesWritable&amp;gt;; rather than the &amp;lt;Text, BytesWritable&amp;gt; key value type pairing that is used to pass in the documents filename. This can used used if the document’s filename is not needed.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Hopefully the code is once again useful if you intend to write any Binary Streaming applications of documents. If you download the sample code, in addition to support for processing of Microsoft Word documents there is support for processing PDF documents.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10254343" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Azure/">Windows Azure</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Interoperability/">Interoperability</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop+Streaming/">Hadoop Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop/">Hadoop</category></item><item><title>Hadoop Streaming and F# MapReduce</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/12/22/hadoop-streaming-and-f-mapreduce.aspx</link><pubDate>Thu, 22 Dec 2011 22:50:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10250542</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10250542</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/12/22/hadoop-streaming-and-f-mapreduce.aspx#comments</comments><description>&lt;p&gt;As you may know Microsoft has recently announced plans for a &lt;a href="http://blogs.technet.com/b/microsoft_blog/archive/2011/10/12/microsoft-expands-data-platform-to-help-customers-manage-the-new-currency-of-the-cloud.aspx"&gt;Hadoop adoption for both Windows Server and Windows Azure&lt;/a&gt;. You can find out more about Hadoop and Windows Azure at &lt;a title="Apache Hadoop-based Services for Windows Azure" href="https://www.hadooponazure.com/"&gt;Apache Hadoop-based Services for Windows Azure&lt;/a&gt; and &lt;a title="Availability of Community Technology Preview (CTP) of Hadoop based Service on Windows Azure" href="http://blogs.technet.com/b/dataplatforminsider/archive/2011/12/14/availability-of-community-technology-preview-ctp-of-hadoop-based-service-on-windows-azure.aspx"&gt;Availability of Community Technology Preview (CTP) of Hadoop based Service on Windows Azure&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;If you are not familiar with MapReduce then there are some useful resources for F# and MapReduce that would also be worth reading &lt;a title="Exploring MapReduce with F#" href="http://weblogs.asp.net/podwysocki/archive/2009/03/03/exploring-mapreduce-with-f.aspx"&gt;Exploring MapReduce with F#&lt;/a&gt; and &lt;a title="Parsing Log Files with F#, MapReduce and Windows Azure" href="http://msdn.microsoft.com/en-us/magazine/gg983490.aspx"&gt;Parsing Log Files with F#, MapReduce and Windows Azure&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;As Hadoop is written in Java the main integration point for MapReduce for .Net developers is through Hadoop Streaming. Hadoop streaming being a utility that allows you to create and run MapReduce jobs with any executable or script as the mapper and/or the reducer. You can find out everything you want to know about Hadoop Streaming at: &lt;a href="http://hadoop.apache.org/common/docs/current/streaming.html"&gt;http://hadoop.apache.org/common/docs/current/streaming.html&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;MapReduce Code&lt;/h3&gt;  &lt;p&gt;Before starting it is worth noting that the complete code for this blog post can be found at:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850" href="http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850"&gt;http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When writing a Hadoop Streaming MapReduce job it will quickly become apparent that there is a codebase that one can reuse. As such, I thought it would be useful to put together this codebase to enable F# developers to write MapReduce libraries through a simple API. The idea was to provide reusable code such that one only needed to be concerned with implementing the MapReduce code with the following function prototype’s:&lt;/p&gt;  &lt;pre&gt;Map : string –&amp;gt; (string * obj) option&lt;/pre&gt;

&lt;pre&gt;Reduce : string -&amp;gt; seq&amp;lt;string&amp;gt; –&amp;gt; obj option&lt;/pre&gt;

&lt;p&gt;The idea is that the Hadoop text input is processed and each input line is passed into the Map function which parses and filters the key/value pair for the data. The values are then sorted and merged, by Hadoop. The processed mapped data is then passed into the Reduce function, as a key and corresponding sequence of strings, which then defines the optional output value.&lt;/p&gt;

&lt;p&gt;So why the use of the obj type? Hadoop Streaming is based on text data, albeit a binary interface is also available. Thus the inputs into the MapReduce are strings. However, when performing the MapReduce operations strings are not always suitable, but they do need to be able to be represented as strings. This is normally handled through serialization but in this case I have used sprintf with a “%O” pattern. Thus any type needs to have a meaningful ToString() implementation such that the data can once again be parsed back into a workable type.&lt;/p&gt;

&lt;p&gt;As a sample consider the following data:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5737a561-79fc-4e0a-ad56-0c83b63c0fac" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; max-height: 200px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;11075    19:07:56    en-US    iPhone OS    Apple    iPhone 4.2.1    Georgia    United States        0    0&lt;br&gt;
11081    01:46:19    en-US    Android    Samsung    SCH-i500    Colorado    United States    4.2620937    0    0&lt;br&gt;
11086    04:07:25    en-US    Android    Unknown    Android 2.3    California    United States        0    0&lt;br&gt;
11090    03:34:59    en-US    iPhone OS    Apple    iPod Touch 4.3.x    Hawaii    United States        0    0&lt;br&gt;
11095    19:34:47    en-US    Android    Samsung    SCH-i500    Illinois    United States    0.4621525    1    0&lt;br&gt;
11095    02:31:19    en-US    Android    Samsung    SCH-i500    Nebraska    United States    1.2662282    0    0&lt;br&gt;
11095    02:31:21    en-US    Android    Samsung    SCH-i500    Nebraska    United States    0.2905647    0    1&lt;br&gt;
11095    19:34:49    en-US    Android    Samsung    SCH-i500    Illinois    United States    1.3336967    1    1&lt;br&gt;
11097    10:22:41    en-US    iPhone OS    Apple    iPhone 4.0    Illinois    United States        0    0&lt;br&gt;
11102    12:54:27    en-US    Android    Samsung    SCH-i400    Florida    United States        0    0&lt;br&gt;
11106    12:54:25    en-GB    Windows Phone    HTC    7 Trophy    Greater London    United Kingdom    9.94    2    0&lt;br&gt;
11106    08:50:46    en-GB    Windows Phone    HTC    7 Trophy    Greater London    United Kingdom    3.12    0    0&lt;br&gt;
11106    11:07:31    en-GB    Windows Phone    HTC    7 Trophy    Greater London    United Kingdom    15.538    1    0&lt;br&gt;
11106    11:13:27    en-GB    Windows Phone    HTC    7 Trophy    Greater London    United Kingdom    1.5066558    1    1&lt;br&gt;
11106    11:13:28    en-GB    Windows Phone    HTC    7 Trophy    Greater London    United Kingdom        1    2&lt;br&gt;
11112    00:42:52    en-US    iPhone OS    Apple    iPhone 4.2.x    Illinois    United States    18.1075543    0    0&lt;br&gt;
11112    00:43:14    en-US    iPhone OS    Apple    iPhone 4.2.x    Illinois    United States    2.6342826    0    1&lt;br&gt;
11130    10:48:20    en-GB    iPhone OS    Apple    iPhone 4.2.1    Greater London    United Kingdom        0    0&lt;br&gt;
11131    12:19:52    en-US    Android    Unknown    Android 2.3    Massachusetts    United States        0    0&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This represents some mobile phone data with the 2nd column representing the query time and the 4th column representing the platform device. A simple MapReduce could be:&lt;/p&gt;

&lt;p&gt;Pull the Device Platform and Query Time from the data:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ea3d48d2-89b4-47e9-a01a-5a2e38e1f143" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Mapper&lt;/div&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; MobilePhoneQueryMapper =&lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#008000"&gt;// Performs the split into key/value&lt;/span&gt;&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; splitInput (value:string) =&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;try&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; splits = value.Split(&lt;span style="color:#800000"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;)&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; devicePlatform = splits.[3]&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; queryTime = TimeSpan.Parse(splits.[1])&lt;br&gt;
            Some(devicePlatform, box queryTime)&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;
        | :? System.ArgumentException &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; None&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#008000"&gt;// Map the data from input name/value to output name/value&lt;/span&gt;&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Map (value:string) =&lt;br&gt;
        splitInput value&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Calculate the Min, Average, and Max Query Times.&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:55afeed8-7df6-4b05-8792-9ac129391bf1" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Reducer&lt;/div&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; MobilePhoneQueryRangeReducer = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Reduce (key:string) (values:seq&amp;lt;string&amp;gt;) =&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; initState = (TimeSpan.MaxValue, TimeSpan.MinValue, 0L, 0L)&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; (minValue, maxValue, totalValue, totalCount) =&lt;br&gt;
            values |&amp;gt; &lt;br&gt;
            Seq.fold (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; (minValue, maxValue, totalValue, totalCount) value &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                (min minValue (TimeSpan.Parse(value)), max maxValue (TimeSpan.Parse(value)), totalValue + (int64)(TimeSpan.Parse(value).TotalSeconds), totalCount + 1L) ) initState&lt;br&gt;
&lt;br&gt;
        Some(box (minValue, TimeSpan.FromSeconds((float)(totalValue/totalCount)), maxValue))&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The box function is used to ensure the types returned from the MapReduce calls is of the obj type.&lt;/p&gt;

&lt;p&gt;So onto the executable code.&lt;/p&gt;

&lt;p&gt;As this is Hadoop Streaming applications, both the mapper and the reducer are executables that read the input from StdIn (line by line) and emit the output to StdOut. Thus one just needs a console application that does a Console.ReadLine() to get the data, and perform a Console.WriteLine() to emit the output. &lt;/p&gt;

&lt;p&gt;As with all F# Console applications the MainEntry point is defined as: &lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7b5adbfc-7538-4152-979d-2efda30f40ac" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Program =   &lt;br&gt;
&lt;br&gt;
    [&amp;lt;EntryPoint&amp;gt;]&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Main(args) = &lt;br&gt;
&lt;br&gt;
        Controller.Run args&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// main entry point return&lt;/span&gt;&lt;br&gt;
        0&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Each executable then contains a Controller module that is run to process the data.&lt;/p&gt;

&lt;h3&gt;Mapper Executable&lt;/h3&gt;

&lt;p&gt;The purpose of the Mapper code is to perform Input Format Parsing, Projection, and Filtering. The code to perform this is as follows:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:912b3e85-38d8-4292-8965-ac4df4901ca2" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Controller = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run (args:string array) =    &lt;br&gt;
    &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Define what arguments are expected&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; defs = [&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Input File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Output File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; } ]&lt;br&gt;
 &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse Arguments into a Dictionary&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = Arguments.ParseArgs args defs              &lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Ensure Standard Input/Output and allow for debug configuration&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reader = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(Console.OpenStandardInput())&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; writer =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Console.OpenStandardOutput(), AutoFlush = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;)&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Combine the name/value output into a string&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; outputCollector (outputKey, outputValue) =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; output = sprintf &lt;span style="color:#800000"&gt;&amp;quot;%s&amp;#92;t%O&amp;quot;&lt;/span&gt; outputKey outputValue&lt;br&gt;
            writer.WriteLine(output)&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Read the next line of the input stream&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; readLine() = &lt;br&gt;
            reader.ReadLine()&lt;br&gt;
            &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Define the input sequence&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; inputs() = seq {&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; input = readLine()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not(String.IsNullOrWhiteSpace(input)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#008000"&gt;// Yield the input and the remainder of the sequence&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; input&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;yield!&lt;/span&gt; inputs()&lt;br&gt;
        }&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Process the lines from the stream and pass into the mapper&lt;/span&gt;&lt;br&gt;
        inputs()&lt;br&gt;
        |&amp;gt; Seq.map MobilePhoneQueryMapper.Map&lt;br&gt;
        |&amp;gt; Seq.filter Option.isSome&lt;br&gt;
        |&amp;gt; Seq.iter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; value &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; outputCollector value.Value)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;A majority of this code provides a means for specifying input and output files to better aid testing (more on this in a bit).&lt;/p&gt;

&lt;p&gt;The code boils down to the last three lines which performs the main functions:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:501faf88-9d53-4e45-8339-9d866b451aa0" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;inputs()&lt;br&gt;
|&amp;gt; Seq.map MobilePhoneQueryMapper.Map&lt;br&gt;
|&amp;gt; Seq.filter Option.isSome&lt;br&gt;
|&amp;gt; Seq.iter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; value &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; outputCollector value.Value)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This parses the input, maps the data into a key value pairs, filters out unwanted rows, and outputs the data using the outputCollector function.&lt;/p&gt;

&lt;p&gt;The outputCollector function takes the processed key/value pair and outputs them to the correct stream. In the Java API the types used for output are based on a Writable interface; rather than Java Serialization. In this implementation the outputCollector takes the obj.ToString(); through the use of sprintf(). Thus if the provided types does not have a useful ToString() you will have to create the string representation before calling the outputCollector. The outputCollector performs the formatting of the key/value pair into a Tab delimited string; as required for Hadoop Streaming.&lt;/p&gt;

&lt;h2&gt;Reducer Executable&lt;/h2&gt;

&lt;p&gt;After running the Mapper, the data being parsed into the Reducer will be a key/value pair delimited with a Tab. Using the aforementioned sample data and Map, a sample, but selective, input dataset for a Reducer would be:&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;Android&amp;#160;&amp;#160;&amp;#160; 18:54:20 
    &lt;br /&gt;Android&amp;#160;&amp;#160;&amp;#160; 19:19:44 

    &lt;br /&gt;Android&amp;#160;&amp;#160;&amp;#160; 19:19:46 

    &lt;br /&gt;RIM OS&amp;#160;&amp;#160;&amp;#160; 17:19:36 

    &lt;br /&gt;RIM OS&amp;#160;&amp;#160;&amp;#160; 17:17:18 

    &lt;br /&gt;RIM OS&amp;#160;&amp;#160;&amp;#160; 00:44:41 

    &lt;br /&gt;Windows Phone&amp;#160;&amp;#160;&amp;#160; 12:54:25 

    &lt;br /&gt;Windows Phone&amp;#160;&amp;#160;&amp;#160; 08:50:46 

    &lt;br /&gt;Windows Phone&amp;#160;&amp;#160;&amp;#160; 11:13:28 

    &lt;br /&gt;iPhone OS&amp;#160;&amp;#160;&amp;#160; 19:07:56 

    &lt;br /&gt;iPhone OS&amp;#160;&amp;#160;&amp;#160; 03:34:59 

    &lt;br /&gt;proprietary development&amp;#160;&amp;#160;&amp;#160; 14:29:20 

    &lt;br /&gt;proprietary development&amp;#160;&amp;#160;&amp;#160; 14:30:17&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;The processing of the mapped data within the Reducer is a little more complex than the Mapper. The idea is that the data is grouped by the input key and the resulting sequences are passed into the Reduce function; a function call for each key along with the corresponding sequence.&lt;/p&gt;

&lt;p&gt;Whereas the Seq.groupBy can perform this operation, the groupBy function makes no assumption on the ordering of the original sequence. As a consequence the resulting sequence is not lazily evaluated, and is thus not suitable for large sequences; an absolute must for Hadoop MapReduce jobs. The code thus has to create a lazily evaluated sequence for each input key. This can be achieved as one knows the input data is sorted.&lt;/p&gt;

&lt;p&gt;To achieve this the processing has to be state dependant to handle the transition from one key value to the next. The input data is processed in such a fashion that any change in key value causes a transition to the next sequence. The state persistence is needed to track the key change, and to ensure the first yield of the new sequence is the value that caused this transition; transition values are not lost.&lt;/p&gt;

&lt;p&gt;The code for the Reducer is as follows:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:93e44257-422f-4a3c-8f08-98e6fceb98ec" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Controller = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run (args:string array) = &lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Define what arguments are expected&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; defs = [&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Input File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; };&lt;br&gt;
            {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Output File&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; } ]&lt;br&gt;
 &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse Arguments into a Dictionary&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = Arguments.ParseArgs args defs&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Ensure Standard Input/Output and allow for debug configuration&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; reader = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;input&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamReader(Console.OpenStandardInput())&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;use&lt;/span&gt; writer =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Path.GetFullPath(parsedArgs.[&lt;span style="color:#800000"&gt;&amp;quot;output&amp;quot;&lt;/span&gt;]))&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; StreamWriter(Console.OpenStandardOutput(), AutoFlush = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;)&lt;br&gt;
        &lt;br&gt;
        &lt;span style="color:#008000"&gt;// Combine the name/value output into a string&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; outputCollector outputKey outputValue =            &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; output = sprintf &lt;span style="color:#800000"&gt;&amp;quot;%s&amp;#92;t%O&amp;quot;&lt;/span&gt; outputKey outputValue&lt;br&gt;
            writer.WriteLine(output)&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Read the next line of the input stream&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; readLine() = &lt;br&gt;
            reader.ReadLine()&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Parse the input into the required name/value pair&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parseLine (input:string) = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; keyValue = input.Split(&lt;span style="color:#800000"&gt;&amp;#39;&amp;#92;t&amp;#39;&lt;/span&gt;)&lt;br&gt;
            (keyValue.[0].Trim(), keyValue.[1].Trim())&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Converts a input line into an option&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; getInput() = &lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; input = readLine()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not(String.IsNullOrWhiteSpace(input)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                Some(parseLine input)&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;
                None&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Creates a sequence of the input based on the provided key&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; lastInput = ref None&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; continueDo = ref &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; inputsByKey key (firstValue:string option) = seq {&lt;br&gt;
            &lt;span style="color:#008000"&gt;// Yield any value from previous read&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; firstValue.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; firstValue.Value&lt;br&gt;
&lt;br&gt;
            continueDo := &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;while&lt;/span&gt; !continueDo &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; getInput() &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;
                | Some(input) &lt;span style="color:#0000ff"&gt;when&lt;/span&gt; (fst input) = key &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#008000"&gt;// Yield found value and remainder of sequence&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; (snd input)                    &lt;br&gt;
                | Some(input) &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#008000"&gt;// Have a value but different key&lt;/span&gt;&lt;br&gt;
                    lastInput := Some(fst input, snd input)&lt;br&gt;
                    continueDo := &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
                | None &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;
                    &lt;span style="color:#008000"&gt;// Have no more entries&lt;/span&gt;&lt;br&gt;
                    lastInput := None&lt;br&gt;
                    continueDo := &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;&lt;br&gt;
        }&lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#008000"&gt;// Controls the calling of the reducer&lt;/span&gt;&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; processInput (input:(string*string) option) =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; input.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; key = fst input.Value&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; value = MobilePhoneQueryReducer.Reduce key (inputsByKey key (Some(snd input.Value)))&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; value.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    outputCollector key value.Value&lt;br&gt;
                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; lastInput.contents.IsSome &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                    processInput lastInput.contents&lt;br&gt;
&lt;br&gt;
        processInput (getInput())&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The code also contains the same testing structure to allow one to pass in an input and output file; once again to aid in debugging.&lt;/p&gt;

&lt;p&gt;The code uses a string.Split() to derive the tuple of key/value pair; as this is how the Mapper writes out the data. Once the data has been Reduced, the outputCollector once again performs the formatting of the key/value data into a Tab delimited string, sending the text to the StdOut stream. The value in this case is the reduced data corresponding to the key.&lt;/p&gt;

&lt;p&gt;The output for the sample data and Reduce sample code, listed above, would be:&lt;/p&gt;

&lt;p&gt;&lt;font face="Consolas"&gt;Android&amp;#160;&amp;#160;&amp;#160; (00:00:06, 12:54:39, 23:59:54) 
    &lt;br /&gt;RIM OS&amp;#160;&amp;#160;&amp;#160; (00:01:07, 13:52:56, 23:59:58) 

    &lt;br /&gt;Unknown&amp;#160;&amp;#160;&amp;#160; (00:00:36, 10:29:27, 23:52:36) 

    &lt;br /&gt;Windows Phone&amp;#160;&amp;#160;&amp;#160; (00:00:32, 12:38:31, 23:55:17) 

    &lt;br /&gt;iPhone OS&amp;#160;&amp;#160;&amp;#160; (00:00:01, 11:51:53, 23:59:50) 

    &lt;br /&gt;proprietary development&amp;#160;&amp;#160;&amp;#160; (14:29:20, 14:29:44, 14:30:17)&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;The value corresponding to the key is the string representing of a tuple of type (TimeSpan*TimeSpan*TimeSpan).&lt;/p&gt;

&lt;p&gt;As you can see, there is a fair amount of code controlling the input and output streams for calling the Map and reduce functions; that can be reused for all Hadoop Streaming jobs.&lt;/p&gt;

&lt;h3&gt;Testing the Code&lt;/h3&gt;

&lt;p&gt;So now the code has been put together how can it be tested? Debugging a job once it has been deployed to a Hadoop cluster is not an easy task. As such one is much better off if testing can be performed without Hadoop in the picture. Whereas this will not cover all test cases, as some issues will only be found when deployed to a cluster, it does provide a means to cover most test scenarios.&lt;/p&gt;

&lt;p&gt;Unit Testing the individual map and Reduce functions is relatively straight forward. However performing testing on sample input data is a little trickier.&lt;/p&gt;

&lt;p&gt;To assist in testing with data files I have put together a Tester application. This application:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Defines and executes a Process for the Mapper executable in which 
    &lt;ul&gt;
      &lt;li&gt;The StdIn is modified to be the file specified in the “–input” command line argument &lt;/li&gt;

      &lt;li&gt;the StdOut is modified to be a file with a “mapper” extension &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;When the Mapper has completed, Sorts the output file from the Mapper into a file with a “reducer” extension &lt;/li&gt;

  &lt;li&gt;When the Sort is complete, defines and executes a Process for the Reducer executable in which 
    &lt;ul&gt;
      &lt;li&gt;The StdIn is modified to be the sorted “reducer” file &lt;/li&gt;

      &lt;li&gt;The StdOut is modified to be the file specified in the “–output” command line argument &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Running the Tester application allows one to check inputs and outputs, in a flow similar to running within Hadoop. The full listing for the Tester application can be found in the download code:&lt;/p&gt;

&lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850" href="http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850"&gt;http://code.msdn.microsoft.com/Hadoop-Streaming-and-F-f2e76850&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whereas this allows for simple data testing there is an easier option when one needs to attach a debugger. Bother the Mapper and Reducer executables accept a “–input” and “–output” command line arguments. These options define the files to be used, rather than the Standard Input/Output streams, for data processing. Using these arguments one can easily debug the executable with a set of test data and view the output. To create a Reducer input, for testing, one can run the Tester application with the required input data, and use the output&amp;#160; file with a “reducer” extension as the input.&lt;/p&gt;

&lt;p&gt;One final thing that has been useful for testing is the concept of a Null controller. This is merely an executable that just takes the input and passes it to the output stream:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0f7f9570-b3d3-4174-a2b2-ed894199dea2" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; ControllerNull = &lt;br&gt;
&lt;br&gt;
    &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run (args:string array) = &lt;br&gt;
&lt;br&gt;
        &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; inputs() =&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; input = Console.ReadLine()&lt;br&gt;
            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not(String.IsNullOrWhiteSpace(input)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;
                Console.WriteLine input&lt;br&gt;
                inputs()&lt;br&gt;
        inputs()&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This Null controller is useful when deploying your application to a Hadoop cluster to ensure data is being input and output correctly.&lt;/p&gt;

&lt;h2&gt;Hadoop and F#&lt;/h2&gt;

&lt;p&gt;I am not going to say much about running the Hadoop job other than to show the command to run the Streaming job:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:02475b6d-f22c-4b99-9b12-044680246442" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;C:&amp;#92;Apps&amp;#92;dist&amp;#92;bin&amp;gt;hadoop.cmd jar ../lib/hadoop-streaming.jar -D keep.failed.task.file=true&lt;br&gt;
 -input &amp;quot;/mobile/debug/sampledata.txt&amp;quot;&lt;br&gt;
 -output &amp;quot;/mobile/querytimesdebug&amp;quot;&lt;br&gt;
 -mapper &amp;quot;..&amp;#92;..&amp;#92;jars&amp;#92;FSharp.Hadoop.Mapper.exe&amp;quot;&lt;br&gt;
 -reducer &amp;quot;..&amp;#92;..&amp;#92;jars&amp;#92;FSharp.Hadoop.Reducer.exe&amp;quot;&lt;br&gt;
 -file &amp;quot;C:&amp;#92;MyDirectory&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.Mapper&amp;#92;bin&amp;#92;Debug&amp;#92;FSharp.Hadoop.Mapper.exe&amp;quot;&lt;br&gt;
 -file &amp;quot;C:&amp;#92;MyDirectory&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.Reducer&amp;#92;bin&amp;#92;Debug&amp;#92;FSharp.Hadoop.Reducer.exe&amp;quot;&lt;br&gt;
 -file &amp;quot;C:&amp;#92;MyDirectory&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;FSharp.Hadoop.MapReduce&amp;#92;bin&amp;#92;Debug&amp;#92;FSharp.Hadoop.MapReduce.dll&amp;quot;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The sample download code includes all the necessary command line code to run the job, and also includes a sample data file and some commands to copy this data to the cluster.&lt;/p&gt;

&lt;p&gt;There is however a point to be made about using F#, namely the dependency on the F# Runtime. Importantly the F# Runtime contains many useful functions and types, including APIs for collections such as lists, arrays, maps, sets and sequences. One should install the F# Runtime on all the nodes in the cluster. The installer can be found at:&lt;/p&gt;

&lt;p&gt;&lt;a title="Visual Studio 2010 F# 2.0 Runtime SP1" href="http://www.microsoft.com/download/en/details.aspx?id=15834"&gt;Visual Studio 2010 F# 2.0 Runtime SP1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If one is running the job on a server on which the FSharp Runtime has not been deployed there is another option. One can copy the appropriate runtime file to the temp execution directory. To achieve this one needs to add the following file option to the execution command:&lt;/p&gt;

&lt;p&gt;&lt;font face="Consolas"&gt;-file C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\FSharp.Core.dll&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;To conclude, don’t forget to check out Channel9 for more information:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://channel9.msdn.com/Events/windowsazure/learn/Learn-about-Hadoop-on-Windows-Azure-with-Alex-Stojanovic"&gt;http://channel9.msdn.com/Events/windowsazure/learn/Learn-about-Hadoop-on-Windows-Azure-with-Alex-Stojanovic&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10250542" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Azure/">Windows Azure</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop+Streaming/">Hadoop Streaming</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Hadoop/">Hadoop</category></item><item><title>Mutual authentication with a IIS hosted WCF data service installed in a workgroup environment</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/12/14/mutual-authentication-with-a-iis-hosted-wcf-data-service-installed-in-a-workgroup-environment.aspx</link><pubDate>Wed, 14 Dec 2011 14:41:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10247638</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10247638</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/12/14/mutual-authentication-with-a-iis-hosted-wcf-data-service-installed-in-a-workgroup-environment.aspx#comments</comments><description>&lt;p&gt;&lt;font size="2"&gt;This post covers the steps required to secure communication between a WCF client and a WCF data service using mutual certificate authentication.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;The client/service topology is depicted below:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4213.image17_5F00_19D898DA.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1488.image17_5F00_thumb_5F00_6AA6AD42.png" width="731" height="207" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Both the client and server run on a Windows Server 2008 R2 virtual machine with Windows SDK 7.1, Visual Studio 2010, SQL Server Express 2008 R2 and .NET framework 4.0.&lt;/font&gt;&lt;/p&gt;  &lt;h1&gt;&lt;u&gt;Mutual authentication explained&lt;/u&gt;&lt;/h1&gt;  &lt;p&gt;&lt;font size="2"&gt;A detailed discussion of public key cryptography is outside the scope of this article. However, I highly recommend that you read more &lt;/font&gt;&lt;a href="http://technet.microsoft.com/en-us/library/aa998077(EXCHG.65).aspx"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; to get a better understanding of the underlying principles, so that you can better understand the ‘How-To’ steps that follow.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;In essence the client possesses a public key certificate (hereafter known as a client certificate) with associated private key. Similarly, the service has possession of another public key certificate (hereafter known as a service certificate) with associated private key. For a given pair of keys, either the public or private key can be used to encrypt data but ONLY the corresponding key can decrypt the data. The public key is available to the world at large but the private key MUST remain with the owner alone. In this way the owner is able to encrypt data using the private key and a party in receipt of encrypted data can decrypt it using the public key. The fact that the receiving party can successfully decrypt the data using the public key means that the data MUST have been encrypted by the corresponding private key and, as only the owner has access to the private key, the data MUST have originated from the owner; this is known as nonrepudiation as the owner cannot claim that encrypted data did not originate from them (of course, the private key may have been stolen but that is a different matter).&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;Translating this to the current scenario, in order for the client and service to successfully converse using certificates, the WCF client application must have access to the client’s private key and IIS (the receiving party) must have access to the client’s public key. Conversely, IIS must have access to the service private key and the client must have access to the service public key.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;In an Active Directory domain, the public key certificate is ordinarily assigned to a domain account such that IIS can locate the certificate using &lt;/font&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc770946(WS.10).aspx"&gt;&lt;font size="2"&gt;Active Directory Domain Services&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; (ADDS). However, ADDS does not exist in a workgroup environment and so the client certificate public key list must be maintained within IIS itself.&lt;/font&gt;&lt;/p&gt;  &lt;h1&gt;&lt;u&gt;Methodology&lt;/u&gt;&lt;/h1&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;1) Create a trusted root certificate&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The certificates in this article are issued by a certificate authority, in this case a trusted root certificate created using the makecert tool that ships with the Windows SDK.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Create a folder somewhere on the file system and, in a command window, change the directory to match the newly created folder &lt;/font&gt;&lt;font size="2"&gt;&amp;#160; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Run the following command to create a root certificate (do not define a password) &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;&amp;quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\makecert&amp;quot; -r -pe -n &amp;quot;CN=Test Root Authority&amp;quot; -ss CA -sr CurrentUser -a sha1 -sky signature -cy authority -sv TestRoot.pvk TestRoot.cer&lt;/font&gt;&lt;/li&gt;     &lt;/ul&gt;      &lt;p&gt;&amp;#160;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;2) Install the client certificate with private key&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The client application, as owner of the client certificate, needs access to the private key at runtime. We are going to create an interactive client (e.g. – Console, WinForm, Silverlight, Internet Explorer etc.), and so the certificate will be installed in the Current User – Personal store. If the client was non-interactive (e.g. – NT service) the certificate would be installed in the Local Machine – Personal store.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;Additionally, as the client certificate has been issued from a trusted certificate authority (CA), the root certificate created in 1) must also be installed.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;From the folder where TestRoot.cer is located, create and install a client certificate by running the following in a command window &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;&amp;quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\makecert&amp;quot; -n &amp;quot;CN=Test Client&amp;quot; -ic &amp;quot;TestRoot.cer&amp;quot; -iv &amp;quot;TestRoot.pvk&amp;quot; -a sha1 -sky exchange -pe -sr currentuser -ss my &amp;quot;TestClient.cer&amp;quot; &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Open a snap-in window &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Start – Run – mmc &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add/Remove snap-in &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Ctrl-M &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add a Certificates snap-in for ‘My user account’ &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Expand the (Trusted Root Certification Authorities)/Certificates node &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the Certificates folder and choose All Tasks – Import &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Browse to TestRoot.cer &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Click through the remaining windows and finish&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;3) Install the service certificate with private key&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The service, as owner of a service certificate, needs access to the private key at runtime. As the service is non-interactive (i.e. – it is not running under the context of a logged-on user), the certificate will be installed in the Local Machine – Personal store.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;Additionally, as the service certificate has been issued from a trusted certificate authority (CA), the root certificate for the CA must also be installed so that the chain of trust can be verified.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;From the folder where TestRoot.cer is located, install the service certificate by running the following in a command window &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;&amp;quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\makecert&amp;quot; -n &amp;quot;CN=www.mydataservice.com&amp;quot; -ic &amp;quot;TestRoot.cer&amp;quot; -iv &amp;quot;TestRoot.pvk&amp;quot; -a sha1 -sky exchange -eku 1.3.6.1.5.5.7.3.1 -pe -sr LocalMachine -ss my TestDataService.cer &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Open a snap-in window &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Start – Run – mmc &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add/Remove snap-in &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Ctrl-M &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add a Certificates snap-in for ‘Computer account’ &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Expand the (Trusted Root Certification Authorities)/Certificates node &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the Certificates folder and choose All Tasks – Import &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Browse to TestRoot.cer &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Click through the remaining windows and finish&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;4) Export the client public key certificate&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;IIS needs access to the client’s public key certificate. In this section the certificate is exported for later use.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Open a snap-in window (or use the same window as 2)) &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Start – Run – mmc &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add/Remove snap-in &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Ctrl-M &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add a Certificates snap-in for ‘My user account’ &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Expand the (Certificates – Current User)/Personal/Certificates node &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the Test Client certificate and choose All Tasks – Export (Do not export the primary key) &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;N.B. - Exporting the private key will not cause problems but remember that the private key is for the client ALONE &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Save the certificate as TestClient_Public.cer (Base-64 encoded X.509)&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;5) Export the service public key certificate&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The WCF client needs access to the service public key certificate. In this section the certificate is exported for later use.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Open a snap-in window (or use the same window as 3)) &lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="2"&gt;Start – Run – mmc &lt;/font&gt;&lt;/li&gt;     &lt;font size="2"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="2"&gt;Add/Remove snap-in &lt;/font&gt;&lt;/li&gt;     &lt;font size="2"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="2"&gt;Ctrl-M &lt;/font&gt;&lt;/li&gt;     &lt;font size="2"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="2"&gt;Add a Certificates snap-in for ‘Computer account’ &lt;/font&gt;&lt;/li&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;    &lt;li&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Expand the (Certificates – Local Computer)/Personal/Certificates node &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the www.testdataservice.com certificate and choose All Tasks – Export (Do not export the primary key) &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Exporting the private key will not cause problems but remember that the private key is for the service ALONE &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Save the certificate as TestDataService_Public.cer (Base-64 encoded X.509)&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;6) Create a WCF data service&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;In this section a basic WCF data service is created in order to secure it using mutual authentication.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="3"&gt;&lt;font size="2"&gt;In Visual Studio 2010, create a new empty solution called MyDataServices&lt;/font&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8322.image_5F00_304B3761.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5706.image_5F00_thumb_5F00_48026EC7.png" width="730" height="505" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3"&gt;&lt;font size="2"&gt;Add a new ASP.NET empty web application called MyDataService&lt;/font&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7367.image_5F00_4651A2F3.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0246.image_5F00_thumb_5F00_0BF62D12.png" width="729" height="504" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Add a new empty ADO.NET Entity Data Model item to MyDataService called MyDataServiceModel.edmx (empty model)&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0250.image_5F00_0A45613E.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5633.image_5F00_thumb_5F00_76B8019C.png" width="727" height="503" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Add a new WCF Data Service item to MyDataService called MyDataServiceImp.svc&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8360.image_5F00_6015B355.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4643.image_5F00_thumb_5F00_4C8853B4.png" width="726" height="502" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Open the code behind file for MyDataServiceImp.svc and add MyDataServiceModelContainer into the class definition&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7380.image_5F00_63D35825.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5141.image_5F00_thumb_5F00_2258A5CC.png" width="724" height="519" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Open MyDataServiceModel.edmx &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click anywhere on the screen and choose to Generate Database from Model &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Create a new data connection to SQL Server if one does not already exist &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Build the solution&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;7) Host the data service in IIS&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Open IIS manager &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Start – Administrative Tools – Internet Information Services (IIS) Manager &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Create a new website called ‘My Data Service’ &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Point the physical path to the data service created in 6) &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Choose a binding type of https and select the www.mydataservice.com SSL certificate&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7624.image_5F00_352D2976.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4555.image_5F00_thumb_5F00_0D1A7A57.png" width="507" height="499" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Modify the app pool under which the website is running so that the .NET framework version is v4.0.30319&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3482.image_5F00_76782C0F.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6153.image_5F00_thumb_5F00_5584B968.png" width="318" height="289" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Add a hosts file entry for ‘127.0.0.1 www.mydataservice.com’ &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Via Windows Explorer, give ‘Everyone’ full control of the MyDataService folder &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;N.B. – this is a shortcut for keeping the blog post succinct. Such permissions should not be an option for a production deployment&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5670.image_5F00_022D7342.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5460.image_5F00_thumb_5F00_26DE8AB9.png" width="507" height="319" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;8) Create a WCF client&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;In order to make life a little easier, we will create and configure the WCF client before locking down the service.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Add a new Console Application project called MyDataServiceClient to MyDataServices &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the project and choose to ‘Add Service Reference’ &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Enter an address of https://www.mydataservice.com/mydataserviceimp.svc &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Click Go &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Once the service has been discovered give it the namespace MyDataServiceEntities&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;9) Enable client certificate authentication in IIS&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;Both IIS and the WCF data service must be configured for client certificate authentication, otherwise there is a mismatch and a service activation failure similar to ‘&lt;i&gt;The SSL settings for the service 'SslRequireCert' does not match those of the IIS 'Ssl'&lt;/i&gt;’ will occur.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Open IIS manager &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Start – Administrative Tools – Internet Information Services (IIS) Manager &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Highlight the WCF data service website and double click ‘SSL Settings’&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3835.image_5F00_7E5FA8A4.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4186.image_5F00_thumb_5F00_348120F4.png" width="728" height="328" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3"&gt;&lt;font size="2"&gt;Configure IIS as below&lt;/font&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4011.image_5F00_3264222B.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2451.image_5F00_thumb_5F00_16DF2028.png" width="727" height="327" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;10) Register the client public key certificate with the service&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;In this section the public key certificate from 4) is registered with the data service website.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;Client certificates can be mapped in a ‘one to one’ or ‘many to one’ relationship with Windows accounts. ‘one to one’ means that a client certificate is linked to a single Windows account. ‘many to one’ means that many client certificates are assigned to a single Windows account.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;In this post we will use the ‘one to one’ relationship but the ‘many to one’ relationship does not differ greatly &lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Highlight the MyDataService website and double click ‘Configuration Editor’&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5078.image_5F00_2E2A2499.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1385.image_5F00_thumb_5F00_73627BC2.png" width="728" height="379" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3"&gt;&lt;font size="2"&gt;Choose the ‘oneToOneMappings’ section&lt;/font&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1385.image_5F00_1813933A.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8156.image_5F00_thumb_5F00_0E6B2504.png" width="728" height="279" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Click Add &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Set the entry as ‘enabled’ = true &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Set the username with associated password as that of the local administrator &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;In production this would most likely be a service account with reduced privileges &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the TestClient_Public.cer file from 4) and choose to edit in Notepad &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Ensure that the block between, but not including, ‘-----BEGIN CERTIFICATE-----‘ and ‘-----END CERTIFICATE-----‘, is all on a single line (it is not by default) &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="3"&gt;&lt;font size="2"&gt;Copy and paste the block into the ‘certificate’ field so that the resulting entry is as below&lt;/font&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8156.image_5F00_3A3B78F3.png"&gt;&lt;font size="3"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8244.image_5F00_thumb_5F00_51F2B059.png" width="730" height="389" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Close the window &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Click Apply&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;11) Mandate client certificate authentication for the data service&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The data service must also be configured to mandate client certificate authentication.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="2"&gt;In web.config, overwrite the &amp;lt;system.serviceModel&amp;gt; element with the following&lt;/font&gt;&lt;/p&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9b584e56-f0ed-49af-9e03-966260daaf85" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;bindings&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;webHttpBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;mutual&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;security&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;mode&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;Transport&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;          &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;transport&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;clientCredentialType&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;Certificate&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;security&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;webHttpBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;bindings&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;behaviors&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;behavior&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;mutual&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;webHttp&lt;/span&gt;&lt;span style="color:#0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;behavior&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;behaviors&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;serviceHostingEnvironment&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;aspNetCompatibilityEnabled&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;services&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;service&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;MyDataService.MyDataServiceImp&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;endpoint&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;contract&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;System.Data.Services.IRequestHandler&lt;/span&gt;&amp;quot;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;span style="color:#ff0000"&gt;binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;webHttpBinding&lt;/span&gt;&amp;quot;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;span style="color:#ff0000"&gt;bindingConfiguration&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;mutual&lt;/span&gt;&amp;quot;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;span style="color:#ff0000"&gt;behaviorConfiguration&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;mutual&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;endpoint&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;service&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;services&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;font size="3"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;The contents of the &amp;lt;webHttpBinding&amp;gt; element mandate that client certificate authentication at the transport level is required for the binding. The &amp;lt;services&amp;gt;/&amp;lt;service&amp;gt;/&amp;lt;endpoint&amp;gt; element describes the contract that all WCF data services must adhere to.&lt;/font&gt; &lt;/p&gt;    &lt;ul&gt;&lt;/ul&gt;    &lt;h2&gt;12) Register the service public key certificate with the client&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;As this article is concerned with mutual authentication then it is not sufficient for only the service to authenticate the client. In addition, the client must be certain that it is calling the right endpoint. One way to achieve this is to store the service public key certificate with the client so that during runtime, the SSL certificate presented by the service can be compared against the locally stored version. In this way the client can be sure that it is calling the correct SSL endpoint located at &lt;/font&gt;&lt;font size="2"&gt;www.mydataservice.com&lt;/font&gt;&lt;font size="2"&gt; and that it has not been phished into calling another endpoint with the same URL but different SSL certificate.&lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Open a snap-in window &lt;/font&gt;      &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Start – Run – mmc &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add/Remove snap-in &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Ctrl-M &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="2"&gt;Add a Certificates snap-in for ‘My user account’ &lt;/font&gt;&lt;/li&gt;       &lt;font size="2"&gt;&lt;/font&gt;&lt;/ul&gt;     &lt;font size="2"&gt;&lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Expand the (Certificates – Current User)/Personal/Certificates node &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Right click the Certificates folder and choose All Tasks – Import &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Browse to TestDataService_Public.cer that was created in 6) &lt;/font&gt;&lt;/li&gt;   &lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Click through the remaining windows and finish&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;13) Update the WCF client to verify the service certificate&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;As the service is now locked down, the client will not be able to use it without undergoing some modification. &lt;/font&gt;&lt;/p&gt; &lt;font size="2"&gt;&lt;/font&gt;  &lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;    &lt;li&gt;&lt;font size="2"&gt;Overwrite Program.cs with the following&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a82ca58d-9e0e-4d5f-8b45-5efc2fb2bdc3" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MyDataServiceClient&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Net;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Net.Security;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Security.Cryptography.X509Certificates;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; MyDataServiceEntities.&lt;span style="color:#2b91af"&gt;MyDataServiceModelContainer&lt;/span&gt; entities = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; MyDataServiceEntities.&lt;span style="color:#2b91af"&gt;MyDataServiceModelContainer&lt;/span&gt;(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515"&gt;@&amp;quot;https://www.mydataservice.com/mydataserviceimp.svc&amp;quot;&lt;/span&gt;));&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;X509Store&lt;/span&gt; store = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;X509Store&lt;/span&gt;(&lt;span style="color:#2b91af"&gt;StoreName&lt;/span&gt;.My, &lt;span style="color:#2b91af"&gt;StoreLocation&lt;/span&gt;.CurrentUser);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            store.Open(&lt;span style="color:#2b91af"&gt;OpenFlags&lt;/span&gt;.ReadOnly);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;X509Certificate2Collection&lt;/span&gt; certColl = store.Certificates.Find(&lt;span style="color:#2b91af"&gt;X509FindType&lt;/span&gt;.FindBySubjectDistinguishedName, &lt;span style="color:#a31515"&gt;&amp;quot;CN=Test Client&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            entities.ClientCertificate = certColl[0];&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            store.Close();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;ServicePointManager&lt;/span&gt;.ServerCertificateValidationCallback +=&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;delegate&lt;/span&gt;(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;X509Certificate&lt;/span&gt; cert, &lt;span style="color:#2b91af"&gt;X509Chain&lt;/span&gt; chain, &lt;span style="color:#2b91af"&gt;SslPolicyErrors&lt;/span&gt; sslError)&lt;/li&gt; &lt;li&gt;                {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                    &lt;span style="color:#008000"&gt;// Validate the certificate&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                    store = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;X509Store&lt;/span&gt;(&lt;span style="color:#2b91af"&gt;StoreName&lt;/span&gt;.My, &lt;span style="color:#2b91af"&gt;StoreLocation&lt;/span&gt;.CurrentUser);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                    store.Open(&lt;span style="color:#2b91af"&gt;OpenFlags&lt;/span&gt;.ReadOnly);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#2b91af"&gt;X509Certificate2Collection&lt;/span&gt; serverCertColl = store.Certificates.Find(&lt;span style="color:#2b91af"&gt;X509FindType&lt;/span&gt;.FindBySubjectDistinguishedName, &lt;span style="color:#a31515"&gt;&amp;quot;CN=www.mydataservice.com&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#2b91af"&gt;X509Certificate2&lt;/span&gt; serverCert = serverCertColl[0];&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                    store.Close();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#008000"&gt;// Make this as rigorous as necessary&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                    &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; serverCert.Thumbprint == (&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;X509Certificate2&lt;/span&gt;(cert)).Thumbprint;&lt;/li&gt; &lt;li&gt;                };&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Send the query to the data service context&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt;&amp;gt; result = entities.Execute&amp;lt;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt;&amp;gt;(entities.BaseUri);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine();&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515"&gt;&amp;quot;**********&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515"&gt;&amp;quot;Success!!!&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515"&gt;&amp;quot;**********&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.ReadKey();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt; &lt;li&gt;    }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;pre class="csharpcode"&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="2" face="Segoe UI"&gt;Note that the ClientCertificate property of the proxy is not recognised; this represents the last piece of the puzzle. As there is no declarative configuration for the WCF client (i.e. - no &amp;lt;system.serviceModel&amp;gt; element was created in the client config file, unlike for, say, a standard SOAP based web service), the client certificate is hooked in programmatically by intercepting the underlying HttpWebRequest instance.&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;font size="2"&gt;&lt;/font&gt;

&lt;ul&gt;&lt;font size="2"&gt;&lt;/font&gt;

  &lt;li&gt;
    &lt;pre class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;Overwrite Reference.cs contained within the MyDataServiceEntities service reference, with the following&lt;/font&gt;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1afb0026-700d-47c7-95d3-c03fdd7c5d02" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; MyDataServiceClient.MyDataServiceEntities&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;
&lt;li&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Data.Services.Client;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Net;&lt;/li&gt;
&lt;li&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Security.Cryptography.X509Certificates;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MyDataServiceModelContainer&lt;/span&gt; : &lt;span style="color:#0000ff"&gt;global&lt;/span&gt;::System.Data.Services.Client.&lt;span style="color:#2b91af"&gt;DataServiceContext&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt;
&lt;li&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af"&gt;X509Certificate&lt;/span&gt; clientCertificate = &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; MyDataServiceModelContainer(&lt;span style="color:#0000ff"&gt;global&lt;/span&gt;::System.&lt;span style="color:#2b91af"&gt;Uri&lt;/span&gt; serviceRoot) :&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;base&lt;/span&gt;(serviceRoot)&lt;/li&gt;
&lt;li&gt;        {&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.OnContextCreated();&lt;/li&gt;
&lt;li&gt;        }&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;        &lt;span style="color:#0000ff"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; OnContextCreated();&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;        &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af"&gt;X509Certificate&lt;/span&gt; ClientCertificate&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt;
&lt;li&gt;            &lt;span style="color:#0000ff"&gt;get&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt;
&lt;li&gt;                &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; clientCertificate;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            }&lt;/li&gt;
&lt;li&gt;            &lt;span style="color:#0000ff"&gt;set&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt;
&lt;li&gt;                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;value&lt;/span&gt; == &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                {&lt;/li&gt;
&lt;li&gt;                    &lt;span style="color:#008000"&gt;// if the event has been hooked up before, we should remove it&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (clientCertificate != &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;                        &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.SendingRequest -= &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.OnSendingRequest_AddCertificate;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                }&lt;/li&gt;
&lt;li&gt;                &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                {&lt;/li&gt;
&lt;li&gt;                    &lt;span style="color:#008000"&gt;// hook up the event if its being set to something non-null&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (clientCertificate == &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;                        &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.SendingRequest += &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.OnSendingRequest_AddCertificate;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                clientCertificate = &lt;span style="color:#0000ff"&gt;value&lt;/span&gt;;&lt;/li&gt;
&lt;li&gt;            }&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; OnSendingRequest_AddCertificate(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;SendingRequestEventArgs&lt;/span&gt; args)&lt;/li&gt;
&lt;li&gt;        {&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;null&lt;/span&gt; != ClientCertificate)&lt;/li&gt;
&lt;li&gt;                (args.Request &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;HttpWebRequest&lt;/span&gt;).ClientCertificates.Add(ClientCertificate);&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt;
&lt;li&gt;    }&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;ul&gt;&amp;#160; &lt;li&gt;&lt;font size="2"&gt;Set MyDataServiceClient as the startup project &lt;/font&gt;&lt;/li&gt;
  &lt;font size="2"&gt;&lt;/font&gt;

  &lt;li&gt;&lt;font size="2"&gt;Press F5&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3365.image_5F00_172B0783.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2388.image_5F00_thumb_5F00_2F4E71DE.png" width="749" height="371" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;/u&gt;&lt;/p&gt;

&lt;h1&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/h1&gt;

&lt;p&gt;&lt;font size="2"&gt;In this article I have demonstrated a methodology for securing communication between a WCF client and a IIS hosted WCF data service, installed on a workgroup server, using mutual certificate authentication. While in many ways similar to mutual authentication scenarios described elsewhere, securing a WCF data service exhibits some unique characteristics that warranted documenting.&lt;/font&gt;&lt;/p&gt;
&lt;font size="2"&gt;&lt;/font&gt;

&lt;p&gt;&lt;font size="2"&gt;I hope you find this useful.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Bradley+Cotier/default.aspx"&gt;Bradley Cotier&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10247638" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Bradley+Cotier/">Bradley Cotier</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Communication+Foundation/">Windows Communication Foundation</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Mutual+authentication/">Mutual authentication</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IIS+7-5/">IIS 7.5</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Certificate/">Certificate</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/WCF+Data+Services/">WCF Data Services</category></item><item><title>Adventures in TSQL: SQL Server Query Performance Analysis using DMVs</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/27/adventure-in-tsql-sql-server-query-performance-analysis-using-dmvs.aspx</link><pubDate>Sun, 27 Nov 2011 09:50:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241769</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10241769</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/27/adventure-in-tsql-sql-server-query-performance-analysis-using-dmvs.aspx#comments</comments><description>&lt;p&gt;From the development perspective I often have to perform an analysis of a database application. More often than not this entails looking at a running system and ensuring that the application queries are behaving as expected. As such, I thought it would be worthwhile sharing some TSQL scripts that I have been using over the years for tuning SQL Server queries. So what I am generally looking for are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Long Running Queries – which queries are taking the longest to run &lt;/li&gt;    &lt;li&gt;CPU Intensive Queries – which queries are consuming the most CPU per execution &lt;/li&gt;    &lt;li&gt;Worst Case Total CPU – which queries are consuming the most CPU across all executions &lt;/li&gt;    &lt;li&gt;Most IO Intensive Queries – which queries consume the most read/write operations &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The idea behind looking at these queries is to analyse the execution plan and review whether the query would benefit from being refactored or whether there are indexes that would enable the query to perform better.&lt;/p&gt;  &lt;p&gt;The basis of this analysis are some queries based on the SQL Server Dynamic Management Views (DMVs). For performing CPU based analysis, I have been using the following DMV based query:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:89bd3363-46c9-484f-808d-2cb6ed7e84dc" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;CPU Query&lt;/div&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#008000"&gt;-- Which Queries are taking the most time/cpu to execute&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color:#0000ff"&gt;TOP&lt;/span&gt; 20&lt;br&gt;     total_worker_time&lt;span style="color:#808080"&gt;,&lt;/span&gt; total_elapsed_time&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_worker_time&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; avg_cpu_cost&lt;span style="color:#808080"&gt;,&lt;/span&gt; execution_count&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;DB_NAME&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;dbid&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;ISNULL&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff0000"&gt;&amp;#39;..&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;OBJECT_NAME&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;objectid&lt;span style="color:#808080"&gt;),&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_sql_text&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;[sql_handle]&lt;span style="color:#808080"&gt;))&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; query_database&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;SUBSTRING&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;est&lt;span style="color:#808080"&gt;.&lt;/span&gt;[text]&lt;span style="color:#808080"&gt;,&lt;/span&gt; statement_start_offset&lt;span style="color:#808080"&gt;/&lt;/span&gt;2 &lt;span style="color:#808080"&gt;+&lt;/span&gt; 1&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#808080"&gt;&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;CASE&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHEN&lt;/span&gt; statement_end_offset &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#808080"&gt;-&lt;/span&gt;1&lt;br&gt;             &lt;span style="color:#0000ff"&gt;THEN&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;LEN&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;CONVERT&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;max&lt;/span&gt;&lt;span style="color:#808080"&gt;),&lt;/span&gt; est&lt;span style="color:#808080"&gt;.&lt;/span&gt;[text]&lt;span style="color:#808080"&gt;))&lt;/span&gt; &lt;span style="color:#808080"&gt;*&lt;/span&gt; 2&lt;br&gt;             &lt;span style="color:#0000ff"&gt;ELSE&lt;/span&gt; statement_end_offset&lt;br&gt;             &lt;span style="color:#0000ff"&gt;END&lt;/span&gt; &lt;span style="color:#808080"&gt;-&lt;/span&gt; statement_start_offset&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;/&lt;/span&gt; 2&lt;br&gt;         &lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_sql_text&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;[sql_handle]&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; est&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; query_text&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_logical_reads&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; avg_logical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_logical_writes&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; avg_logical_writes&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     last_worker_time&lt;span style="color:#808080"&gt;,&lt;/span&gt; min_worker_time&lt;span style="color:#808080"&gt;,&lt;/span&gt; max_worker_time&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     last_elapsed_time&lt;span style="color:#808080"&gt;,&lt;/span&gt; min_elapsed_time&lt;span style="color:#808080"&gt;,&lt;/span&gt; max_elapsed_time&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     plan_generation_num&lt;span style="color:#808080"&gt;,&lt;/span&gt; qp&lt;span style="color:#808080"&gt;.&lt;/span&gt;query_plan&lt;br&gt; &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_query_stats&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;OUTER&lt;/span&gt; &lt;span style="color:#808080"&gt;APPLY&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_query_plan&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;[plan_handle]&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; qp&lt;br&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; [dbid] &lt;span style="color:#808080"&gt;&amp;gt;=&lt;/span&gt; 5 &lt;span style="color:#808080"&gt;AND&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;DB_NAME&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;dbid&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;IS&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL&lt;/span&gt;&lt;br&gt;   &lt;span style="color:#808080"&gt;AND&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;total_worker_time&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;&amp;gt;&lt;/span&gt; 100&lt;br&gt; &lt;span style="color:#008000"&gt;--ORDER BY avg_cpu_cost DESC;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#008000"&gt;--ORDER BY execution_count DESC;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;ORDER&lt;/span&gt; &lt;span style="color:#0000ff"&gt;BY&lt;/span&gt; total_worker_time &lt;span style="color:#0000ff"&gt;DESC&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The basis of this query is that it shows the top 20 queries that consume the most CPU resources. The query can be modified to show queries that have consumed the most worker time or the most worker time per execution. It is also sometimes useful to see which queries have been executed the most, as you will want this to be highly performant. Just changing the ORDER BY allows one to tweak the queries one wants to analyse.&lt;/p&gt;  &lt;p&gt;This query provides 2 critical pieces of information for query analysis. Firstly the query_text is returned so one can see what has been executed. The other critical piece of information is the actual query plan. This is returned as an XML document. Having the XML is useful in itself, however the fact one can save the XML as a file with a .sqlplan extension makes this XML invaluable.&lt;/p&gt;  &lt;p&gt;Once the .sqlplan file has been saved, opening this file in SQL Server Enterprise Manager provides one with a graphical interpretation of the executed query. This enables one to easily analyse the actual query execution plan.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0385.queryplan_5F00_158C64B4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="queryplan" border="0" alt="queryplan" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6811.queryplan_5F00_thumb_5F00_29099E88.png" width="800" height="476" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The other useful, but similar query, is the one to analyse IO based metrics:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e0f21a2e-cb4a-4aaf-b889-8e7f5e767e65" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Disk IO Query&lt;/div&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color:#0000ff"&gt;TOP&lt;/span&gt; 20&lt;br&gt;     total_logical_reads&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; avg_logical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_logical_writes&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; avg_logical_writes&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_worker_time&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; avg_cpu_cost&lt;span style="color:#808080"&gt;,&lt;/span&gt; execution_count&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_worker_time&lt;span style="color:#808080"&gt;,&lt;/span&gt; total_logical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt; total_logical_writes&lt;span style="color:#808080"&gt;,&lt;/span&gt; &lt;br&gt;     &lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;DB_NAME&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;dbid&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;ISNULL&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff0000"&gt;&amp;#39;..&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;OBJECT_NAME&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;objectid&lt;span style="color:#808080"&gt;),&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_sql_text&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;[sql_handle]&lt;span style="color:#808080"&gt;))&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; query_database&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;SUBSTRING&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;est&lt;span style="color:#808080"&gt;.&lt;/span&gt;[text]&lt;span style="color:#808080"&gt;,&lt;/span&gt; statement_start_offset&lt;span style="color:#808080"&gt;/&lt;/span&gt;2 &lt;span style="color:#808080"&gt;+&lt;/span&gt; 1&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#808080"&gt;&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;CASE&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHEN&lt;/span&gt; statement_end_offset &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#808080"&gt;-&lt;/span&gt;1&lt;br&gt;             &lt;span style="color:#0000ff"&gt;THEN&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;LEN&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;CONVERT&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;max&lt;/span&gt;&lt;span style="color:#808080"&gt;),&lt;/span&gt; est&lt;span style="color:#808080"&gt;.&lt;/span&gt;[text]&lt;span style="color:#808080"&gt;))&lt;/span&gt; &lt;span style="color:#808080"&gt;*&lt;/span&gt; 2&lt;br&gt;             &lt;span style="color:#0000ff"&gt;ELSE&lt;/span&gt; statement_end_offset&lt;br&gt;             &lt;span style="color:#0000ff"&gt;END&lt;/span&gt; &lt;span style="color:#808080"&gt;-&lt;/span&gt; statement_start_offset&lt;br&gt;         &lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;/&lt;/span&gt; 2&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_sql_text&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;sql_handle&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; est&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; query_text&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     last_logical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt; min_logical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt; max_logical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     last_logical_writes&lt;span style="color:#808080"&gt;,&lt;/span&gt; min_logical_writes&lt;span style="color:#808080"&gt;,&lt;/span&gt; max_logical_writes&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     total_physical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt; last_physical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt; min_physical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt; max_physical_reads&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;total_logical_reads &lt;span style="color:#808080"&gt;+&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;total_logical_writes &lt;span style="color:#808080"&gt;*&lt;/span&gt; 5&lt;span style="color:#808080"&gt;))/&lt;/span&gt;execution_count &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; io_weighting&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     plan_generation_num&lt;span style="color:#808080"&gt;,&lt;/span&gt; qp&lt;span style="color:#808080"&gt;.&lt;/span&gt;query_plan&lt;br&gt; &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_query_stats&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;OUTER&lt;/span&gt; &lt;span style="color:#808080"&gt;APPLY&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;dm_exec_query_plan&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;[plan_handle]&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; qp&lt;br&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; [dbid] &lt;span style="color:#808080"&gt;&amp;gt;=&lt;/span&gt; 5 &lt;span style="color:#808080"&gt;AND&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;DB_NAME&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;dbid&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;IS&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL&lt;/span&gt;&lt;br&gt;   &lt;span style="color:#808080"&gt;and&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;total_worker_time&lt;span style="color:#808080"&gt;/&lt;/span&gt;execution_count&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;&amp;gt;&lt;/span&gt; 100&lt;br&gt; &lt;span style="color:#0000ff"&gt;ORDER&lt;/span&gt; &lt;span style="color:#0000ff"&gt;BY&lt;/span&gt; io_weighting &lt;span style="color:#0000ff"&gt;DESC&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#008000"&gt;--ORDER BY avg_logical_reads DESC;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#008000"&gt;--ORDER BY avg_logical_writes DESC;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#008000"&gt;--ORDER BY avg_cpu_cost DESC;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Once again one can tweak the ORDER BY to analyse queries which consume the most read or write operations. For performing a quick IO based query analysis I have found it useful to calculate the total query IO based on a weighting of reads to writes; weighted IO = (writes * weighting) + reads. In this case I have provided a weighting that assumes a read is 5 times more expensive than a write.&lt;/p&gt;  &lt;p&gt;Hope you find these DMV based queries useful, as they have held me in good stead over the years.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241769" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Performance/">Performance</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TSQL/">TSQL</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/DMV/">DMV</category></item><item><title>Creating a Partitioned View in the BAM Archiving Database</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/15/creating-a-partitioned-view-in-the-bam-archiving-database.aspx</link><pubDate>Tue, 15 Nov 2011 22:09:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10237484</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10237484</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/15/creating-a-partitioned-view-in-the-bam-archiving-database.aspx#comments</comments><description>&lt;p&gt;When you run the BAM data maintenance package (BAM_DM_&lt;em&gt;&amp;lt;activity name&amp;gt;&lt;/em&gt;) BAM copies each partition in the BAM Primary Import database to a separate table in the BAM Archive database. You can create partitioned views in the BAM Archive database to facilitate locating the data. However one is left to create these partitioned views oneself.&lt;/p&gt;  &lt;p&gt;A version of a script that can be used to create these partitioned views can be found on the MSDN site:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/aa562047.aspx" href="http://msdn.microsoft.com/en-us/library/aa562047.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa562047.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Whereas this version of the script will work when the BAM activities are first deployed, one will get issues if one modifies the BAM configuration by adding new activity items. The sample script works by creating a view that does a UNION ALL of SELECT * FROM BAM_DM_&lt;em&gt;&amp;lt;activity partition&amp;gt;&lt;/em&gt;. &lt;/p&gt;  &lt;p&gt;This works fine as long as the activity definition is unchanged, but the view falls over if a new item is added. This is because the schema of the archive partitions is no longer consistent. There are also issues for failed partitions as they are not excluded from the partitioned view.&lt;/p&gt;  &lt;p&gt;However, one can easily resolve this issue by using explicit column names. As activities are augmented with new items the base table definition in the BAM Archive database is modified such that it represents the full items list for the activity. Using this one is able to determine the columns required for the partitioned view. &lt;/p&gt;  &lt;p&gt;Thus when creating a column list for an archived partition one has to determine one can match the columns with those needed for the view. If a column is not present in a partitioned table then the column definition is modified to be:&lt;/p&gt;  &lt;p&gt;NULL AS [column_name]&lt;/p&gt;  &lt;p&gt;This ensures consistency for all SELECT statements that make up the partitioned view.&lt;/p&gt;  &lt;p&gt;Here is a full listing of a stored procedure one can use to create a new partitioned view:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d49da80a-d2f3-413d-9440-4f2b02921f3e" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;USE&lt;/span&gt; [BAMArchive]&lt;br&gt; &lt;span style="color:#0000ff"&gt;GO&lt;/span&gt;&lt;br&gt; &lt;br&gt; &lt;span style="color:#0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color:#0000ff"&gt;PROCEDURE&lt;/span&gt; [dbo]&lt;span style="color:#808080"&gt;.&lt;/span&gt;[CreateBamActivityView]&lt;br&gt; &lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;br&gt;     @activityName        &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;64&lt;span style="color:#808080"&gt;),&lt;/span&gt;&lt;br&gt;     @viewType            &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;64&lt;span style="color:#808080"&gt;)    &lt;/span&gt;&lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;Instances&amp;#39;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; &lt;span style="color:#0000ff"&gt;NOCOUNT&lt;/span&gt; &lt;span style="color:#0000ff"&gt;ON&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;    &lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @partitionName  &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @tableName      &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @viewName       &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @templateName   &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @columnNames    &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;max&lt;/span&gt;&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @schema         &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;12&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @isFirstTable   &lt;span style="color:#0000ff"&gt;bit&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @dropScript        &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;max&lt;/span&gt;&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @createScript    &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;max&lt;/span&gt;&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @newLine        &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;12&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @likeData        &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @likeDefault    &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @likeFailed        &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @likeUsage        &lt;span style="color:#0000ff"&gt;nvarchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @newLine &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff"&gt;CHAR&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;13&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#0000ff"&gt;CHAR&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;10&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;dbo&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @templateName &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;bam_&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @activityName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;_&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @viewType&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @viewName &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;[&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;].[bam_&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @activityName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;_&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @viewType &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;View]&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @likeDefault &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;bam[_]&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @activityName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;[_]&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @viewType&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @likeData &lt;span style="color:#808080"&gt;=&lt;/span&gt;  @likeDefault &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;[_]%&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @likeFailed &lt;span style="color:#808080"&gt;=&lt;/span&gt; @likeDefault &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;[_]%[_]Failed&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;-- Define a table of the expected columns based on the table template&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @activityColumns &lt;span style="color:#0000ff"&gt;TABLE &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;activity_columnname &lt;span style="color:#0000ff"&gt;varchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;256&lt;span style="color:#808080"&gt;));&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;INSERT&lt;/span&gt; &lt;span style="color:#0000ff"&gt;INTO&lt;/span&gt; @activityColumns&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; [COLUMN_NAME] &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;INFORMATION_SCHEMA&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;COLUMNS&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; TABLE_SCHEMA &lt;span style="color:#808080"&gt;=&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;AND&lt;/span&gt; TABLE_NAME &lt;span style="color:#808080"&gt;=&lt;/span&gt; @templateName&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;-- See if activity has data otherwise create default view&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;IF&lt;/span&gt; &lt;span style="color:#808080"&gt;EXISTS(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; 1 &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;sysobjects&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; [name] &lt;span style="color:#808080"&gt;LIKE&lt;/span&gt; @likeData &lt;span style="color:#808080"&gt;AND&lt;/span&gt; [name] &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;LIKE&lt;/span&gt; @likeFailed &lt;span style="color:#808080"&gt;AND&lt;/span&gt; [type] &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;U&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @likeUsage &lt;span style="color:#808080"&gt;=&lt;/span&gt; @likeData&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;ELSE&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @likeUsage &lt;span style="color:#808080"&gt;=&lt;/span&gt; @likeDefault&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @isFirstTable &lt;span style="color:#808080"&gt;=&lt;/span&gt; 1&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @dropScript &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @viewName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;&amp;#39;&amp;#39;))&amp;#39;&lt;/span&gt; &lt;br&gt;         &lt;span style="color:#808080"&gt;+&lt;/span&gt; @newLine &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;    DROP VIEW &amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @viewName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;-- Define a cursor to iterate through created table&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; instance_cursor &lt;span style="color:#0000ff"&gt;CURSOR&lt;/span&gt; &lt;span style="color:#0000ff"&gt;LOCAL&lt;/span&gt; &lt;span style="color:#0000ff"&gt;FOR&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; [name] &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;sys&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;sysobjects&lt;/span&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; [name] &lt;span style="color:#808080"&gt;LIKE&lt;/span&gt; @likeUsage &lt;span style="color:#808080"&gt;AND&lt;/span&gt; [name] &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;LIKE&lt;/span&gt; @likeFailed &lt;span style="color:#808080"&gt;AND&lt;/span&gt; [type] &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;U&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;OPEN&lt;/span&gt; instance_cursor&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FETCH&lt;/span&gt; &lt;span style="color:#0000ff"&gt;NEXT&lt;/span&gt; &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; instance_cursor &lt;span style="color:#0000ff"&gt;INTO&lt;/span&gt; @partitionName&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;WHILE&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;@@fetch_status&lt;/span&gt; &lt;span style="color:#808080"&gt;=&lt;/span&gt; 0 &lt;br&gt;     &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;IF &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@partitionName &lt;span style="color:#808080"&gt;IS&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL)&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @tableName &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;[&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;].[&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @partitionName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;]&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;         &lt;br&gt;             &lt;span style="color:#0000ff"&gt;IF &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@isFirstTable &lt;span style="color:#808080"&gt;=&lt;/span&gt; 1&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;CREATE VIEW &amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt;  @viewName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39; AS &amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @newLine&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @isFirstTable &lt;span style="color:#808080"&gt;=&lt;/span&gt; 0&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;ELSE&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;=&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;+&lt;/span&gt; @newLine &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;    UNION ALL&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @newLine&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;br&gt; &lt;br&gt;             &lt;span style="color:#008000"&gt;-- Calculate the column defintions based on the working partition&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;=&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;+&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;CASE&lt;/span&gt;&lt;br&gt;                     &lt;span style="color:#0000ff"&gt;WHEN &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; COLUMN_NAME &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;INFORMATION_SCHEMA&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;COLUMNS&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; TABLE_SCHEMA &lt;span style="color:#808080"&gt;=&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;AND&lt;/span&gt; TABLE_NAME &lt;span style="color:#808080"&gt;=&lt;/span&gt; @partitionName &lt;span style="color:#808080"&gt;AND&lt;/span&gt; COLUMN_NAME &lt;span style="color:#808080"&gt;=&lt;/span&gt; activity_columnname&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;IS&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL&lt;/span&gt; &lt;span style="color:#0000ff"&gt;THEN&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;[&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;RTRIM&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;activity_columnname&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;]&amp;#39;&lt;/span&gt;&lt;br&gt;                     &lt;span style="color:#0000ff"&gt;ELSE&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;NULL AS [&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;RTRIM&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;activity_columnname&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;]&amp;#39;&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;END&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; @activityColumns&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;OPTION &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;FAST&lt;/span&gt; 1&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt; &lt;br&gt;             &lt;span style="color:#0000ff"&gt;IF &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;LEN&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@columnNames&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;&amp;gt;&lt;/span&gt; 0&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;SUBSTRING&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@columnNames&lt;span style="color:#808080"&gt;,&lt;/span&gt; 1&lt;span style="color:#808080"&gt;,&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;LEN&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@columnNames&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;-&lt;/span&gt;1&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;             &lt;br&gt;             &lt;span style="color:#008000"&gt;-- Add the table into the view definition&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;=&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;N&amp;#39;    SELECT &amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39; FROM &amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; @tableName &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39; WITH (NOLOCK)&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;span style="color:#808080"&gt;;        &lt;/span&gt;&lt;br&gt; &lt;br&gt;         &lt;span style="color:#0000ff"&gt;FETCH&lt;/span&gt; &lt;span style="color:#0000ff"&gt;NEXT&lt;/span&gt; &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; instance_cursor &lt;span style="color:#0000ff"&gt;INTO&lt;/span&gt; @partitionName&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;IF &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@createScript &lt;span style="color:#808080"&gt;IS&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL)&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;=&lt;/span&gt; @createScript &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;CLOSE&lt;/span&gt; instance_cursor&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;DEALLOCATE&lt;/span&gt; instance_cursor&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;-- Display commands to be executed&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;PRINT&lt;/span&gt; @dropScript&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;PRINT&lt;/span&gt; @newLine&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;PRINT&lt;/span&gt; @createScript&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;-- Execute the creation&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;EXEC&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@dropScript&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;IF &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@createScript &lt;span style="color:#808080"&gt;IS&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL)&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;BEGIN&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;EXEC&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@createScript&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt;         &lt;br&gt; &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;GO&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;To create a new partitioned view for an activity one merely has to call the stored procedure with the activity name:&lt;/p&gt;  &lt;p&gt;Consider a simple activity definition for Audit:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1984da89-87a4-41b7-982e-882019d0464b" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color:#0000ff"&gt;TABLE&lt;/span&gt; [dbo]&lt;span style="color:#808080"&gt;.&lt;/span&gt;[bam_Audit_Instances]&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;br&gt;     [RecordID] [bigint] &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [ActivityID] [nvarchar]&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;NOT&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [Audited] [datetime] &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [AuditReference] [nvarchar]&lt;span style="color:#808080"&gt;(&lt;/span&gt;38&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [AuditAction] [nvarchar]&lt;span style="color:#808080"&gt;(&lt;/span&gt;50&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [Caller] [nvarchar]&lt;span style="color:#808080"&gt;(&lt;/span&gt;50&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [AuditPreChange] [nvarchar]&lt;span style="color:#808080"&gt;(&lt;/span&gt;1000&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [AuditPostChange] [nvarchar]&lt;span style="color:#808080"&gt;(&lt;/span&gt;1000&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     [LastModified] [datetime] &lt;span style="color:#808080"&gt;NULL,&lt;/span&gt;&lt;br&gt;     &lt;br&gt;     &lt;span style="color:#0000ff"&gt;PRIMARY&lt;/span&gt; &lt;span style="color:#0000ff"&gt;KEY&lt;/span&gt; &lt;span style="color:#0000ff"&gt;CLUSTERED&lt;/span&gt; &lt;br&gt;     &lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;br&gt;         [RecordID] &lt;span style="color:#0000ff"&gt;ASC&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;    &lt;p&gt;A partitioned view could be created for the activity using:&lt;/p&gt;  &lt;p&gt;EXEC dbo.CreateBamActivityView 'Audit'&lt;/p&gt;  &lt;p&gt;If the activity was changed over time, with the addition of the pre and post change columns, the view that would be created would be:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:bbbdf43a-9659-40b6-96ea-36b3618fed34" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; [RecordID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [ActivityID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Audited]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditReference]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditAction]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Caller]&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     [AuditPreChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditPostChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [LastModified]&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; [dbo]&lt;span style="color:#808080"&gt;.&lt;/span&gt;[bam_Audit_Instances_20111111] &lt;span style="color:#0000ff"&gt;WITH &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;NOLOCK&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;UNION&lt;/span&gt; &lt;span style="color:#808080"&gt;ALL&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; [RecordID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [ActivityID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Audited]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditReference]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditAction]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Caller]&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     [AuditPreChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditPostChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [LastModified]&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; [dbo]&lt;span style="color:#808080"&gt;.&lt;/span&gt;[bam_Audit_Instances_20111112] &lt;span style="color:#0000ff"&gt;WITH &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;NOLOCK&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;UNION&lt;/span&gt; &lt;span style="color:#808080"&gt;ALL&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; [RecordID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [ActivityID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Audited]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditReference]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditAction]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Caller]&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;NULL&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; [AuditPreChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; [AuditPostChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [LastModified]&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; [dbo]&lt;span style="color:#808080"&gt;.&lt;/span&gt;[bam_Audit_Instances_20111012] &lt;span style="color:#0000ff"&gt;WITH &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;NOLOCK&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;UNION&lt;/span&gt; &lt;span style="color:#808080"&gt;ALL&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; [RecordID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [ActivityID]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Audited]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditReference]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [AuditAction]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [Caller]&lt;span style="color:#808080"&gt;,&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#808080"&gt;NULL&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; [AuditPreChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; &lt;span style="color:#808080"&gt;NULL&lt;/span&gt; &lt;span style="color:#0000ff"&gt;AS&lt;/span&gt; [AuditPostChange]&lt;span style="color:#808080"&gt;,&lt;/span&gt; [LastModified]&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; [dbo]&lt;span style="color:#808080"&gt;.&lt;/span&gt;[bam_Audit_Instances_20111011] &lt;span style="color:#0000ff"&gt;WITH &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;NOLOCK&lt;/span&gt;&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;To use the stored procedure that creates this view one merely has to schedule the procedures execution after each archive run.&lt;/p&gt;  &lt;p&gt;Hope you find this useful.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10237484" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/BizTalk/">BizTalk</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TSQL/">TSQL</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Partitioned+View/">Partitioned View</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/BAM/">BAM</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/BAM+Archive/">BAM Archive</category></item><item><title>Adventures in TSQL: Comma separated string from column values</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/04/adventures-in-tsql-comma-separated-string-from-column-values.aspx</link><pubDate>Fri, 04 Nov 2011 10:42:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10233931</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10233931</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/04/adventures-in-tsql-comma-separated-string-from-column-values.aspx#comments</comments><description>&lt;p&gt;It seems that several times now I have had the requirement to create a comma separated string from column values. The latest reason for doing this was to build up a list of table column names such that a view could be generated for the table.&lt;/p&gt;  &lt;p&gt;This is surprisingly easy to do in TSQL. One merely has to define a varchar variable and build up the comma separated string from within a SELECT statement; as this sample demonstrates:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c598142b-a7f8-4205-be52-052e7f75517b" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;USE&lt;/span&gt; [AdventureWorks]&lt;br&gt; &lt;span style="color:#0000ff"&gt;GO&lt;/span&gt;&lt;br&gt; &lt;br&gt; &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @schema &lt;span style="color:#0000ff"&gt;varchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;Sales&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @tableName &lt;span style="color:#0000ff"&gt;varchar &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;128&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;SalesOrderHeader&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt; &lt;span style="color:#0000ff"&gt;DECLARE&lt;/span&gt; @columnNames &lt;span style="color:#0000ff"&gt;varchar&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;max&lt;/span&gt;&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="color:#808080"&gt;;&lt;/span&gt;&lt;br&gt; &lt;br&gt; &lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;=&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;[&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; COLUMN_NAME &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;], &amp;#39;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;INFORMATION_SCHEMA&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;COLUMNS&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; TABLE_SCHEMA &lt;span style="color:#808080"&gt;=&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;AND&lt;/span&gt; TABLE_NAME &lt;span style="color:#808080"&gt;=&lt;/span&gt; @tableName&lt;br&gt;     &lt;span style="color:#0000ff"&gt;OPTION &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;FAST&lt;/span&gt; 1&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt;     &lt;br&gt; &lt;span style="color:#0000ff"&gt;IF &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#ff00ff"&gt;LEN&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@columnNames&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;&amp;gt;&lt;/span&gt; 0&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#0000ff"&gt;SET&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;SUBSTRING&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@columnNames&lt;span style="color:#808080"&gt;,&lt;/span&gt; 1&lt;span style="color:#808080"&gt;,&lt;/span&gt; &lt;span style="color:#ff00ff"&gt;LEN&lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;@columnNames&lt;span style="color:#808080"&gt;)&lt;/span&gt; &lt;span style="color:#808080"&gt;-&lt;/span&gt;1&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;br&gt; &lt;br&gt; &lt;span style="color:#0000ff"&gt;PRINT&lt;/span&gt; @columnNames&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The output from this is the @columnNames variable is:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Consolas"&gt;[SalesOrderID], [RevisionNumber], [OrderDate], [DueDate], [ShipDate], [Status], [OnlineOrderFlag], [SalesOrderNumber], [PurchaseOrderNumber], [AccountNumber], [CustomerID], [ContactID], [SalesPersonID], [TerritoryID], [BillToAddressID], [ShipToAddressID], [ShipMethodID], [CreditCardID], [CreditCardApprovalCode], [CurrencyRateID], [SubTotal], [TaxAmt], [Freight], [TotalDue], [Comment], [rowguid], [ModifiedDate]&lt;/font&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;The logic for this can even get more complicated where only certain values from the table are selected for inclusion in the comma separated string.&lt;/p&gt;  &lt;p&gt;In the case of the AdventureWorks database many tables have a column named “rowguid”. If one wanted to exclude this from the list one would write:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:554b7491-9c8d-4fdd-99ff-01c12d14101c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;SELECT&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;=&lt;/span&gt; @columnNames &lt;span style="color:#808080"&gt;+&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;CASE&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;WHEN&lt;/span&gt; COLUMN_NAME &lt;span style="color:#808080"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;rowguid&amp;#39;&lt;/span&gt; &lt;span style="color:#0000ff"&gt;THEN&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;ELSE&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;[&amp;#39;&lt;/span&gt; &lt;span style="color:#808080"&gt;+&lt;/span&gt; COLUMN_NAME &lt;span style="color:#808080"&gt;+&lt;/span&gt; &lt;span style="color:#ff0000"&gt;&amp;#39;], &amp;#39;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;END&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;FROM&lt;/span&gt; &lt;span style="color:#008000"&gt;INFORMATION_SCHEMA&lt;/span&gt;&lt;span style="color:#808080"&gt;.&lt;/span&gt;&lt;span style="color:#008000"&gt;COLUMNS&lt;/span&gt; &lt;span style="color:#0000ff"&gt;WHERE&lt;/span&gt; TABLE_SCHEMA &lt;span style="color:#808080"&gt;=&lt;/span&gt; @schema &lt;span style="color:#808080"&gt;AND&lt;/span&gt; TABLE_NAME &lt;span style="color:#808080"&gt;=&lt;/span&gt; @tableName&lt;br&gt;     &lt;span style="color:#0000ff"&gt;OPTION &lt;/span&gt;&lt;span style="color:#808080"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff"&gt;FAST&lt;/span&gt; 1&lt;span style="color:#808080"&gt;);&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The ability to define a variable value in this fashion is not well known, but nevertheless a useful feature.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10233931" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TSQL/">TSQL</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/String/">String</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Comma+Seperated+String/">Comma Seperated String</category></item><item><title>Preventing Build Hangs and File Locking on Build Servers When Running Unit Tests (revised)</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/02/preventing-build-hangs-and-file-locking-on-build-servers-when-running-unit-tests-revised.aspx</link><pubDate>Wed, 02 Nov 2011 21:02:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10232768</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10232768</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/02/preventing-build-hangs-and-file-locking-on-build-servers-when-running-unit-tests-revised.aspx#comments</comments><description>&lt;div class="ExternalClass3E64F1DD8AE241E8A176A7F10BF322C0"&gt;   &lt;p&gt;Recently I was tasked with changing our daily and Continuous Integration builds so that they would also execute our unit tests. This seemed like a straightforward task, and indeed it was. Except for one thing: every so often a build would fail because another process was locking the test results directory.&lt;/p&gt;    &lt;p&gt;When we looked at the build server we saw a number of instances of a process called DW20 running on the server. This process was locking the test results directory. Terminating these processes allowed further builds that included unit tests to run.&lt;/p&gt;    &lt;p&gt;DW20 is the Windows Error Reporting program. What was happening was that Windows Error Reporting was asking for permission to send error reports to Microsoft, and waiting for a response from a user. Being on a server this was never going to happen, especially as the prompt could not be seen!&lt;/p&gt;    &lt;p&gt;So, two questions needed to be addressed. The first was to find out what was causing the errors that were triggering Windows Error Reporting in the first place, and the second was to see if there was a way to stop DW20 waiting for a prompt when there was an error.&lt;/p&gt;    &lt;p&gt;The easiest one to solve was to prevent DW20 waiting and locking the test results directory. On Windows Server 2008 you can configure Windows Error Reporting to not wait for input from the user. To find it, run Server Manager and then click on Turn on Windows Error Reporting (you may need to scroll down to find it). As you can see from the screenshot below, on our build server it was configured to ask about sending reports every time there is an error. Choose either the first or the last option to be sure that DW20 will not wait and lock your test results directory.&lt;/p&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8883.image3_5F00_59173FB31_5F00_4E979206.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image3_59173FB3[1]" border="0" alt="image3_59173FB3[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8816.image3_5F00_59173FB31_5F00_thumb_5F00_385150E7.png" width="600" height="487" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;On Windows Server 2003 you get to a similar setting through the System applet in Control Panel, as shown in the screenshot below (with thanks to Jean-Pierre de Tiege from Charteris):&lt;/p&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6036.image_5F00_4_5F00_6736426E1_5F00_79BBDD73.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image_4_6736426E[1]" border="0" alt="image_4_6736426E[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8816.image_5F00_4_5F00_6736426E1_5F00_thumb_5F00_3E77DBDB.png" width="600" height="671" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;The other problem was to work out why we were getting these errors in the first place. For this I used the Windows Sysinternals &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653" target="_blank"&gt;Process Explorer&lt;/a&gt; tool. Using this I hovered the mouse over the DW20 processes, this showed me the command line parameter that was being passed to each DW20 process. This pointed me to a file in a temporary directory which contained the following:&lt;/p&gt;    &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;       &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Version=131072&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;General_AppName=QTAgent32.exe&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;EventType=VSTEExecutionFrameworkUE&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;LoggingFlags=0&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;UIFlags=1&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;EventLogSource=Team Test Error Reporting&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;UI LCID=127&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P1=QTAgent32.exe&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P2=v2.0.50727&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P3=10.0.0.0&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P4=Unknown&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P5=ArgumentNullException&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P6=27F84F9B&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;FilesToDelete=C:\Users\build\AppData\&lt;span style="color: #0000ff"&gt;Local&lt;/span&gt;\Temp\tmp7C26.tmp|C:\Users\build\AppData\&lt;span style="color: #0000ff"&gt;Local&lt;/span&gt;\Temp\tmp7C29.tmp|C:\Users\build\AppData\&lt;span style="color: #0000ff"&gt;Local&lt;/span&gt;\Temp\tmp7C3A.tmp&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;ReportingFlags=15&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Intro_Bold=An unexpected condition has occurred.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Intro_Reg=An unexpected condition has occurred &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; the test execution framework. Information about the condition has been gathered.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Plea_Bold=Please tell Microsoft about this problem.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Plea_Reg=We have created an error report that you can send &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; help us fix bugs. We will treat this report as confidential and anonymous.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Queued_EventDescription=An exception has occurred &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; the test execution framework component: Value cannot be null.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Parameter name: certificateFindKey&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;The important thing to note in this file is that the process which crashed, was running QTAgent32.exe. This is the test runner used by the &lt;a href="http://msdn.microsoft.com/en-us/library/aa721750.aspx" target="_blank"&gt;TestToolsTask&lt;/a&gt; task to run unit tests on the build server without requiring Visual Studio to be installed.&lt;/p&gt;

  &lt;p&gt;This immediately reminded me that two of the unit tests were failing with an “Error” state rather than the more usual “Failed” state. When the test runner reports an Error state for a test it means that the test caused an error in the test runner itself. The most common reason I have seen for this is in tests that use threads, and indeed in this case the problem tests were using threads. Removing those tests stopped the QTAgent32 errors from happening in the first place.&lt;/p&gt;

  &lt;p&gt;So, the conclusion is simple.&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;Watch out for unit tests which fail with an Error state, an fix them as a matter of urgency. &lt;/li&gt;

    &lt;li&gt;Make sure that on &lt;strong&gt;all&lt;/strong&gt; of your build servers Windows Error Reporting is not configured to prompt. &lt;/li&gt;
  &lt;/ol&gt;

  &lt;p&gt;I hope this has been useful and helps you to avoid problems running unit tests as part of your daily and Continuous Integration builds.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Rob+Jarratt/default.aspx"&gt;Rob Jarratt&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10232768" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TFS/">TFS</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Rob+Jarratt/">Rob Jarratt</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Team+Build/">Team Build</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/QTAgent32/">QTAgent32</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/DW20/">DW20</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Error+Reporting/">Windows Error Reporting</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Unit+Tests/">Unit Tests</category></item><item><title>FSharpChart release supporting Stacked Charts and Markers (version 0.60)</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/01/fsharpchart-release-supporting-stacked-charts-and-markers-version-0-60.aspx</link><pubDate>Tue, 01 Nov 2011 22:19:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10232257</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10232257</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/01/fsharpchart-release-supporting-stacked-charts-and-markers-version-0-60.aspx#comments</comments><description>&lt;p&gt;FSharpChart now supports binding for Stacked Charts and for modifying the Marker associated with a series. &lt;/p&gt;  &lt;p&gt;As always one can download the latest release from:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/FSharpChart-b59073f5" href="http://code.msdn.microsoft.com/FSharpChart-b59073f5"&gt;http://code.msdn.microsoft.com/FSharpChart-b59073f5&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In previous versions of FSharpChart it was not very intuitive how a Stacked Chart could be plotted. What one had to do was define a CombinedChart where one defines the charts to be combined with the same StackedGroupName property value:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ae7b19ed-e526-4693-8c6d-dc388d11dc39" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; rndStacked = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; System.Random()&lt;br&gt; &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; dataX() = [ &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; f &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 1 .. 10 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; rndStacked.NextDouble() * 10.0]&lt;br&gt; &lt;br&gt; FSharpChart.Combine&lt;br&gt;   [ FSharpChart.StackedBar100(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g1&amp;quot;&lt;/span&gt;)&lt;br&gt;     FSharpChart.StackedBar100(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g1&amp;quot;&lt;/span&gt;)&lt;br&gt;     FSharpChart.StackedBar100(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g1&amp;quot;&lt;/span&gt;) ]&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This displays the following chart:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5280.image_5F00_269DE499.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4201.image_5F00_thumb_5F00_1C89436E.png" width="504" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;(Thanks to Tomas Petricek for this sample)&lt;/p&gt;  &lt;p&gt;This approach also allows one to easily combine multiple Stacked Charts using different StackedGroupName properties:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a6cc26c8-a501-4160-8514-f2c382c2971c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;FSharpChart.Combine&lt;br&gt;   [ FSharpChart.StackedBar(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g1&amp;quot;&lt;/span&gt;)&lt;br&gt;     FSharpChart.StackedBar(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g1&amp;quot;&lt;/span&gt;)&lt;br&gt;     FSharpChart.StackedBar(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g1&amp;quot;&lt;/span&gt;)&lt;br&gt;     FSharpChart.StackedBar(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g2&amp;quot;&lt;/span&gt;)&lt;br&gt;     FSharpChart.StackedBar(dataX(), StackedGroupName = &lt;span style="color:#800000"&gt;&amp;quot;g2&amp;quot;&lt;/span&gt;) ]&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This displays the following chart:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3542.image_5F00_074B17F9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6366.image_5F00_thumb_5F00_43B366D6.png" width="504" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;However, for Stacked Charts, a more intuitive approach would be just to specify a list of data series. With this new release one can now specify the data series using the following formats:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:89ff4fba-7874-4f00-a71f-eaaa05e3336a" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px;"&gt;list&amp;lt;list&amp;lt;&amp;#39;TY&amp;gt;&amp;gt;&lt;br&gt; list&amp;lt;list&amp;lt;&amp;#39;TX * &amp;#39;TY&amp;gt;&amp;gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This now allows one to define, say a StackedColumn chart, using the much simpler expression:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d6c25308-03d2-411f-a051-6a8964e28a5a" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; rndStacked = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; System.Random()&lt;br&gt; &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; dataXY() = [ &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; f &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 1 .. 10 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; (f, round (rndStacked.NextDouble() * 100.0))]&lt;br&gt; &lt;br&gt; [dataXY(); dataXY(); dataXY()]&lt;br&gt; |&amp;gt; FSharpChart.StackedColumn&lt;br&gt; |&amp;gt; FSharpChart.WithSeries.DataPoint(Label=&lt;span style="color:#800000"&gt;&amp;quot;#VAL&amp;quot;&lt;/span&gt;)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This displays the following chart:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3146.image_5F00_1983B8EE.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1376.image_5F00_thumb_5F00_55EC07CB.png" width="504" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Hopefully you will agree this is much simpler and more intuitive. The only current limitation of this binding approach is that one cannot use a CombinedChart for multiple Stacked Charts when binding in this fashion. If this is the desire then the previous approach with distinct StackedGroupName properties is needed.&lt;/p&gt;  &lt;p&gt;The download also includes a new WinForms sample demonstrating how bindings can be managed for these Stacked Charts.&lt;/p&gt;  &lt;p&gt;thanks to a community suggestion I have also added support for modifying the Marker associated with a series. To modify the Marker for a Data Series one can now write:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5d846257-6ca6-45f5-afb7-4907881379c1" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;[ &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 1. .. 20. .. 1000.0 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; i, rnd.NextDouble() ]&lt;br&gt; |&amp;gt; FSharpChart.Line&lt;br&gt; |&amp;gt; FSharpChart.WithSeries.Marker(Color=Color.Red, Style=MarkerStyle.Cross)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Again, this displays the chart:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4617.image9_5F00_2092CF99.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8321.image9_5F00_thumb_5F00_3FA5C6AC.png" width="504" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Don’t forget the package is also available from NuGet:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.nuget.org/List/Packages/MSDN.FSharpChart.dll"&gt;http://www.nuget.org/List/Packages/MSDN.FSharpChart.dll&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Once again enjoy!&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10232257" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Forms/">Windows Forms</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharpChart/">FSharpChart</category></item><item><title>String extension methods rather than using RegEx</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/10/19/string-extension-methods-rather-than-using-regex.aspx</link><pubDate>Wed, 19 Oct 2011 20:31:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10227777</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10227777</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/10/19/string-extension-methods-rather-than-using-regex.aspx#comments</comments><description>&lt;p&gt;In a recent project I was using regular expressions a lot for validating string expressions such that statements like the following were true:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Must be all characters &lt;/li&gt;    &lt;li&gt;Must be all alphanumeric’s and be of length 6 &lt;/li&gt;    &lt;li&gt;Must be all numeric digits (e.g. “3648”) &lt;/li&gt;    &lt;li&gt;Must be all upper case characters &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;However in reflection the char data type checks, such as IsDigit(), along with extension methods offer an alternative implementation. What I wanted to write was validations such as:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ec25e08c-9237-4a6d-b484-607318e6c14f" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;mystring.IsAllLetterOrDigit();&lt;br&gt; mystring.IsAllLetter(3);&lt;br&gt; mystring.IsAllLower();&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The implementation to support such expressions is:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f8d9cf1a-e777-4914-b33e-5710c4a08eb8" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters are letters.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllLetter(&lt;span style="color:#0000ff"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, [&lt;span style="color:#2b91af"&gt;Optional&lt;/span&gt;] &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; IsAllValidation(value, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;.IsLetter, length);&lt;br&gt; }&lt;br&gt; &lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters are digits.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllDigit(&lt;span style="color:#0000ff"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, [&lt;span style="color:#2b91af"&gt;Optional&lt;/span&gt;] &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; IsAllValidation(value, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;.IsDigit, length);&lt;br&gt; }&lt;br&gt; &lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters are letters or digits.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllLetterOrDigit(&lt;span style="color:#0000ff"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, [&lt;span style="color:#2b91af"&gt;Optional&lt;/span&gt;] &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; IsAllValidation(value, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;.IsLetterOrDigit, length);&lt;br&gt; }&lt;br&gt; &lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters are numbers.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllNumber(&lt;span style="color:#0000ff"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, [&lt;span style="color:#2b91af"&gt;Optional&lt;/span&gt;] &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; IsAllValidation(value, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;.IsNumber, length);&lt;br&gt; }&lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters are lower characters.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllLower(&lt;span style="color:#0000ff"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, [&lt;span style="color:#2b91af"&gt;Optional&lt;/span&gt;] &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; IsAllValidation(value, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;.IsLower, length);&lt;br&gt; }&lt;br&gt; &lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters are upper characters.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllUpper(&lt;span style="color:#0000ff"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, [&lt;span style="color:#2b91af"&gt;Optional&lt;/span&gt;] &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; IsAllValidation(value, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;.IsUpper, length);&lt;br&gt; }&lt;br&gt; &lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; Determines if all characters in a string satisfy the character check.&lt;/span&gt;&lt;br&gt; &lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#008000"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsAllValidation(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; value, &lt;span style="color:#2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;char&lt;/span&gt;, &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt;&amp;gt; charFunc, &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; length)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#008000"&gt;// Check have values&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (length &amp;lt; 0) &lt;span style="color:#0000ff"&gt;throw&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;ArgumentOutOfRangeException&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;Length must be positive.&amp;quot;&lt;/span&gt;);&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// Check have more than whitespace&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;.IsNullOrWhiteSpace(value)) &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// Check all string characters satisfy condition&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (!value.All&amp;lt;&lt;span style="color:#0000ff"&gt;char&lt;/span&gt;&amp;gt;(charFunc)) &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;br&gt;     &lt;br&gt;     &lt;span style="color:#008000"&gt;// If neccessary check strign length&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (length &amp;gt; 0 &amp;amp;&amp;amp; value.Length != length) &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;;&lt;br&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This provides a variety of checks all based on the char IsXXX() methods.&lt;/p&gt;  &lt;p&gt;The IsAllValidation() is the actual implementation for all extension methods. As a parameter it takes the char based method for which each char in the string is to be checked. This works based on the fact that the String Type supports&amp;#160; IEnumerable of Type Char. We can then use the LINQ All&amp;lt;char&amp;gt;() method to ensure that each char in the string satisfies the required condition.&lt;/p&gt;  &lt;p&gt;The length check is an optional check specified using the Optional Attribute on the length parameter. If a value greater than zero is specified then the string is also validated to ensure it has the specified length.&lt;/p&gt;  &lt;p&gt;As you can see, with a small amount of code one can very easily extend char methods to support checking each char in a string.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10227777" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/LINQ/">LINQ</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/C_2300_/">C#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IEnumerable/">IEnumerable</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Extension+Methods/">Extension Methods</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Char/">Char</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/String/">String</category></item><item><title>Preventing Build Hangs and File Locking on Build Servers When Running Unit Tests</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/10/12/preventing-build-hangs-and-file-locking-on-build-servers-when-running-unit-tests.aspx</link><pubDate>Wed, 12 Oct 2011 13:07:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10223890</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10223890</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/10/12/preventing-build-hangs-and-file-locking-on-build-servers-when-running-unit-tests.aspx#comments</comments><description>&lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;&lt;strong&gt;Note&lt;/strong&gt; : An updated version of this post can be found &lt;a href="http://blogs.msdn.com/b/mcsuksoldev/archive/2011/11/02/preventing-build-hangs-and-file-locking-on-build-servers-when-running-unit-tests-revised.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;Recently I was tasked with changing our daily and Continuous Integration builds so that they would also execute our unit tests. This seemed like a straightforward task, and indeed it was. Except for one thing: every so often a build would fail because another process was locking the test results directory.&lt;/p&gt;  &lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;When we looked at the build server we saw a number of instances of a process called DW20 running on the server. This process was locking the test results directory. Terminating these processes allowed further builds that included unit tests to run.&lt;/p&gt;  &lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;DW20 is the Windows Error Reporting program. What was happening was that Windows Error Reporting was asking for permission to send error reports to Microsoft, and waiting for a response from a user. Being on a server this was never going to happen, especially as the prompt could not be seen!&lt;/p&gt;  &lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;So, two questions needed to be addressed. The first was to find out what was causing the errors that were triggering Windows Error Reporting in the first place, and the second was to see if there was a way to stop DW20 waiting for a prompt when there was an error.&lt;/p&gt;  &lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;The easiest one to solve was to prevent DW20 waiting and locking the test results directory. On Windows Server 2008 you can configure Windows Error Reporting to not wait for input from the user. To find it, run Server Manager and then click on Turn on Windows Error Reporting (you may need to scroll down to find it). As you can see from the screenshot below, on our build server it was configured to ask about sending reports every time there is an error. Choose either the first or the last option to be sure that DW20 will not wait and lock your test results directory.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/4540.image3_5F00_59173FB3_5F00_7721EBE1.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image3_59173FB3" border="0" alt="image3_59173FB3" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8231.image3_5F00_59173FB3_5F00_thumb_5F00_26CC1C3C.png" width="600" height="487" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;&lt;/div&gt;  &lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;The other problem was to work out why we were getting these errors in the first place. For this I used the Windows Sysinternals &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653" target="_blank"&gt;Process Explorer&lt;/a&gt; tool. Using this I hovered the mouse over the DW20 processes, this showed me the command line parameter that was being passed to each DW20 process. This pointed me to a file in a temporary directory which contained the following:&lt;/p&gt;  &lt;div class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;   &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;       &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Version=131072&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;General_AppName=QTAgent32.exe&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;EventType=VSTEExecutionFrameworkUE&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;LoggingFlags=0&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;UIFlags=1&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;EventLogSource=Team Test Error Reporting&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;UI LCID=127&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P1=QTAgent32.exe&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P2=v2.0.50727&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P3=10.0.0.0&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P4=Unknown&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P5=ArgumentNullException&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;P6=27F84F9B&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;FilesToDelete=C:\Users\build\AppData\&lt;span style="color: #0000ff"&gt;Local&lt;/span&gt;\Temp\tmp7C26.tmp|C:\Users\build\AppData\&lt;span style="color: #0000ff"&gt;Local&lt;/span&gt;\Temp\tmp7C29.tmp|C:\Users\build\AppData\&lt;span style="color: #0000ff"&gt;Local&lt;/span&gt;\Temp\tmp7C3A.tmp&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;ReportingFlags=15&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Intro_Bold=An unexpected condition has occurred.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Intro_Reg=An unexpected condition has occurred &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; the test execution framework. Information about the condition has been gathered.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Plea_Bold=Please tell Microsoft about this problem.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Main_Plea_Reg=We have created an error report that you can send &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; help us fix bugs. We will treat this report as confidential and anonymous.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Queued_EventDescription=An exception has occurred &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; the test execution framework component: Value cannot be null.&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;Parameter name: certificateFindKey&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;The important thing to note in this file is that the process which crashed, was running QTAgent32.exe. This is the test runner used by the &lt;a href="http://msdn.microsoft.com/en-us/library/aa721750.aspx" target="_blank"&gt;TestToolsTask&lt;/a&gt; task to run unit tests on the build server without requiring Visual Studio to be installed.&lt;/p&gt;

&lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;This immediately reminded me that two of the unit tests were failing with an “Error” state rather than the more usual “Failed” state. When the test runner reports an Error state for a test it means that the test caused an error in the test runner itself. The most common reason I have seen for this is in tests that use threads, and indeed in this case the problem tests were using threads. Removing those tests stopped the QTAgent32 errors from happening in the first place.&lt;/p&gt;

&lt;p class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;So, the conclusion is simple.&lt;/p&gt;

&lt;div class="ExternalClassF801D20018BB4CAEA640211B9759BFF5"&gt;
  &lt;ol&gt;
    &lt;li&gt;Watch out for unit tests which fail with an Error state, an fix them as a matter of urgency. &lt;/li&gt;

    &lt;li&gt;Make sure that on &lt;strong&gt;all&lt;/strong&gt; of your build servers Windows Error Reporting is not configured to prompt. &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;

&lt;p&gt;I hope this has been useful and helps you to avoid problems running unit tests as part of your daily and Continuous Integration builds.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Rob+Jarratt/default.aspx"&gt;Rob Jarratt&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10223890" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TFS/">TFS</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Rob+Jarratt/">Rob Jarratt</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Team+Build/">Team Build</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/QTAgent32/">QTAgent32</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/DW20/">DW20</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Error+Reporting/">Windows Error Reporting</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Unit+Tests/">Unit Tests</category></item><item><title>FSharpChart new release available (version 0.55)</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/10/11/fsharpchart-new-release-available-version-0-55.aspx</link><pubDate>Tue, 11 Oct 2011 22:17:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10223469</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10223469</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/10/11/fsharpchart-new-release-available-version-0-55.aspx#comments</comments><description>&lt;p&gt;If you have been using FSharpChart you will have seen some recent activities around documentation. I am happy to say that a new code drop has been made available. This release deals with some minor bug fixes and restructures the code download, hopefully making it easier to navigate, in addition to the following changes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Defines a default font for all charts and chart properties &lt;/li&gt;    &lt;li&gt;Provides Style helpers to make it easier to define Labels, Fonts, etc. &lt;/li&gt;    &lt;li&gt;Provides a mechanism for specifying global, chart, and type defaults (some of which are defined) &lt;/li&gt;    &lt;li&gt;Provides a mechanism for DataPoint tooltips and sets a default for each chart type &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;First and foremost as a reminder the code can be downloaded from here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/FSharpChart-b59073f5" href="http://code.msdn.microsoft.com/FSharpChart-b59073f5"&gt;http://code.msdn.microsoft.com/FSharpChart-b59073f5&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Before drilling down into the code changes it is worth mentioning the new code structure. Hopefully this will make it simpler in navigating the source and samples. The folders and file contents for the download are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;bin&lt;/strong&gt;: Contains a compiled DLL for FSharpChart; called MSDN.FSharpChart.dll &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;scripts&lt;/strong&gt;: Contains the FSharpChart.fsx script file &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;source\fsharpchart&lt;/strong&gt;: Contains all the source files for FSharpChart &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;source\generator&lt;/strong&gt;: Contains some fsx files used to generate the original source code       &lt;ul&gt;       &lt;li&gt;The Generator.Script.fsx file can be used to create a single FSharpChart.fsx file from all the individual source control files &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;samples\scripts&lt;/strong&gt;: Contains some sample script files that demonstrate creating various charts &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;samples\winforms&lt;/strong&gt;: Contains a WinForms application that displays a chart and demonstrates how to change properties at runtime &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;samples\wpf&lt;/strong&gt;: Contains a WPF application that display a chart using Interop &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;Default Font&lt;/h5&gt;  &lt;p&gt;As some folks have expressed a desire to have charts rendered using more modern fonts, the code now contains a default font:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2e2c7ecb-bbd2-443a-966f-b3b523959ab5" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px;"&gt;&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; DefaultFont = &lt;br&gt;     &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Font(&lt;span style="color:#800000"&gt;&amp;quot;Calibri&amp;quot;&lt;/span&gt;, 9.0f, FontStyle.Regular)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h5&gt;Style Helpers&lt;/h5&gt;  &lt;p&gt;When defining a Font the normal definition is as follows:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:db3b92b1-c9d3-452f-a2e5-5db1b9df68be" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px;"&gt;&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Font(&lt;span style="color:#800000"&gt;&amp;quot;Calibri&amp;quot;&lt;/span&gt;, 9.0f, FontStyle.Regular)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;However, with the definition of a default Font it makes sense to allow one to define a new Font where one expresses the differences to the default Font. Thus a StyleHelper method has been provided allowing one to write:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:236ff1c5-5114-41c1-947e-327ac8696a36" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px;"&gt;StyleHelper.Font(FontSize=12.0f)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Within the provided FSharpChart samples there are often times where one has to define a LabelStyle, Title, or Legend. These elements all support fonts to be defined. To simplify this process a series of StyleHelper methods are available where one can also just express the Font characteristic that differs from the default. The definition for these helpers is:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2b8dcc2a-2944-4d90-a51a-c3565b8e1d93" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; StyleHelper =&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; LabelStyle&lt;br&gt;         ( ?Angle, ?Color, ?Format, ?Interval, ?IntervalOffset, ?IntervalOffsetType,&lt;br&gt;           ?IntervalType, ?IsEndLabelVisible, ?IsStaggered, ?TruncatedLabels,&lt;br&gt;           ?FontName:string, ?FontFamily:FontFamily, ?FontStyle:FontStyle, ?FontSize:float32)&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Legend&lt;br&gt;         ( ?Title, ?Background, ?Alignment, ?Docking, ?InsideArea,&lt;br&gt;           ?FontName:string, ?FontFamily:FontFamily, ?FontStyle:FontStyle, ?FontSize:float32)&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Title&lt;br&gt;         ( ?Text, ?TextStyle, ?Background, ?Color, ?BorderColor, ?BorderWidth, ?BorderDashStyle, &lt;br&gt;           ?TextOrientation, ?Alignment, ?Docking, ?InsideArea,&lt;br&gt;           ?FontName:string, ?FontFamily:FontFamily, ?FontStyle:FontStyle, ?FontSize:float32)&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; Font(?FamilyName:string, ?FontFamily:FontFamily, ?FontStyle:FontStyle, ?FontSize:float32)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This allows code such as:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8e0a22a9-58f1-4c74-8d7e-c0f9fd72d9d0" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;chart.Title &amp;lt;- StyleHelper.Title(&lt;span style="color:#800000"&gt;&amp;quot;Chart Sin/Cosine&amp;quot;&lt;/span&gt;, FontSize = 12.0f, FontStyle = FontStyle.Bold)&lt;br&gt; chart.Legend &amp;lt;- StyleHelper.Legend(InsideArea = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;, Alignment = StringAlignment.Center, Docking = Docking.Top, FontName = &lt;span style="color:#800000"&gt;&amp;quot;Arial Narrow&amp;quot;&lt;/span&gt;)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Hopefully folks this is an easier syntax for Titles, Legends, LabelStyles, and Fonts.&lt;/p&gt;  &lt;h5&gt;Charting Defaults&lt;/h5&gt;  &lt;p&gt;In allowing the modification of all chart Font properties to use the newly defined default a mechanism was defined that allowed any chart property to be overridden with a default. Thus the code now supports the ability to specify a default value for any property which can be restricted to either a particular type (such as Series or Label) or to a particular chart type.&lt;/p&gt;  &lt;p&gt;To demonstrate this I have defined a few simple properties that folks have requested:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b01006b5-fd76-4ef1-9e5e-76441c585bb3" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#008000"&gt;// Type used for defining defaults&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;type&lt;/span&gt; &lt;span style="color:#0000ff"&gt;internal&lt;/span&gt; ChartStyleDefault =&lt;br&gt;     { ChartType:Charting.SeriesChartType option; ParentType:Type option; PropertyName:string; PropertyDefault:obj }&lt;br&gt; &lt;br&gt; &lt;span style="color:#008000"&gt;// Definition of defaults for the chart&lt;/span&gt;&lt;br&gt; &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;internal&lt;/span&gt; PropertyDefaults = &lt;br&gt;     [ &lt;span style="color:#008000"&gt;// Define type specific defaults&lt;/span&gt;&lt;br&gt;       { ChartStyleDefault.ChartType = None; ParentType = Some(typeof&amp;lt;Charting.LabelStyle&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;Font&amp;quot;&lt;/span&gt;; PropertyDefault=(box (&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Font(&lt;span style="color:#800000"&gt;&amp;quot;Arial Narrow&amp;quot;&lt;/span&gt;, 10.0f, FontStyle.Regular))) }&lt;br&gt;       { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Line); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;BorderWidth&amp;quot;&lt;/span&gt;; PropertyDefault=(box 2) }&lt;br&gt;       &lt;span style="color:#008000"&gt;// Define global defaults&lt;/span&gt;&lt;br&gt;       { ChartStyleDefault.ChartType = None; ParentType = None; PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;Font&amp;quot;&lt;/span&gt;; PropertyDefault=(box DefaultFont) } ]&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Hopefully this will allow folks to customize FSharpChart with a set of defaults that render charts with desirable visuals.&lt;/p&gt;  &lt;h5&gt;DataPoint ToolTips&lt;/h5&gt;  &lt;p&gt;Last but not least ToolTip’s have now been defined for DataPoint’s on a chart.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1351.image_5F00_2D25B5D6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6646.image_5F00_thumb_5F00_77CC7DA3.png" width="453" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Support for these ToolTips are provided in several ways.&lt;/p&gt;  &lt;p&gt;Firstly these ToolTips are enabled by default with a specific default ToolTip being defined for each chart type:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c76a5245-a776-43bd-95bd-63174b0e8a3c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;{ ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Line); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Spline); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Bar); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Column); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Area); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StackedBar); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StackedColumn); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StackedArea); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StackedBar100); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StackedColumn100); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StackedArea100); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.SplineArea); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Range); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, High=#VALY1, Low=#VALY2&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.RangeBar); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;Y=#VALX, High=#VALY1, Low=#VALY2&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.RangeColumn); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, High=#VALY1, Low=#VALY2&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.SplineRange); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, High=#VALY1, Low=#VALY2&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Point); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.PointAndFigure); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, High=#VALY1, Low=#VALY2&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.ThreeLineBreak); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.StepLine); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Pie); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Doughnut); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.BoxPlot); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;Lower Whisker=#VALY1, Upper Whisker=#VALY2, Lower Box=#VALY3, Upper Box=#VALY4&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Candlestick); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;High=#VALY1, Low=#VALY2, Open=#VALY3, Close=#VALY4&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Stock); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;High=#VALY1, Low=#VALY2, Open=#VALY3, Close=#VALY4&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Renko); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Bubble); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VALY1, Size=#VALY2&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.ErrorBar); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VALY1, Lower=#VALY2, Upper=#VALY3&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Funnel); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Pyramid); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Kagi); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;X=#VALX, Y=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Polar); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;Angle=#VALX, Distance=#VAL&amp;quot;&lt;/span&gt;) }&lt;br&gt; { ChartStyleDefault.ChartType = Some(Charting.SeriesChartType.Radar); ParentType = Some(typeof&amp;lt;Charting.Series&amp;gt;); PropertyName=&lt;span style="color:#800000"&gt;&amp;quot;ToolTip&amp;quot;&lt;/span&gt;; PropertyDefault=(box &lt;span style="color:#800000"&gt;&amp;quot;Point=#VALX, Distance=#VAL&amp;quot;&lt;/span&gt;) }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; This ability is supported through the Series ToolTip property. A good set of documentation is available in the charting Technical Reference:   &lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/dd456726.aspx" href="http://msdn.microsoft.com/en-us/library/dd456726.aspx"&gt;http://msdn.microsoft.com/en-us/library/dd456726.aspx&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The Keywords section covers the syntax for the property and the Chart Types section defines what values can and should be used.&lt;/p&gt;  &lt;p&gt;Finally, the DataPoint properties for a Series can now be specified using the WithSeries.DataPoint method:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:24029cb7-8829-4851-af72-5bffd669c797" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #dedede; max-height: 300px; overflow: auto; padding: 2px 5px;"&gt;FSharpChart.Line [ &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; f &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 1.0 .. 0.1 .. 10.0 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; f, sin f ]&lt;br&gt; |&amp;gt; FSharpChart.WithSeries.DataPoint(ToolTip = &lt;span style="color:#800000"&gt;&amp;quot;(#VALX{#0.000}, #VAL{#,##0.000;-#,##0.000})&amp;quot;&lt;/span&gt;)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The supported properties that can be defined are Label, LabelToolTip, and ToolTip.&lt;/p&gt;  &lt;h4&gt;In Conclusion&lt;/h4&gt;  &lt;p&gt;Hopefully folks will find these enhancements useful; the ToolTip support having been a highly requested feature. As always please do let me know if there are features that you would like to be included in FSharpChart.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10223469" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharpChart/">FSharpChart</category></item><item><title>Federated Security: How to setup and call a WCF service secured by ADFS 2.0</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/17/federated-security-how-to-setup-and-call-a-wcf-service-secured-by-adfs-2-0.aspx</link><pubDate>Wed, 17 Aug 2011 13:20:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10196663</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10196663</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/17/federated-security-how-to-setup-and-call-a-wcf-service-secured-by-adfs-2-0.aspx#comments</comments><description>&lt;div class="ExternalClassD5C77FCA752640D19EEE4D6429277841"&gt;   &lt;p&gt;In this blog post I am going to walkthrough the steps required to secure a WCF service with ADFS 2.0, as well as how to call this service from a client. The aim of this article is to provide an outline of the general principals and steps, not to explain how to set up a fully secured scenario (everything in this post was tested across a couple of VMs on a development machine). &lt;/p&gt;    &lt;p&gt;With federated security, there are two modes of authentication:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Passive. In this scenario, a client application (i.e. browser) tries to access a web resource (e.g. a webpage). If the client isn’t authenticated for that resource, it is redirected to a login page. On successful authentication, the client is redirected back to the original web resource and authorized as appropriate. Note that in this scenario, the client browser just needs to follow redirects etc. and does not need to use any special logic to authenticate. A more comprehensive explanation can be found here: &lt;a title="http://msdn.microsoft.com/en-us/magazine/ff872350.aspx" href="http://msdn.microsoft.com/en-us/magazine/ff872350.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/ff872350.aspx&lt;/a&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Active. In this scenario, it is probable that the resource being accessed does not have a user interface (e.g a WCF / Rest service). The client application therefore needs to contain logic to authenticate against a Secure Token Store. Note that WCF does make provision for the active scenario through config (tutorial here: &lt;a title="http://msdn.microsoft.com/en-us/gg557876" href="http://msdn.microsoft.com/en-us/gg557876"&gt;http://msdn.microsoft.com/en-us/gg557876&lt;/a&gt;). In our walkthrough below, however, we are going to authenticate programmatically. &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;This walkthrough was carried out on two VMs. &lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;&lt;strong&gt;Server 1:&lt;/strong&gt; Server 2008R2. Active Directory Domain Controller with IIS7 installed. It is assumed that an AD domain has been set up. This machine will be used to host ADFS2.0. &lt;/li&gt;      &lt;li&gt;&lt;strong&gt;Server 2&lt;/strong&gt;: Server 2008R2. IIS7 installed. This machine will be used to host our WCF service (note that this does not need to be joined to our domain). &lt;/li&gt;   &lt;/ul&gt;    &lt;h1&gt;Server 1: Prepare the default website to host the ADFS 2.0 endpoints. &lt;/h1&gt;    &lt;ul&gt;     &lt;li&gt;When installed (later in this post), ADFS 2.0 creates endpoints under the default website. On the first VM (with AD installed), launch IIS Manager and ensure that the default website is running. &lt;/li&gt;      &lt;li&gt;Ensure that you have a url that resolves to this machine (to be used for the ADFS 2.0 endpoints).        &lt;ul&gt;         &lt;li&gt;In my environment, I added the following entry to your hosts file (C:\Windows\System32\drivers\etc): 127.0.0.1 adfs.testdomain.dev &lt;/li&gt;          &lt;li&gt;On a live environment, this should be done via DNS. &lt;/li&gt;          &lt;li&gt;Note that if you’re LAN connection uses a proxy server, you may need to bypass the proxy for the above address (i.e. IE –&amp;gt; Tools &amp;gt; Options &amp;gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;As ADFS 2.0 endpoints should be run over https, ensure that you have a certificate setup (and it’s trusted). On a production environment this should be properly created and trusted, however on my dev environment I followed the instructions on &lt;a href="http://www.robbagby.com/iis/self-signed-certificates-on-iis-7-the-easy-way-and-the-most-effective-way/"&gt;http://www.robbagby.com/iis/self-signed-certificates-on-iis-7-the-easy-way-and-the-most-effective-way/&lt;/a&gt; using SelfSSL.exe (note that selfssl is part of the IIS Resource Kit Toolkit).&amp;#160; &lt;ul&gt;         &lt;li&gt;My specific command was “SelfSSL /N:CN=adfs.testdomain.dev /V:365 /S:1” (this create the certificate and configure the default website to use this certificate). &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;h1&gt;Server 1: Setting up ADFS 2.0&lt;/h1&gt;    &lt;p&gt;To set up ADFS 2.0, you first need to download it from &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=10909"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=10909&lt;/a&gt;. Once download, run through the following steps…&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Run the setup wizard &lt;/li&gt;      &lt;li&gt;On the first screen click next &lt;/li&gt;      &lt;li&gt;Read and accept the license agreement &lt;/li&gt;      &lt;li&gt;On the server role screen, select “Federation Server” &lt;/li&gt;      &lt;li&gt;Click next to install. &lt;/li&gt;      &lt;li&gt;Once it has run, you will need to restart the machine. &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;After it has installed, you now need to configure it&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Launch AD FS 2.0 Management Tool from Start &amp;gt; Administrative Tools &amp;gt; AD FS 2.0 Management &lt;/li&gt;      &lt;li&gt;Once loaded, select the AD FS 2.0 Federation Server Configuration Wizard (from the main panel) &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7853.ADFSSetup1_5F00_2_5F00_2BB1F561_5F00_28B92DDC.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ADFSSetup1_2_2BB1F561" border="0" alt="ADFSSetup1_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6064.ADFSSetup1_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_4E42AB3D.png" width="500" height="399" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Select create a new federation service and click next &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1273.ADFSSetup2_5F00_2_5F00_2BB1F561_5F00_4572A2F1.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ADFSSetup2_2_2BB1F561" border="0" alt="ADFSSetup2_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3817.ADFSSetup2_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_2F3C879F.png" width="500" height="399" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Select “Stand-alone federation server” and click next &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7127.ADFSSetup3_5F00_2_5F00_2BB1F561_5F00_024724C4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ADFSSetup3_2_2BB1F561" border="0" alt="ADFSSetup3_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7140.ADFSSetup3_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_6C110971.png" width="500" height="399" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Accept the defaults for SSL certificates (this will be the certificate of you created earlier). Press next &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2350.ADFSSetup4_5F00_2_5F00_2BB1F561_5F00_0670FC89.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ADFSSetup4_2_2BB1F561" border="0" alt="ADFSSetup4_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7853.ADFSSetup4_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_703AE136.png" width="500" height="399" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Confirm the settings and press next. &lt;/li&gt;      &lt;li&gt;Wait for the results. &lt;/li&gt;   &lt;/ul&gt;    &lt;h1&gt;Server 2: Setting up the website to host the WCF Service&lt;/h1&gt;    &lt;p&gt;On server 2, the WIF run time and SDK first needs to be installed. &lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;WIF 4.0 Runtime - &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=17331"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=17331&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;WIF 4.0 SDK - &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=4451"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=4451&lt;/a&gt; &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;Next, if your not using a DNS server (i.e. you’re on a dev enviroment), edit C:\Windows\System32\drivers\etc\hosts and add the following entries:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;adfs.testdomain.dev – 10.10.10.1 (set this to the IP address of the ADFS VM, aka Server 1) &lt;/li&gt;      &lt;li&gt;services.testdomain.dev – 127.0.0.1 &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;Next, create a website to host the WCF service:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;In IIS Manager, right click on the site node in the connections pane and select “Add New Site”. Set the website settings as follows:        &lt;ul&gt;         &lt;li&gt;SiteName: wcftestsite (lowercase) &lt;/li&gt;          &lt;li&gt;Physical Path: C:\inetpub\wwwroot\wcftestsite (you will need to create this folder) &lt;/li&gt;          &lt;li&gt;Binding (we will change this to https later)            &lt;ul&gt;             &lt;li&gt;Type: http &lt;/li&gt;              &lt;li&gt;IP Address: All Unassigned &lt;/li&gt;              &lt;li&gt;Port: 80 &lt;/li&gt;              &lt;li&gt;Host name: services.testdomain.dev (lowercase) &lt;/li&gt;           &lt;/ul&gt;         &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;Once created, in IIS Manager, select the “Application Pool” node in the connections pane. Locate and select the newly created wcftestsite application pool.        &lt;ul&gt;         &lt;li&gt;In the basic settings ensure that the application pool .NET framework version is set to v4.0 &lt;/li&gt;          &lt;li&gt;In the “advanced settings” dialog. Under the process model section, change the identity to LocalSystem (this is so that it can access the ADFS certificate in the trusted root store). Note, on a production environment you would use a specific named account as opposed to this. &lt;/li&gt;          &lt;li&gt;In the “advanced settings” dialog. Under the process model section, set “Load User Profile” to true. &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;Next, we need to set up a trusted certificate for our new site. We will follow the steps as per server 1 to do this.&amp;#160; My SelfSSL command is as follows: SelfSSL /N:CN=services.testdomain.dev /V:365 /S:2&lt;/p&gt;    &lt;p&gt;Also, set IE to accept certificates as above to both services.testdomain.dev and adfs.testdomain.dev (as per server 1). &lt;/p&gt;    &lt;h1&gt;Server 2: Creating the WCF service&lt;/h1&gt;    &lt;ul&gt;     &lt;li&gt;Open Visual Studio 2010 &lt;/li&gt;      &lt;li&gt;Select file &amp;gt; new &amp;gt; website &lt;/li&gt;      &lt;li&gt;Select WCF Service from the project types &lt;/li&gt;      &lt;li&gt;Set the web location to &lt;a href="http://services.testdomain.dev/wcfservice"&gt;http://services.testdomain.dev/wcfservice&lt;/a&gt; and click ok (all lowercase) &lt;/li&gt;      &lt;li&gt;Alter / add the following code to the GetData method on your WCF service. Browse to the service to ensure it no errors are thrown. &lt;/li&gt;   &lt;/ul&gt;    &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;       &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; GetData()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     var id = Thread.CurrentPrincipal.Identity &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; IClaimsIdentity;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;&amp;quot;Hello {0}&amp;quot;&lt;/span&gt;, id.Claims[0].Value);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;ul&gt;
    &lt;li&gt;In IIS Manager, select the newly created website and change the app pool to “wcftestsite” &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;Now the service has been created, it now needs to be altered to use ADFS 2.0. &lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;In Visual Studio, right click on the project node for your WCF service website and select “Add STS Reference” (this is a new option provided by the WIF SDK) &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2843.WCF_5F00_STS1_5F00_2_5F00_2BB1F561_5F00_1C77681B.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WCF_STS1_2_2BB1F561" border="0" alt="WCF_STS1_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3733.WCF_5F00_STS1_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_1B32CF3C.png" width="500" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Click next &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5305.WCF_5F00_STS2_5F00_2_5F00_2BB1F561_5F00_44C69A6F.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WCF_STS2_2_2BB1F561" border="0" alt="WCF_STS2_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2766.WCF_5F00_STS2_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_71032153.png" width="500" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Select the “Use an Existing STS” radio button &lt;/li&gt;

    &lt;li&gt;Set the url to &lt;a href="https://adfs.testdomain.dev"&gt;https://adfs.testdomain.dev&lt;/a&gt; &lt;/li&gt;

    &lt;li&gt;Click test location (this should autocomplete the rest of the URL as per the screenshot below). &lt;/li&gt;

    &lt;li&gt;Click next &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6076.WCF_5F00_STS3_5F00_2_5F00_2BB1F561_5F00_416502C7.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WCF_STS3_2_2BB1F561" border="0" alt="WCF_STS3_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7633.WCF_5F00_STS3_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_26B866AE.png" width="500" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Set “Disable certificate chain validation” as we have created our own certificates. &lt;/li&gt;

    &lt;li&gt;Click next. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2671.WCF_5F00_STS4_5F00_2_5F00_2BB1F561_5F00_52F4ED92.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WCF_STS4_2_2BB1F561" border="0" alt="WCF_STS4_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6888.WCF_5F00_STS4_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_3CBED240.png" width="500" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Select “Enable encryption” (wcf does not allow this to be disabled) &lt;/li&gt;

    &lt;li&gt;Select and existing certificate from store and select you “services.testdomain.dev” cert. &lt;/li&gt;

    &lt;li&gt;Click next &lt;/li&gt;

    &lt;li&gt;Leave offered claim as-is and click next &lt;/li&gt;

    &lt;li&gt;Verify the summary and click finish. &lt;/li&gt;

    &lt;li&gt;Once complete, a folder structure and a file named FederationMetadata.xml will be added to you website. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;h1&gt;Server 1: Setup a trust relationship for our WCF service&lt;/h1&gt;

  &lt;ul&gt;
    &lt;li&gt;Copy the newly created FederationMetadata.xml file create above to the ADFS VM &lt;/li&gt;

    &lt;li&gt;In ADFS2.0 Management console, from the tree right click on “Trust Relationships” and select “Add Relying Party Trust”. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1108.RelyingPartyTrust1_5F00_2_5F00_2BB1F561_5F00_3B0E066C.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="RelyingPartyTrust1_2_2BB1F561" border="0" alt="RelyingPartyTrust1_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0121.RelyingPartyTrust1_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_39C96D8D.png" width="500" height="400" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Click start &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6888.RelyingPartyTrust2_5F00_2_5F00_2BB1F561_5F00_263C0DEC.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="RelyingPartyTrust2_2_2BB1F561" border="0" alt="RelyingPartyTrust2_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/8547.RelyingPartyTrust2_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_52E4C7C5.png" width="500" height="400" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Select “Import data about the relying party from a file” and select the FederationMetadata.xml file copied from the other server. Press next &lt;/li&gt;

    &lt;li&gt;Type the display name as “servicestestdomain” then click next &lt;/li&gt;

    &lt;li&gt;On the next screen, leave permit all users to access this relying party selected. Click next &lt;/li&gt;

    &lt;li&gt;Verify settings and click next &lt;/li&gt;

    &lt;li&gt;Leave the checkbox select for “Open the Edit Claim Rules dialog for this relying party trust when the wizard closes”. Click close. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

  &lt;p&gt;&lt;b&gt;Edit Claim Rules&lt;/b&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;On the edit claims rules dialog, verify that “Permit Access to All users” is set on the Issuance Authorization Rules tab &lt;/li&gt;

    &lt;li&gt;On the Issuance Tranform Rules tab, click add rule. Select “Pass Through or Filter an Incoming Claim”. &lt;/li&gt;

    &lt;li&gt;Set the claim rule name to “WCFServicePassthroughIncomingClaim”, on incoming claim type, select “Windows Account Name”. &lt;/li&gt;

    &lt;li&gt;Leave the radio button set as “pass through all claim values” &lt;/li&gt;

    &lt;li&gt;Click finish, then ok to save. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;h1&gt;&lt;/h1&gt;

  &lt;h1&gt;Server 2: Setup a test application to call the service&lt;/h1&gt;

  &lt;ul&gt;
    &lt;li&gt;Run Visual Studio 2010 as an administrator (this should ensure that we have rights to see our newly created service). Open the solution that contains our WCF Service. &lt;/li&gt;

    &lt;li&gt;In our Visual Studio solution, create a console app named “WCFClient”. Set this as the startup project. Note that this can be totally separate to our solution, even on a different server – it just makes it easier to have them in the same place for this walkthrough. &lt;/li&gt;

    &lt;li&gt;Ensure that the target framework for this project is “.NET Framework 4.0” and not the “.NET Framework 4.0 Client Profile”. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7065.TestRunner2_5F00_2_5F00_2BB1F561_5F00_5133FBF1.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="TestRunner2_2_2BB1F561" border="0" alt="TestRunner2_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2781.TestRunner2_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_4E3E973E.png" width="500" height="318" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Right click on this project and select “Add Service Reference”. &lt;/li&gt;

    &lt;li&gt;Set the address to &lt;a href="https://services.testdomain.dev/wcfservice/service.svc"&gt;https://services.testdomain.dev/wcfservice/service.svc&lt;/a&gt; and click discover. Note that we can still see the service as we are running as the user who created this account. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5822.TestRunner1_5F00_2_5F00_2BB1F561_5F00_7D40D315.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="TestRunner1_2_2BB1F561" border="0" alt="TestRunner1_2_2BB1F561" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5482.TestRunner1_5F00_2_5F00_2BB1F561_5F00_thumb_5F00_6A1FA669.png" width="500" height="407" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Set the namespace to MyTestService and click ok. &lt;/li&gt;

    &lt;li&gt;Add a couple of references: 
      &lt;ul&gt;
        &lt;li&gt;System.IdentityModel (.NET 4.0) &lt;/li&gt;

        &lt;li&gt;Microsoft.IdentityModel &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;

    &lt;li&gt;Add a new class called Token.cs to the project. This actively obtains the token from ADFS 2.0 (the secure token store). Add the following code to this class… &lt;/li&gt;
  &lt;/ul&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.IdentityModel.Tokens;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Net;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.IdentityModel.Protocols.WSTrust;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.ServiceModel.Security;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; WCFClient&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;internal&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Token&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; SecurityToken GetToken(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; username, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; password, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; appliesTo, &lt;span style="color: #0000ff"&gt;out&lt;/span&gt; RequestSecurityTokenResponse rsts)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             WS2007HttpBinding binding = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WS2007HttpBinding();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             binding.Security.Message.EstablishSecurityContext = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;             binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             binding.Security.Mode = SecurityMode.TransportWithMessageCredential; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;             WSTrustChannelFactory trustChannelFactory = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WSTrustChannelFactory(binding, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EndpointAddress(&lt;span style="color: #006080"&gt;&amp;quot;https://adfs.testdomain.dev/adfs/services/trust/13/usernamemixed&amp;quot;&lt;/span&gt;));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;             trustChannelFactory.Credentials.UserName.UserName = username;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;             trustChannelFactory.Credentials.UserName.Password = password;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;             trustChannelFactory.ConfigureChannelFactory();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;             &lt;span style="color: #008000"&gt;// Create issuance issuance and get security token &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;             RequestSecurityToken requestToken = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RequestSecurityToken(WSTrust13Constants.RequestTypes.Issue);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;             requestToken.AppliesTo = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EndpointAddress(appliesTo);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;             WSTrustChannel tokenClient = (WSTrustChannel)trustChannelFactory.CreateChannel();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;             SecurityToken token = tokenClient.Issue(requestToken, &lt;span style="color: #0000ff"&gt;out&lt;/span&gt; rsts);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; token;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;     }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;ul&gt;
    &lt;li&gt;Add another class called FederatedWCFClient.cs to the project. This effectively wraps our service reference proxy class (autogenerated when we add our service reference), and allows it pass in a token to authenticate. Code for this is as follows: &lt;/li&gt;
  &lt;/ul&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.IdentityModel.Tokens;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.IdentityModel.Protocols.WSTrust;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; WCFClient&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; FederatedWCFClient&amp;lt;T&amp;gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; SecurityToken token;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; ChannelFactory&amp;lt;T&amp;gt; factory;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; FederatedWCFClient(SecurityToken securityToken, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; binding) &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.token = securityToken;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.factory = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ChannelFactory&amp;lt;T&amp;gt;(binding);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.factory.ConfigureChannelFactory&amp;lt;T&amp;gt;();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Close()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.factory.Close();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; T Client&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.factory.CreateChannelWithIssuedToken(token);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; T ClientActAs&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.factory.CreateChannelActingAs(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.token);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;     }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;Finally, update our main method in Program.cs as follows (ensure that the binding name, endpoint and credentials are set up correctly).&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Net;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.IdentityModel.Protocols.WSTrust;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; WCFClient&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;             var requestTokenResponse = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RequestSecurityTokenResponse();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             var token = Token.GetToken(&lt;span style="color: #006080"&gt;@&amp;quot;mydomain\testuser&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;p@ssw0rd&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;http://services.testdomain.dev/wcfservice/Service.svc&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;out&lt;/span&gt; requestTokenResponse);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;             &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             var wcfClient = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FederatedWCFClient&amp;lt;MyTestService.IService&amp;gt;(token, &lt;span style="color: #006080"&gt;&amp;quot;WS2007FederationHttpBinding_IService&amp;quot;&lt;/span&gt;);   &lt;span style="color: #008000"&gt;// This must match the app.config&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             var client = wcfClient.Client &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; MyTestService.IService;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;             var result = client.GetData();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             Console.WriteLine(result);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             wcfClient.Close();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;     }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;Now when you run the program, the client app will do the following&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;Obtain a token from ADFS &lt;/li&gt;

    &lt;li&gt;Call the WCF service method &lt;/li&gt;

    &lt;li&gt;Write the output of the WCF service method &lt;/li&gt;
  &lt;/ol&gt;

  &lt;h1&gt;Troubleshooting&lt;/h1&gt;

  &lt;ul&gt;
    &lt;li&gt;The most common cause of error when creating this application was due to incorrect / inconsistent casing of the wcf service endpoint url. Verify case consistency of these. &lt;/li&gt;

    &lt;li&gt;ADFS 2.0 logs are visible in the Event Viewer (under “application and service logs”) &lt;/li&gt;

    &lt;li&gt;It can be useful turn on WCF logging WCF &lt;a href="http://msdn.microsoft.com/en-us/library/aa702726.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa702726.aspx&lt;/a&gt;. Logs can be opened in the Microsoft Service Trace Viewer (note that I normally use the message view within this – I locate errors,&amp;#160; then view the exception tree for that error). &lt;/li&gt;

    &lt;li&gt;If when browsing to the WCF service endpoint, you receive “CryptographicException: Keyset does not exist” – this usually means the application pool does not trust the certificate. Check the WCF service is running under the correct application pool. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&lt;em&gt;Thanks to &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Bradley+Cotier/default.aspx"&gt;Bradley Cotier&lt;/a&gt; for his debugging assistance&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Rob+Nowik/default.aspx"&gt;Rob Nowik&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10196663" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Bradley+Cotier/">Bradley Cotier</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/ADFS/">ADFS</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Active+Directory+Federation+Services/">Active Directory Federation Services</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Rob+Nowik/">Rob Nowik</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Federated+Security/">Federated Security</category></item><item><title>Writing a gesture service with the Kinect for Windows SDK</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/08/writing-a-gesture-service-with-the-kinect-for-windows-sdk.aspx</link><pubDate>Mon, 08 Aug 2011 10:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10193601</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10193601</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/08/writing-a-gesture-service-with-the-kinect-for-windows-sdk.aspx#comments</comments><description>&lt;div class="ExternalClass8F25A802D4C34281A0F3A926B6437604"&gt;
&lt;p&gt;After further experimenting with the Kinect SDK, it became obvious what needed to come next. If you were to create an application using the Kinect SDK, you will want to be able to control the application using gestures (i.e. waving, swiping, motions to access menus, etc.). From this, we decided to write a gesture service in c# that would analyse the gestures. This blog post outlines how we did this and how you can implement the same functionality.&lt;/p&gt;
&lt;p&gt;To be able to recognize gestures, it is first important to understand what makes a gesture.&lt;/p&gt;
&lt;p&gt;We concluded that gestures were made up of parts. Each part of a gesture is a specific movement that, when combined with other gesture parts, makes up the whole gesture. For example the diagram below shows the two parts of a simple wave gesture and how they can be identified:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6787.Untitled_5F00_5F79C183.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Untitled" border="0" alt="Untitled" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2063.Untitled_5F00_thumb_5F00_16DFD2B2.png" width="400" height="173" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However this is not quite enough to be able to recognize multiple gestures with any degree of accuracy. The problem occurs when you think about multiple gestures being recognized at once.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not as simple as looking for the next part of the gesture. . For example, consider the wave gesture shown above. If I was to drop my hand between the two parts, then it would still be recognized as a wave as both parts of the gesture were completed&lt;ins datetime="2011-08-01T14:32" cite="mailto:James%20Glading"&gt; &lt;/ins&gt;in the order they were defined; yet I clearly did not perform a wave. To solve this problem we came up with three results that a gesture part can return when it checks to see if it has been completed or not. The diagram below shows these three results and the impact of returning each of them:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7041.Untitled1_5F00_5C845CD0.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Untitled1" border="0" alt="Untitled1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1172.Untitled1_5F00_thumb_5F00_625F0069.png" width="240" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A result of &amp;lsquo;Pausing&amp;rsquo; allows the system to identify a movement that does not fulfil the gesture but could be a result of the user moving slowly. In short the three results mean the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fail &amp;ndash; The gesture failed. The user moved in a way that was inconsistent with the gesture and as such the gesture will start again at the beginning.&lt;/li&gt;
&lt;li&gt;Pausing &amp;ndash; The user did not fail the gesture but they did not perform the next part either. The system will check again for this part after a short pause. A result of pausing can only be returned a maximum of 100 times before the gesture will fail and recognition will start again at the beginning.&lt;/li&gt;
&lt;li&gt;Succeed &amp;ndash; the user performed this part of the gesture. After a short pause the system will start looking for the next part of the gesture.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;&lt;b&gt;The Solution&lt;/b&gt;&lt;/h5&gt;
&lt;p&gt;The overall gesture service is made up of three main parts each of which is detailed below:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7457.Untitled2_5F00_3A4C514A.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Untitled2" border="0" alt="Untitled2" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5381.Untitled2_5F00_thumb_5F00_7FF0DB68.png" width="240" height="141" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h6&gt;&lt;b&gt;The Gesture Controller:&lt;/b&gt;&lt;/h6&gt;
&lt;p&gt;The gesture controller is a way of controlling all of the gestures that a user can perform. The code for this can be seen below:&lt;/p&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 875px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper"&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#region&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt;...&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; Microsoft.Research.Kinect.Nui;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// The gesture controller&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; GestureControler&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum11"&gt; 11:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum12"&gt; 12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum13"&gt; 13:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum14"&gt; 14:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// The list of all gestures we are currently looking for&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum15"&gt; 15:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum16"&gt; 16:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; List&amp;lt;Gesture&amp;gt; gestures = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; List&amp;lt;Gesture&amp;gt;();&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum17"&gt; 17:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum18"&gt; 18:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum19"&gt; 19:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Initializes a new instance of the &amp;lt;see cref="GestureControler"/&amp;gt; class.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum20"&gt; 20:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum21"&gt; 21:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; GestureControler()&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum22"&gt; 22:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum23"&gt; 23:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum24"&gt; 24:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum25"&gt; 25:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum26"&gt; 26:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Occurs when [gesture recognized].&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum27"&gt; 27:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum28"&gt; 28:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;event&lt;/span&gt; EventHandler&amp;lt;GestureEventArgs&amp;gt; GestureRecognised;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum29"&gt; 29:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum30"&gt; 30:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum31"&gt; 31:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Updates all gestures.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum32"&gt; 32:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum33"&gt; 33:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="data"&amp;gt;The skeleton data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum34"&gt; 34:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; UpdateAllGestures(SkeletonData data)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum35"&gt; 35:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum36"&gt; 36:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (Gesture gesture &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestures)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum37"&gt; 37:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum38"&gt; 38:&lt;/span&gt;             gesture.UpdateGesture(data);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum39"&gt; 39:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum40"&gt; 40:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum41"&gt; 41:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum42"&gt; 42:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum43"&gt; 43:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Adds the gesture.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum44"&gt; 44:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum45"&gt; 45:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="type"&amp;gt;The gesture type.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum46"&gt; 46:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="gestureDefinition"&amp;gt;The gesture definition.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum47"&gt; 47:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; AddGesture(GestureType type, IRelativeGestureSegment[] gestureDefinition)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum48"&gt; 48:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum49"&gt; 49:&lt;/span&gt;         Gesture gesture = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; Gesture(type, gestureDefinition);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum50"&gt; 50:&lt;/span&gt;         gesture.GestureRecognised += &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; EventHandler&amp;lt;GestureEventArgs&amp;gt;(&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.Gesture_GestureRecognised);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum51"&gt; 51:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestures.Add(gesture);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum52"&gt; 52:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum53"&gt; 53:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum54"&gt; 54:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum55"&gt; 55:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Handles the GestureRecognised event of the g control.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum56"&gt; 56:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum57"&gt; 57:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="sender"&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum58"&gt; 58:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="e"&amp;gt;The &amp;lt;see cref="KinectSkeltonTracker.GestureEventArgs"/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum59"&gt; 59:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; Gesture_GestureRecognised(&lt;span style="color: #0000ff;"&gt;object&lt;/span&gt; sender, GestureEventArgs e)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum60"&gt; 60:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum61"&gt; 61:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.GestureRecognised != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum62"&gt; 62:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum63"&gt; 63:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.GestureRecognised(&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;, e);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum64"&gt; 64:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum65"&gt; 65:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum66"&gt; 66:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (Gesture g &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestures)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum67"&gt; 67:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum68"&gt; 68:&lt;/span&gt;             g.Reset();&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum69"&gt; 69:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum70"&gt; 70:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum71"&gt; 71:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h6&gt;&lt;b&gt;A Gesture: &lt;/b&gt;&lt;/h6&gt;
&lt;p&gt;This controls all of the parts of a gesture and which one is currently being checked. It contains an array of IRelativeGestureSegment which are individual implementations of the IRelativeGestureSegment interface (which I will mention later). When a skeleton frame is created it is passed through to each Gesture which then passes it through to the current gesture segment. When the final segment returns a result of &amp;lsquo;Succeed&amp;rsquo; it raises a gesture recognized event which is caught by the gesture controller. The code for the Gesture class can be seen below:&lt;/p&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 1394px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper"&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#region&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt;...&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; Microsoft.Research.Kinect.Nui;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt; &amp;lt;summary&amp;gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// A single gesture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; Gesture&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum11"&gt; 11:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum12"&gt; 12:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// The parts that make up this gesture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum13"&gt; 13:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum14"&gt; 14:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; IRelativeGestureSegment[] gestureParts;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum15"&gt; 15:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum16"&gt; 16:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum17"&gt; 17:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// The current gesture part that we are matching against&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum18"&gt; 18:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum19"&gt; 19:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; currentGesturePart = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum20"&gt; 20:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum21"&gt; 21:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum22"&gt; 22:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// the number of frames to pause for when a pause is initiated&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum23"&gt; 23:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum24"&gt; 24:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; pausedFrameCount = 10;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum25"&gt; 25:&lt;/span&gt;     &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum26"&gt; 26:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum27"&gt; 27:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// The current frame that we are on&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum28"&gt; 28:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum29"&gt; 29:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; frameCount = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum30"&gt; 30:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum31"&gt; 31:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum32"&gt; 32:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Are we paused?&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum33"&gt; 33:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum34"&gt; 34:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;bool&lt;/span&gt; paused = &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum35"&gt; 35:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum36"&gt; 36:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum37"&gt; 37:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// The type of gesture that this is&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum38"&gt; 38:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum39"&gt; 39:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; GestureType type;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum40"&gt; 40:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum41"&gt; 41:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum42"&gt; 42:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Initializes a new instance of the &amp;lt;see cref="Gesture"/&amp;gt; class.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum43"&gt; 43:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum44"&gt; 44:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="type"&amp;gt;The type of gesture.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum45"&gt; 45:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="gestureParts"&amp;gt;The gesture parts.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum46"&gt; 46:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; Gesture(GestureType type, IRelativeGestureSegment[] gestureParts)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum47"&gt; 47:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum48"&gt; 48:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestureParts = gestureParts;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum49"&gt; 49:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.type = type;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum50"&gt; 50:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum51"&gt; 51:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum52"&gt; 52:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum53"&gt; 53:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Occurs when [gesture recognised].&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum54"&gt; 54:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum55"&gt; 55:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;event&lt;/span&gt; EventHandler&amp;lt;GestureEventArgs&amp;gt; GestureRecognised;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum56"&gt; 56:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum57"&gt; 57:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum58"&gt; 58:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Updates the gesture.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum59"&gt; 59:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum60"&gt; 60:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="data"&amp;gt;The skeleton data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum61"&gt; 61:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; UpdateGesture(SkeletonData data)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum62"&gt; 62:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum63"&gt; 63:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.paused)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum64"&gt; 64:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum65"&gt; 65:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount == &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.pausedFrameCount)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum66"&gt; 66:&lt;/span&gt;             {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum67"&gt; 67:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.paused = &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum68"&gt; 68:&lt;/span&gt;             }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum69"&gt; 69:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum70"&gt; 70:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount++;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum71"&gt; 71:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum72"&gt; 72:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum73"&gt; 73:&lt;/span&gt;         GesturePartResult result = &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestureParts[&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.currentGesturePart].CheckGesture(data);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum74"&gt; 74:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (result == GesturePartResult.Suceed)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum75"&gt; 75:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum76"&gt; 76:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.currentGesturePart + 1 &amp;lt; &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestureParts.Length)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum77"&gt; 77:&lt;/span&gt;             {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum78"&gt; 78:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.currentGesturePart++;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum79"&gt; 79:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum80"&gt; 80:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.pausedFrameCount = 10;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum81"&gt; 81:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.paused = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum82"&gt; 82:&lt;/span&gt;             }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum83"&gt; 83:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum84"&gt; 84:&lt;/span&gt;             {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum85"&gt; 85:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.GestureRecognised != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum86"&gt; 86:&lt;/span&gt;                 {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum87"&gt; 87:&lt;/span&gt;                     &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.GestureRecognised(&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; GestureEventArgs(&lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.type, data.TrackingID, data.UserIndex));&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum88"&gt; 88:&lt;/span&gt;                     &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.Reset();&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum89"&gt; 89:&lt;/span&gt;                 }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum90"&gt; 90:&lt;/span&gt;             }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum91"&gt; 91:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum92"&gt; 92:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (result == GesturePartResult.Fail || &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount == 50)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum93"&gt; 93:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum94"&gt; 94:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.currentGesturePart = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum95"&gt; 95:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum96"&gt; 96:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.pausedFrameCount = 5;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum97"&gt; 97:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.paused = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum98"&gt; 98:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum99"&gt; 99:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum100"&gt; 100:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum101"&gt; 101:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount++;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum102"&gt; 102:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.pausedFrameCount = 5;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum103"&gt; 103:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.paused = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum104"&gt; 104:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum105"&gt; 105:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum106"&gt; 106:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum107"&gt; 107:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum108"&gt; 108:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Resets this instance.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum109"&gt; 109:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum110"&gt; 110:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; Reset()&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum111"&gt; 111:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum112"&gt; 112:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.currentGesturePart = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum113"&gt; 113:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.frameCount = 0;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum114"&gt; 114:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.pausedFrameCount = 5;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum115"&gt; 115:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.paused = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum116"&gt; 116:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum117"&gt; 117:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h6&gt;&lt;b&gt;The IRelativeGestureSegment&lt;/b&gt;:&lt;/h6&gt;
&lt;p&gt;This is the final part of a gesture. It is essentially the individual segments that make up a gesture. Below is the IRelativeGestureSegment class and the implementations of this class for a wave gesture&lt;/p&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper"&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#region&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt;...&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; Microsoft.Research.Kinect.Nui;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// Defines a single gesture segment which uses relative positioning &lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// of body parts to detect a gesture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;interface&lt;/span&gt; IRelativeGestureSegment&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum11"&gt; 11:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum12"&gt; 12:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Checks the gesture.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum13"&gt; 13:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum14"&gt; 14:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="skeleton"&amp;gt;The skeleton.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum15"&gt; 15:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;returns&amp;gt;GesturePartResult based on if the gesture part has been completed&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum16"&gt; 16:&lt;/span&gt;     GesturePartResult CheckGesture(SkeletonData skeleton);&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum17"&gt; 17:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h5&gt;&lt;b&gt;&lt;/b&gt;&amp;nbsp;&lt;/h5&gt;
&lt;h5&gt;&lt;b&gt;Wave gesture&lt;/b&gt;&lt;/h5&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 535px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper"&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#region&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt;...&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; Microsoft.Research.Kinect.Nui;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: #cc6633;"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// the first part of the wave left gesture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; WaveLeftSegment1 : IRelativeGestureSegment&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum11"&gt; 11:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// Checks the gesture.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum12"&gt; 12:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum13"&gt; 13:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="skeleton"&amp;gt;The skeleton.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum14"&gt; 14:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;returns&amp;gt;GesturePartResult based on if the gesture part has been completed&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum15"&gt; 15:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; GesturePartResult CheckGesture(SkeletonData skeleton)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum16"&gt; 16:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum17"&gt; 17:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;// hand above elbow&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum18"&gt; 18:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (skeleton.Joints[JointID.HandLeft].Position.Y &amp;gt; skeleton.Joints[JointID.ElbowLeft].Position.Y)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum19"&gt; 19:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum20"&gt; 20:&lt;/span&gt;             &lt;span style="color: #008000;"&gt;// hand right of elbow&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum21"&gt; 21:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (skeleton.Joints[JointID.HandLeft].Position.X &amp;gt; skeleton.Joints[JointID.ElbowLeft].Position.X)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum22"&gt; 22:&lt;/span&gt;             {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum23"&gt; 23:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; GesturePartResult.Suceed;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum24"&gt; 24:&lt;/span&gt;             }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum25"&gt; 25:&lt;/span&gt;             &lt;span style="color: #008000;"&gt;// hand has not dropped but is not quite where we expect it to be, pausing till next frame&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum26"&gt; 26:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; GesturePartResult.Pausing;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum27"&gt; 27:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum28"&gt; 28:&lt;/span&gt;     &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum29"&gt; 29:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;// hand dropped - no gesture fails&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum30"&gt; 30:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; GesturePartResult.Fail;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum31"&gt; 31:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum32"&gt; 32:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum33"&gt; 33:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum34"&gt; 34:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum35"&gt; 35:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// The second part of the wave left gesture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum36"&gt; 36:&lt;/span&gt;     &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum37"&gt; 37:&lt;/span&gt;     &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; WaveLeftSegment2 : IRelativeGestureSegment&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum38"&gt; 38:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum39"&gt; 39:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum40"&gt; 40:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;/// Checks the gesture.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum41"&gt; 41:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum42"&gt; 42:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;/// &amp;lt;param name="skeleton"&amp;gt;The skeleton.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum43"&gt; 43:&lt;/span&gt;         &lt;span style="color: #008000;"&gt;/// &amp;lt;returns&amp;gt;GesturePartResult based on if the gesture part has been completed&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum44"&gt; 44:&lt;/span&gt;         &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; GesturePartResult CheckGesture(SkeletonData skeleton)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum45"&gt; 45:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum46"&gt; 46:&lt;/span&gt;             &lt;span style="color: #008000;"&gt;// hand above elbow&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum47"&gt; 47:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (skeleton.Joints[JointID.HandLeft].Position.Y &amp;gt; skeleton.Joints[JointID.ElbowLeft].Position.Y)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum48"&gt; 48:&lt;/span&gt;             {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum49"&gt; 49:&lt;/span&gt;                 &lt;span style="color: #008000;"&gt;// hand right of elbow&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum50"&gt; 50:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (skeleton.Joints[JointID.HandLeft].Position.X &amp;lt; skeleton.Joints[JointID.ElbowLeft].Position.X)&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum51"&gt; 51:&lt;/span&gt;                 {&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum52"&gt; 52:&lt;/span&gt;                     &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; GesturePartResult.Suceed;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum53"&gt; 53:&lt;/span&gt;                 }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum54"&gt; 54:&lt;/span&gt;                 &lt;span style="color: #008000;"&gt;// hand has not dropped but is not quite where we expect it to be, pausing till next frame&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum55"&gt; 55:&lt;/span&gt;                 &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; GesturePartResult.Pausing;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum56"&gt; 56:&lt;/span&gt;             }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum57"&gt; 57:&lt;/span&gt;             &lt;span style="color: #008000;"&gt;// hand dropped - no gesture fails&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum58"&gt; 58:&lt;/span&gt;             &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; GesturePartResult.Fail;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum59"&gt; 59:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum60"&gt; 60:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum61"&gt; 61:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;NOTE&lt;/b&gt;: a wave gesture is made up of two parts that are repeated three times. For example the code to create a new Wave gesture would look like this (gestures is the gesture controller):&lt;/p&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper"&gt;
&lt;div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum1"&gt; 1:&lt;/span&gt; IRelativeGestureSegment[] waveLeftSegments = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; IRelativeGestureSegment[6];&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum2"&gt; 2:&lt;/span&gt; WaveLeftSegment1 waveLeftSegment1 = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; WaveLeftSegment1();&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum3"&gt; 3:&lt;/span&gt; WaveLeftSegment2 waveLeftSegment2 = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; WaveLeftSegment2();&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum4"&gt; 4:&lt;/span&gt; waveLeftSegments[0] = waveLeftSegment1;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum5"&gt; 5:&lt;/span&gt; waveLeftSegments[1] = waveLeftSegment2;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum6"&gt; 6:&lt;/span&gt; waveLeftSegments[2] = waveLeftSegment1;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum7"&gt; 7:&lt;/span&gt; waveLeftSegments[3] = waveLeftSegment2;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum8"&gt; 8:&lt;/span&gt; waveLeftSegments[4] = waveLeftSegment1;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum9"&gt; 9:&lt;/span&gt; waveLeftSegments[5] = waveLeftSegment2;&lt;/pre&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"&gt;&lt;span style="color: #606060;" id="lnum10"&gt; 10:&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.gestures.AddGesture(GestureType.WaveLeft, waveLeftSegments);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The full source code for this example (and for skeleton tracking) can be downloaded &lt;a title="Download Sample Code" href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14/4747.Kinect.zip" target="_blank"&gt;here&lt;/a&gt;. It contains a wave gestures with both hands as well as swipe left, swipe right and a menu gesture. When writing your own gestures it is important to consider the amount of checking that is required and optimize this for each of the parts. Generally smaller segments work better as there is less checking to be done which improves performance.&lt;/p&gt;
&lt;p&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Michael+Tsikkos/default.aspx"&gt;Michael Tsikkos&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/James+Glading/default.aspx"&gt;James Glading&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10193601" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Michael+Tsikkos/">Michael Tsikkos</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/James+Glading/">James Glading</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Kinect/">Kinect</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Kinect+SDK/">Kinect SDK</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Kinect+for+Windows+SDK/">Kinect for Windows SDK</category></item><item><title>First Look at the Kinect for Windows SDK</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/08/first-look-at-the-kinect-for-windows-sdk.aspx</link><pubDate>Mon, 08 Aug 2011 10:39:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10193596</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10193596</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/08/first-look-at-the-kinect-for-windows-sdk.aspx#comments</comments><description>&lt;div class="ExternalClass16F1DE0E753246D49C5FC19D19EDF0F5"&gt;   &lt;p&gt;The Kinect for Windows SDK has finally arrived, and we couldn’t wait to get our hands on it! &lt;/p&gt;    &lt;p&gt;After downloading, installing, and actually getting a Kinect with a USB connector for our PC’s, we were good to go… &lt;/p&gt;    &lt;h5&gt;&lt;b&gt;Step 1 – What does the SDK give us?&lt;/b&gt;&lt;/h5&gt;    &lt;p&gt;When we started, we didn’t really know what to expect from the SDK. &lt;/p&gt;    &lt;p&gt;What you get are a set of 20 points, each corresponding to a specific joint in the body. These points come in standard ‘&lt;b&gt;x, y, z’&lt;/b&gt; coordinates, with an extra coordinate&lt;b&gt; ‘w’&lt;/b&gt;, which we haven’t got round to figuring out what it is there for just yet. &lt;/p&gt;    &lt;p&gt;Here comes problem one. The points that are given are within the range -1 and 1, going from left to right for x, and bottom to top with y. Therefore, you have to first convert these to work with WPF applications so that if fits within the coordinates of a standard page. &lt;/p&gt;    &lt;p&gt;This part was just a formality and had a very simple fix with a couple of converters. &lt;/p&gt;    &lt;p&gt;One for X:&lt;/p&gt;    &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 507px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;       &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// Joint converter&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; KinectValueToScreenCoOrdinatesConverterX : IValueConverter&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// Converts a value.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;value&amp;quot;&amp;gt;The value produced by the binding source.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;targetType&amp;quot;&amp;gt;The type of the binding target property.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;parameter&amp;quot;&amp;gt;The converter parameter to use.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;culture&amp;quot;&amp;gt;The culture to use in the converter.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// A converted value. If the method returns null, the valid null value is used.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; Convert(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;, Type targetType, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; parameter, System.Globalization.CultureInfo culture)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; multiplier = Application.Current.MainWindow.Width;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; translation = 0;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (parameter != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;                 translation = &lt;span style="color: #0000ff"&gt;double&lt;/span&gt;.Parse(parameter &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; fl = (&lt;span style="color: #0000ff"&gt;float&lt;/span&gt;)&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; translation + (multiplier + (fl * multiplier));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;        }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;        &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (InvalidCastException)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;        {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 0;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;     }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// Converts a value.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;value&amp;quot;&amp;gt;The value that is produced by the binding target.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;targetType&amp;quot;&amp;gt;The type to convert to.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;parameter&amp;quot;&amp;gt;The converter parameter to use.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;culture&amp;quot;&amp;gt;The culture to use in the converter.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// A converted value. If the method returns null, the valid null value is used.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; ConvertBack(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;, Type targetType, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; parameter, System.Globalization.CultureInfo culture)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NotImplementedException();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;     }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;And one for Y:&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 504px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// Joint converter Y&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; KinectValueToScreenCoOrdinatesConverterY : IValueConverter&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// Converts a value.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;value&amp;quot;&amp;gt;The value produced by the binding source.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;targetType&amp;quot;&amp;gt;The type of the binding target property.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;parameter&amp;quot;&amp;gt;The converter parameter to use.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;culture&amp;quot;&amp;gt;The culture to use in the converter.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// A converted value. If the method returns null, the valid null value is used.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; Convert(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;, Type targetType, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; parameter, System.Globalization.CultureInfo culture)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; multiplier = Application.Current.MainWindow.Height;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; translation = 0;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (parameter != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;                     translation = &lt;span style="color: #0000ff"&gt;double&lt;/span&gt;.Parse(parameter &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; fl = (&lt;span style="color: #0000ff"&gt;float&lt;/span&gt;)&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; translation + (multiplier + (-fl * multiplier));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (InvalidCastException)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 0;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Converts a value.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;value&amp;quot;&amp;gt;The value that is produced by the binding target.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;targetType&amp;quot;&amp;gt;The type to convert to.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;parameter&amp;quot;&amp;gt;The converter parameter to use.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;culture&amp;quot;&amp;gt;The culture to use in the converter.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// A converted value. If the method returns null, the valid null value is used.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; ConvertBack(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;, Type targetType, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; parameter, System.Globalization.CultureInfo culture)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NotImplementedException();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt;     }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;A converter is assigned to every part of the skeleton that is displayed on the UI. Since Kinect returns a series of skeletons (each one representing a person) with the points already mapped to each joint, we decided to drive the MVVM pattern directly off of the SkeletonData that Kinect returns. &lt;/p&gt;

  &lt;h5&gt;&lt;b&gt;Step 2 – Putting everything into the MVVM pattern&lt;/b&gt;&lt;/h5&gt;

  &lt;p&gt;To simplify things and make it easier to create multiple skeletons on screen at any one time, we decided to use the MVVM pattern. There are four main parts to this: &lt;/p&gt;

  &lt;p&gt;1. The Kinect connection &lt;/p&gt;

  &lt;p&gt;2. The Main View Model &lt;/p&gt;

  &lt;p&gt;3. The Skeleton View Model &lt;/p&gt;

  &lt;p&gt;4. The UI &lt;/p&gt;

  &lt;h6&gt;&lt;b&gt;Kinect Connection&lt;/b&gt;&lt;/h6&gt;

  &lt;p&gt;The Kinect connection is an intermediate class between our view models and the Kinect sensor. It fires Skeleton ready events for each skeleton that is returned and skeleton frame complete events when an entire frame has been processed. As it processes the skeletons in a frame, it keeps track of their ID value so we can track all the skeletons that were in a frame during the Skeleton Frame Complete event. &lt;/p&gt;

  &lt;p&gt;One of the main parts of this class is the InitializeNui() method:&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 686px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Initializes the Kinect sensor.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;bool value true if the sensor initialised correctly&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; InitializeNui()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.kinectRunTime == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.kinectRunTime.Initialize(RuntimeOptions.UseDepth | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (Exception exception)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;                 Console.WriteLine(exception.ToString());&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.kinectRunTime.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.kinectRunTime.SkeletonEngine.TransformSmooth = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;             var parameters = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TransformSmoothParameters&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;                 Smoothing = 0.75f,&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;                 Correction = 0.0f,&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;                 Prediction = 0.0f,&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;                 JitterRadius = 0.05f,&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;                 MaxDeviationRadius = 0.04f&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;             };&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.kinectRunTime.SkeletonEngine.SmoothParameters = parameters;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;     }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;This method initialises the Kinect sensor with a set of pre define arguments. The actual initialization of the sensor happens in the line :&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 71px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.kinectRunTime.Initialize(RuntimeOptions.UseDepth | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;The runtime options specify what you want the Kinect sensor to look for. In our example we were looking for skeleton frames and images from the camera. &lt;/p&gt;

  &lt;p&gt;&lt;b&gt;Main View Model&lt;/b&gt; &lt;/p&gt;

  &lt;p&gt;The main view model controls the allocation of skeletons to the skeleton view models. It contains a list of Skeleton View models and a dictionary of skeleton view models with the skeleton id as the key. Each time a skeleton ready event is fired in the Kinect connection it looks up the skeleton ID value in the dictionary and assigns the new skeleton data to the skeleton in that view model. &lt;/p&gt;

  &lt;p&gt;Originally the Main view model was also going to sort out the removal of skeletons that are no longer active. However the Kinect sensor does not always return all of the active skeletons in each of the Skelton frame ready events that the Kinect SDK produce. This means that a simple removal of any skeletons not in the current frame will fail and the view model associated with a skeleton will be continuously deleted and re-created. To get around this we placed a timer in each of the skeleton view models. If the view model is not updated within a set period of time the view model raises an event and the main view model then catches it and deleted the skeleton. &lt;/p&gt;

  &lt;p&gt;&lt;b&gt;The Skeleton View Model&lt;/b&gt; &lt;/p&gt;

  &lt;p&gt;The skeleton view model is essentially a way of exposing the properties of a SkeletonData object so that the UI can bind to them. When the skeleton property is changed a NotifyPropertyChanged event is raised on all of the exposed properties which updates all the bindings on the UI. &lt;/p&gt;

  &lt;p&gt;The skeleton view model also controls the Gesture Service which we will discuss in our next blog post. This is again updated when the skeleton property changes. &lt;/p&gt;

  &lt;p&gt;The full code for the skeleton view model can be found in the source code below: &lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 716px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// The main view model&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; SkeletonViewModel : INotifyPropertyChanged&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The gesture controler for this skeleton&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; GestureControler gestures = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; GestureControler();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; fields&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// backing field for the gesture text&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; gestureText;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// backing field for the gesture property&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; gestureDetected;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The skeleton data&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// This is used as the backing field for all properties&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; SkeletonData skeleton;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// backing field for the joint color&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Color jointColor;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Occurs when [delete skeleton].&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;event&lt;/span&gt; EventHandler DeleteSkeleton;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;         &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// the timer for the on screen gesture text&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; DispatcherTimer textTimer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DispatcherTimer() { Interval = TimeSpan.FromSeconds(3) };&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; constructors&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Initializes a new instance of the &amp;lt;see cref=&amp;quot;SkeletonViewModel&amp;quot;/&amp;gt; class.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; SkeletonViewModel()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum52"&gt;  52:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum53"&gt;  53:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ChangeTimer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DispatcherTimer();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum54"&gt;  54:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ChangeTimer.Interval = TimeSpan.FromSeconds(0.5);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum55"&gt;  55:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ChangeTimer.Tick += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ChangeTimer_Tick);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum56"&gt;  56:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Tick += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.TextTimer_Tick);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum57"&gt;  57:&lt;/span&gt;             ChangeTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum58"&gt;  58:&lt;/span&gt;             DefineGestures();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum59"&gt;  59:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.GestureRecognised += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;GestureEventArgs&amp;gt;(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Gestures_GestureRecognised);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum60"&gt;  60:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum61"&gt;  61:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum62"&gt;  62:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum63"&gt;  63:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum64"&gt;  64:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; events&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum65"&gt;  65:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum66"&gt;  66:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum67"&gt;  67:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Occurs when a property value changes.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum68"&gt;  68:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum69"&gt;  69:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;event&lt;/span&gt; PropertyChangedEventHandler PropertyChanged;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum70"&gt;  70:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum71"&gt;  71:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum72"&gt;  72:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum73"&gt;  73:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; properties&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum74"&gt;  74:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum75"&gt;  75:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum76"&gt;  76:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets or sets the change timer.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum77"&gt;  77:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum78"&gt;  78:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum79"&gt;  79:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The change timer.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum80"&gt;  80:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum81"&gt;  81:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; DispatcherTimer ChangeTimer&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum82"&gt;  82:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum83"&gt;  83:&lt;/span&gt;             get;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum84"&gt;  84:&lt;/span&gt;             set;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum85"&gt;  85:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum86"&gt;  86:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum87"&gt;  87:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum88"&gt;  88:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets or sets the gesture text.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum89"&gt;  89:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum90"&gt;  90:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum91"&gt;  91:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The gesture text.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum92"&gt;  92:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum93"&gt;  93:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; GestureText&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum94"&gt;  94:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum95"&gt;  95:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum96"&gt;  96:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum97"&gt;  97:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestureText;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum98"&gt;  98:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum99"&gt;  99:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum100"&gt; 100:&lt;/span&gt;             set&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum101"&gt; 101:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum102"&gt; 102:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestureText != &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum103"&gt; 103:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum104"&gt; 104:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestureText = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum105"&gt; 105:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;GestureText&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum106"&gt; 106:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum107"&gt; 107:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum108"&gt; 108:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum109"&gt; 109:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum110"&gt; 110:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum111"&gt; 111:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets or sets a value indicating whether this &amp;lt;see cref=&amp;quot;SkeletonViewModel&amp;quot;/&amp;gt; is waved.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum112"&gt; 112:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum113"&gt; 113:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum114"&gt; 114:&lt;/span&gt;         &lt;span style="color: #008000"&gt;///   &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt; if waved; otherwise, &amp;lt;c&amp;gt;false&amp;lt;/c&amp;gt;.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum115"&gt; 115:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum116"&gt; 116:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; GestureDetected&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum117"&gt; 117:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum118"&gt; 118:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum119"&gt; 119:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum120"&gt; 120:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestureDetected;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum121"&gt; 121:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum122"&gt; 122:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum123"&gt; 123:&lt;/span&gt;             set&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum124"&gt; 124:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum125"&gt; 125:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestureDetected != &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum126"&gt; 126:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum127"&gt; 127:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestureDetected = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum128"&gt; 128:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;GestureDetected&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum129"&gt; 129:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum130"&gt; 130:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum131"&gt; 131:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum132"&gt; 132:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum133"&gt; 133:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum134"&gt; 134:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets or sets the color of the joint.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum135"&gt; 135:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum136"&gt; 136:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum137"&gt; 137:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The color of the joint.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum138"&gt; 138:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum139"&gt; 139:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Color JointColor&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum140"&gt; 140:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum141"&gt; 141:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum142"&gt; 142:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum143"&gt; 143:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.jointColor;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum144"&gt; 144:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum145"&gt; 145:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum146"&gt; 146:&lt;/span&gt;             set&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum147"&gt; 147:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum148"&gt; 148:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.jointColor != &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum149"&gt; 149:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum150"&gt; 150:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.jointColor = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum151"&gt; 151:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;JointColor&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum152"&gt; 152:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum153"&gt; 153:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum154"&gt; 154:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum155"&gt; 155:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum156"&gt; 156:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum157"&gt; 157:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets or sets the skeleton.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum158"&gt; 158:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum159"&gt; 159:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum160"&gt; 160:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The skeleton.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum161"&gt; 161:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum162"&gt; 162:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; SkeletonData Skeleton&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum163"&gt; 163:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum164"&gt; 164:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum165"&gt; 165:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum166"&gt; 166:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.skeleton;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum167"&gt; 167:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum168"&gt; 168:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum169"&gt; 169:&lt;/span&gt;             set&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum170"&gt; 170:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum171"&gt; 171:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.skeleton != &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum172"&gt; 172:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum173"&gt; 173:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.skeleton = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum174"&gt; 174:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;Skeleton&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum175"&gt; 175:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyAllChange();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum176"&gt; 176:&lt;/span&gt;                     ResetTimer();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum177"&gt; 177:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.UpdateAllGestures(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.skeleton);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum178"&gt; 178:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum179"&gt; 179:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum180"&gt; 180:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum181"&gt; 181:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum182"&gt; 182:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; KinectBodyParts&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum183"&gt; 183:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum184"&gt; 184:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum185"&gt; 185:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the head.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum186"&gt; 186:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum187"&gt; 187:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint Head&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum188"&gt; 188:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum189"&gt; 189:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum190"&gt; 190:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum191"&gt; 191:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum192"&gt; 192:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum193"&gt; 193:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.Head];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum194"&gt; 194:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum195"&gt; 195:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum196"&gt; 196:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum197"&gt; 197:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum198"&gt; 198:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum199"&gt; 199:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum200"&gt; 200:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum201"&gt; 201:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum202"&gt; 202:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum203"&gt; 203:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the left hand.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum204"&gt; 204:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum205"&gt; 205:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftHand&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum206"&gt; 206:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum207"&gt; 207:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum208"&gt; 208:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum209"&gt; 209:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum210"&gt; 210:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum211"&gt; 211:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.HandLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum212"&gt; 212:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum213"&gt; 213:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum214"&gt; 214:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum215"&gt; 215:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum216"&gt; 216:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum217"&gt; 217:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum218"&gt; 218:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum219"&gt; 219:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum220"&gt; 220:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum221"&gt; 221:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the right hand.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum222"&gt; 222:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum223"&gt; 223:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightHand&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum224"&gt; 224:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum225"&gt; 225:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum226"&gt; 226:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum227"&gt; 227:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum228"&gt; 228:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum229"&gt; 229:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.HandRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum230"&gt; 230:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum231"&gt; 231:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum232"&gt; 232:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum233"&gt; 233:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum234"&gt; 234:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum235"&gt; 235:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum236"&gt; 236:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum237"&gt; 237:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum238"&gt; 238:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum239"&gt; 239:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the left wrist.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum240"&gt; 240:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum241"&gt; 241:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftWrist&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum242"&gt; 242:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum243"&gt; 243:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum244"&gt; 244:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum245"&gt; 245:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum246"&gt; 246:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum247"&gt; 247:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.WristLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum248"&gt; 248:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum249"&gt; 249:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum250"&gt; 250:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum251"&gt; 251:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum252"&gt; 252:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum253"&gt; 253:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum254"&gt; 254:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum255"&gt; 255:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum256"&gt; 256:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum257"&gt; 257:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the right wrist.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum258"&gt; 258:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum259"&gt; 259:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightWrist&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum260"&gt; 260:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum261"&gt; 261:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum262"&gt; 262:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum263"&gt; 263:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum264"&gt; 264:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum265"&gt; 265:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.WristRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum266"&gt; 266:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum267"&gt; 267:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum268"&gt; 268:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum269"&gt; 269:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum270"&gt; 270:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum271"&gt; 271:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum272"&gt; 272:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum273"&gt; 273:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum274"&gt; 274:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum275"&gt; 275:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the left elbow.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum276"&gt; 276:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum277"&gt; 277:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftElbow&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum278"&gt; 278:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum279"&gt; 279:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum280"&gt; 280:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum281"&gt; 281:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum282"&gt; 282:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum283"&gt; 283:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.ElbowLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum284"&gt; 284:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum285"&gt; 285:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum286"&gt; 286:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum287"&gt; 287:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum288"&gt; 288:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum289"&gt; 289:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum290"&gt; 290:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum291"&gt; 291:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum292"&gt; 292:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum293"&gt; 293:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the right elbow.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum294"&gt; 294:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum295"&gt; 295:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightElbow&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum296"&gt; 296:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum297"&gt; 297:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum298"&gt; 298:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum299"&gt; 299:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum300"&gt; 300:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum301"&gt; 301:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.ElbowRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum302"&gt; 302:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum303"&gt; 303:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum304"&gt; 304:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum305"&gt; 305:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum306"&gt; 306:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum307"&gt; 307:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum308"&gt; 308:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum309"&gt; 309:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum310"&gt; 310:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum311"&gt; 311:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the shoulder center.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum312"&gt; 312:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum313"&gt; 313:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint ShoulderCenter&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum314"&gt; 314:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum315"&gt; 315:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum316"&gt; 316:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum317"&gt; 317:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum318"&gt; 318:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum319"&gt; 319:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.ShoulderCenter];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum320"&gt; 320:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum321"&gt; 321:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum322"&gt; 322:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum323"&gt; 323:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum324"&gt; 324:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum325"&gt; 325:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum326"&gt; 326:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum327"&gt; 327:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum328"&gt; 328:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum329"&gt; 329:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the spine.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum330"&gt; 330:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum331"&gt; 331:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint Spine&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum332"&gt; 332:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum333"&gt; 333:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum334"&gt; 334:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum335"&gt; 335:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum336"&gt; 336:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum337"&gt; 337:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.Spine];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum338"&gt; 338:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum339"&gt; 339:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum340"&gt; 340:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum341"&gt; 341:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum342"&gt; 342:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum343"&gt; 343:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum344"&gt; 344:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum345"&gt; 345:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum346"&gt; 346:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum347"&gt; 347:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the hip center.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum348"&gt; 348:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum349"&gt; 349:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint HipCenter&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum350"&gt; 350:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum351"&gt; 351:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum352"&gt; 352:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum353"&gt; 353:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum354"&gt; 354:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum355"&gt; 355:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.HipCenter];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum356"&gt; 356:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum357"&gt; 357:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum358"&gt; 358:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum359"&gt; 359:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum360"&gt; 360:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum361"&gt; 361:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum362"&gt; 362:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum363"&gt; 363:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum364"&gt; 364:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum365"&gt; 365:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the left knee.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum366"&gt; 366:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum367"&gt; 367:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftKnee&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum368"&gt; 368:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum369"&gt; 369:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum370"&gt; 370:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum371"&gt; 371:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum372"&gt; 372:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum373"&gt; 373:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.KneeLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum374"&gt; 374:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum375"&gt; 375:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum376"&gt; 376:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum377"&gt; 377:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum378"&gt; 378:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum379"&gt; 379:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum380"&gt; 380:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum381"&gt; 381:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum382"&gt; 382:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum383"&gt; 383:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the right knee.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum384"&gt; 384:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum385"&gt; 385:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightKnee&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum386"&gt; 386:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum387"&gt; 387:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum388"&gt; 388:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum389"&gt; 389:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum390"&gt; 390:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum391"&gt; 391:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.KneeRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum392"&gt; 392:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum393"&gt; 393:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum394"&gt; 394:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum395"&gt; 395:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum396"&gt; 396:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum397"&gt; 397:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum398"&gt; 398:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum399"&gt; 399:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum400"&gt; 400:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum401"&gt; 401:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the left ankle.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum402"&gt; 402:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum403"&gt; 403:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftAnkle&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum404"&gt; 404:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum405"&gt; 405:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum406"&gt; 406:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum407"&gt; 407:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum408"&gt; 408:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum409"&gt; 409:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.AnkleLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum410"&gt; 410:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum411"&gt; 411:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum412"&gt; 412:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum413"&gt; 413:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum414"&gt; 414:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum415"&gt; 415:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum416"&gt; 416:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum417"&gt; 417:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum418"&gt; 418:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum419"&gt; 419:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the right ankle.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum420"&gt; 420:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum421"&gt; 421:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightAnkle&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum422"&gt; 422:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum423"&gt; 423:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum424"&gt; 424:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum425"&gt; 425:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum426"&gt; 426:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum427"&gt; 427:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.AnkleRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum428"&gt; 428:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum429"&gt; 429:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum430"&gt; 430:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum431"&gt; 431:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum432"&gt; 432:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum433"&gt; 433:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum434"&gt; 434:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum435"&gt; 435:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum436"&gt; 436:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum437"&gt; 437:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the left foot.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum438"&gt; 438:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum439"&gt; 439:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftFoot&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum440"&gt; 440:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum441"&gt; 441:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum442"&gt; 442:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum443"&gt; 443:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum444"&gt; 444:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum445"&gt; 445:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.FootLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum446"&gt; 446:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum447"&gt; 447:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum448"&gt; 448:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum449"&gt; 449:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum450"&gt; 450:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum451"&gt; 451:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum452"&gt; 452:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum453"&gt; 453:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum454"&gt; 454:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum455"&gt; 455:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the right foot.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum456"&gt; 456:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum457"&gt; 457:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightFoot&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum458"&gt; 458:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum459"&gt; 459:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum460"&gt; 460:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum461"&gt; 461:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum462"&gt; 462:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum463"&gt; 463:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.FootRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum464"&gt; 464:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum465"&gt; 465:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum466"&gt; 466:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum467"&gt; 467:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum468"&gt; 468:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum469"&gt; 469:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum470"&gt; 470:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum471"&gt; 471:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum472"&gt; 472:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum473"&gt; 473:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the Left Hip&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum474"&gt; 474:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum475"&gt; 475:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightHip&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum476"&gt; 476:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum477"&gt; 477:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum478"&gt; 478:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum479"&gt; 479:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum480"&gt; 480:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum481"&gt; 481:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.HipRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum482"&gt; 482:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum483"&gt; 483:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum484"&gt; 484:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum485"&gt; 485:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum486"&gt; 486:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum487"&gt; 487:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum488"&gt; 488:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum489"&gt; 489:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum490"&gt; 490:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum491"&gt; 491:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the Left Hip&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum492"&gt; 492:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum493"&gt; 493:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftHip&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum494"&gt; 494:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum495"&gt; 495:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum496"&gt; 496:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum497"&gt; 497:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum498"&gt; 498:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum499"&gt; 499:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.HipLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum500"&gt; 500:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum501"&gt; 501:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum502"&gt; 502:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum503"&gt; 503:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum504"&gt; 504:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum505"&gt; 505:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum506"&gt; 506:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum507"&gt; 507:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum508"&gt; 508:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum509"&gt; 509:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the Right Shoulder&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum510"&gt; 510:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum511"&gt; 511:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint RightShoulder&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum512"&gt; 512:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum513"&gt; 513:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum514"&gt; 514:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum515"&gt; 515:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum516"&gt; 516:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum517"&gt; 517:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.ShoulderRight];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum518"&gt; 518:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum519"&gt; 519:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum520"&gt; 520:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum521"&gt; 521:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum522"&gt; 522:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum523"&gt; 523:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum524"&gt; 524:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum525"&gt; 525:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum526"&gt; 526:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum527"&gt; 527:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Gets the Left Shoulder&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum528"&gt; 528:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum529"&gt; 529:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Joint LeftShoulder&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum530"&gt; 530:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum531"&gt; 531:&lt;/span&gt;             get&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum532"&gt; 532:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum533"&gt; 533:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum534"&gt; 534:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum535"&gt; 535:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Skeleton.Joints[JointID.ShoulderLeft];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum536"&gt; 536:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum537"&gt; 537:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum538"&gt; 538:&lt;/span&gt;                 {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum539"&gt; 539:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Joint();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum540"&gt; 540:&lt;/span&gt;                 }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum541"&gt; 541:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum542"&gt; 542:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum543"&gt; 543:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum544"&gt; 544:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum545"&gt; 545:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum546"&gt; 546:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum547"&gt; 547:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; methods&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum548"&gt; 548:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum549"&gt; 549:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum550"&gt; 550:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Handles the Tick event of the textTimer control.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum551"&gt; 551:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum552"&gt; 552:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum553"&gt; 553:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum554"&gt; 554:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; TextTimer_Tick(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum555"&gt; 555:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum556"&gt; 556:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureDetected = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum557"&gt; 557:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Stop();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum558"&gt; 558:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum559"&gt; 559:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum560"&gt; 560:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum561"&gt; 561:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Handles the GestureRecognised event of the Gestures control.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum562"&gt; 562:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum563"&gt; 563:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum564"&gt; 564:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;KinectSkeltonTracker.GestureEventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum565"&gt; 565:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Gestures_GestureRecognised(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, GestureEventArgs e)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum566"&gt; 566:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum567"&gt; 567:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.GestureType == GestureType.WaveRight)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum568"&gt; 568:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum569"&gt; 569:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureDetected = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum570"&gt; 570:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureText = &lt;span style="color: #006080"&gt;&amp;quot;Waved with right hand&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum571"&gt; 571:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum572"&gt; 572:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum573"&gt; 573:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.GestureType == GestureType.WaveLeft)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum574"&gt; 574:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum575"&gt; 575:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureDetected = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum576"&gt; 576:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureText = &lt;span style="color: #006080"&gt;&amp;quot;Waved with left hand&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum577"&gt; 577:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum578"&gt; 578:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum579"&gt; 579:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.GestureType == GestureType.LeftSwipe)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum580"&gt; 580:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum581"&gt; 581:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureDetected = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum582"&gt; 582:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureText = &lt;span style="color: #006080"&gt;&amp;quot;Swiped left&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum583"&gt; 583:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum584"&gt; 584:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum585"&gt; 585:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.GestureType == GestureType.RightSwipe)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum586"&gt; 586:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum587"&gt; 587:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureDetected = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum588"&gt; 588:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureText = &lt;span style="color: #006080"&gt;&amp;quot;Swiped right&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum589"&gt; 589:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum590"&gt; 590:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum591"&gt; 591:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.GestureType == GestureType.Menu)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum592"&gt; 592:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum593"&gt; 593:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureDetected = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum594"&gt; 594:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GestureText = &lt;span style="color: #006080"&gt;&amp;quot;Menu&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum595"&gt; 595:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.textTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum596"&gt; 596:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum597"&gt; 597:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum598"&gt; 598:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum599"&gt; 599:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum600"&gt; 600:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Defines the gestures.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum601"&gt; 601:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum602"&gt; 602:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; DefineGestures()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum603"&gt; 603:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum604"&gt; 604:&lt;/span&gt;             IRelativeGestureSegment[] waveRightSegments = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IRelativeGestureSegment[6];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum605"&gt; 605:&lt;/span&gt;             WaveRightSegment1 waveRightSegment1 = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WaveRightSegment1();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum606"&gt; 606:&lt;/span&gt;             WaveRightSegment2 waveRightSegment2 = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WaveRightSegment2();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum607"&gt; 607:&lt;/span&gt;             waveRightSegments[0] = waveRightSegment1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum608"&gt; 608:&lt;/span&gt;             waveRightSegments[1] = waveRightSegment2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum609"&gt; 609:&lt;/span&gt;             waveRightSegments[2] = waveRightSegment1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum610"&gt; 610:&lt;/span&gt;             waveRightSegments[3] = waveRightSegment2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum611"&gt; 611:&lt;/span&gt;             waveRightSegments[4] = waveRightSegment1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum612"&gt; 612:&lt;/span&gt;             waveRightSegments[5] = waveRightSegment2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum613"&gt; 613:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.AddGesture(GestureType.WaveRight, waveRightSegments);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum614"&gt; 614:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum615"&gt; 615:&lt;/span&gt;             IRelativeGestureSegment[] waveLeftSegments = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IRelativeGestureSegment[6];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum616"&gt; 616:&lt;/span&gt;             WaveLeftSegment1 waveLeftSegment1 = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WaveLeftSegment1();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum617"&gt; 617:&lt;/span&gt;             WaveLeftSegment2 waveLeftSegment2 = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WaveLeftSegment2();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum618"&gt; 618:&lt;/span&gt;             waveLeftSegments[0] = waveLeftSegment1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum619"&gt; 619:&lt;/span&gt;             waveLeftSegments[1] = waveLeftSegment2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum620"&gt; 620:&lt;/span&gt;             waveLeftSegments[2] = waveLeftSegment1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum621"&gt; 621:&lt;/span&gt;             waveLeftSegments[3] = waveLeftSegment2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum622"&gt; 622:&lt;/span&gt;             waveLeftSegments[4] = waveLeftSegment1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum623"&gt; 623:&lt;/span&gt;             waveLeftSegments[5] = waveLeftSegment2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum624"&gt; 624:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.AddGesture(GestureType.WaveLeft, waveLeftSegments);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum625"&gt; 625:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum626"&gt; 626:&lt;/span&gt;             IRelativeGestureSegment[] swipeleftSegments = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IRelativeGestureSegment[3];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum627"&gt; 627:&lt;/span&gt;             swipeleftSegments[0] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SwipeLeftSegment1();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum628"&gt; 628:&lt;/span&gt;             swipeleftSegments[1] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SwipeLeftSegment2();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum629"&gt; 629:&lt;/span&gt;             swipeleftSegments[2] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SwipeLeftSegment3();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum630"&gt; 630:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.AddGesture(GestureType.LeftSwipe, swipeleftSegments);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum631"&gt; 631:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum632"&gt; 632:&lt;/span&gt;             IRelativeGestureSegment[] swiperightSegments = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IRelativeGestureSegment[3];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum633"&gt; 633:&lt;/span&gt;             swiperightSegments[0] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SwipeRightSegment1();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum634"&gt; 634:&lt;/span&gt;             swiperightSegments[1] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SwipeRightSegment2();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum635"&gt; 635:&lt;/span&gt;             swiperightSegments[2] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SwipeRightSegment3();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum636"&gt; 636:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.AddGesture(GestureType.RightSwipe, swiperightSegments);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum637"&gt; 637:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum638"&gt; 638:&lt;/span&gt;             IRelativeGestureSegment[] menuSegments = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IRelativeGestureSegment[20];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum639"&gt; 639:&lt;/span&gt;             MenuSegments1 menuSegment = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MenuSegments1();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum640"&gt; 640:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 20; i++)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum641"&gt; 641:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum642"&gt; 642:&lt;/span&gt;                 &lt;span style="color: #008000"&gt;//gesture consists of the same thing 20 times &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum643"&gt; 643:&lt;/span&gt;                 menuSegments[i] = menuSegment;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum644"&gt; 644:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum645"&gt; 645:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum646"&gt; 646:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.gestures.AddGesture(GestureType.Menu, menuSegments);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum647"&gt; 647:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum648"&gt; 648:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum649"&gt; 649:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum650"&gt; 650:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Handles the Tick event of the ChangeTimer control.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum651"&gt; 651:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum652"&gt; 652:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum653"&gt; 653:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum654"&gt; 654:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ChangeTimer_Tick(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum655"&gt; 655:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum656"&gt; 656:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.DeleteSkeleton != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum657"&gt; 657:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum658"&gt; 658:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.DeleteSkeleton(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum659"&gt; 659:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum660"&gt; 660:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum661"&gt; 661:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum662"&gt; 662:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum663"&gt; 663:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Resets the timer.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum664"&gt; 664:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum665"&gt; 665:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ResetTimer()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum666"&gt; 666:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum667"&gt; 667:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ChangeTimer.Stop();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum668"&gt; 668:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ChangeTimer.Start();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum669"&gt; 669:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum670"&gt; 670:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum671"&gt; 671:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum672"&gt; 672:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Notifies all change.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum673"&gt; 673:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum674"&gt; 674:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; NotifyAllChange()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum675"&gt; 675:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum676"&gt; 676:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;Head&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum677"&gt; 677:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftHand&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum678"&gt; 678:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftHandX&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum679"&gt; 679:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftHandY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum680"&gt; 680:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;RightHand&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum681"&gt; 681:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftWrist&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum682"&gt; 682:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;RightWrist&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum683"&gt; 683:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftElbow&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum684"&gt; 684:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;RightElbow&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum685"&gt; 685:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;ShoulderCenter&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum686"&gt; 686:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;HipCenter&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum687"&gt; 687:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftKnee&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum688"&gt; 688:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;RightKnee&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum689"&gt; 689:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftAnkle&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum690"&gt; 690:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;RightAnkle&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum691"&gt; 691:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;LeftFoot&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum692"&gt; 692:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;RightFoot&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum693"&gt; 693:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyPropertyChanged(&lt;span style="color: #006080"&gt;&amp;quot;Spine&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum694"&gt; 694:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum695"&gt; 695:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum696"&gt; 696:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum697"&gt; 697:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Notifies the property changed.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum698"&gt; 698:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum699"&gt; 699:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;propertyName&amp;quot;&amp;gt;Name of the property.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum700"&gt; 700:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; NotifyPropertyChanged(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum701"&gt; 701:&lt;/span&gt;         {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum702"&gt; 702:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PropertyChanged != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum703"&gt; 703:&lt;/span&gt;             {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum704"&gt; 704:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PropertyChanged(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PropertyChangedEventArgs(propertyName));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum705"&gt; 705:&lt;/span&gt;             }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum706"&gt; 706:&lt;/span&gt;         }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum707"&gt; 707:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum708"&gt; 708:&lt;/span&gt;         &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum709"&gt; 709:&lt;/span&gt;     }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum710"&gt; 710:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;h5&gt;&lt;b&gt;Step 3 – Getting some sort of visual representation.&lt;/b&gt;&lt;/h5&gt;

  &lt;p&gt;Before we do anything with the points that are coming through, the first thing to do is to simply display the camera feed from the Kinect. This is very easy to do. &lt;/p&gt;

  &lt;p&gt;In the XAML, add an image control (i.e. called “cameraFeed”). In the code, when the main window is created, set up an event handler for the Kinect’s ImageFrameReady property; and it will be called once the SDK has picked up an image. &lt;/p&gt;

  &lt;p&gt;Within the handler, create a ‘PlanarImage’ from the event args, and then set the image source of the image control to a new BitmapSource as seen below:&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 253px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; MainWindow()&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     InitializeComponent();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//other stuff here        &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     model.Kinect.ImageFrameReady += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;Microsoft.Research.Kinect.Nui.ImageFrameReadyEventArgs&amp;gt;(kinect_ImageFrameReady);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; kinect_ImageFrameReady(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, Microsoft.Research.Kinect.Nui.ImageFrameReadyEventArgs e)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     PlanarImage image = e.ImageFrame.Image;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     cameraFeed.Source = BitmapSource.Create(image.Width, image.Height, 96, 96, PixelFormats.Bgr32, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, image.Bits, image.Width * image.BytesPerPixel);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt; }&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;Now let’s do something with the actual points we have obtained. &lt;/p&gt;

  &lt;p&gt;What we wanted to do here was to create a very simple “image” of a skeleton on the screen. &lt;/p&gt;

  &lt;p&gt;One thing we did here was to disregard some points from the skeleton. We found it irrelevant to display a few points (i.e. shoulder blades, and sides of the hips etc.), as it didn’t really make the skeleton look or perform any differently, and by excluding them, improved the performance of the entire application. &lt;/p&gt;

  &lt;p&gt;So, with what remained, we used a combination of ellipses and lines to represent the skeleton. &lt;/p&gt;

  &lt;p&gt;Simple enough to start off with, add an items control to the page, and within its Data Template, place the 16 ellipses (representing each joint), and a line to connect to each set of relevant ellipses (sort of like the song…”the wrist bone is connected to the elbow”, and so forth). &lt;/p&gt;

  &lt;p&gt;Each ellipse was created as per below:&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 141px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Ellipse&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Height&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;14&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;LeftHand&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Stroke&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Fill&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding JointColor, Converter={StaticResource ColorToSolidColorBrushConverter}}&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;14&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Visibility&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftHand, Converter={StaticResource JointToVisibilityConverter}}&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Ellipse.RenderTransform&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TranslateTransform&lt;/span&gt; &lt;span style="color: #ff0000"&gt;X&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftHand.Position.X, Converter={StaticResource                KinectValueToScreenCoOrdinatesConverterX}, ConverterParameter=0}&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Y&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftHand.Position.Y, Converter={StaticResource KinectValueToScreenCoOrdinatesConverterY}, ConverterParameter=0}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Ellipse.RenderTransform&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Ellipse&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;The lines were also very simple:&lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; height: 153px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Line&lt;/span&gt; &lt;span style="color: #ff0000"&gt;StrokeThickness&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Stroke&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;StrokeEndLineCap&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Round&amp;quot;&lt;/span&gt; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #ff0000"&gt;X1&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftHand.Position.X, Converter={StaticResource KinectValueToScreenCoOrdinatesConverterX}, ConverterParameter=7}&amp;quot;&lt;/span&gt; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Y1&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftHand.Position.Y, Converter={StaticResource KinectValueToScreenCoOrdinatesConverterY}, ConverterParameter=7}&amp;quot;&lt;/span&gt; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #ff0000"&gt;X2&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftWrist.Position.X, Converter={StaticResource KinectValueToScreenCoOrdinatesConverterX}, ConverterParameter=7}&amp;quot;&lt;/span&gt; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Y2&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding LeftWrist.Position.Y, Converter={StaticResource KinectValueToScreenCoOrdinatesConverterY}, ConverterParameter=7}&amp;quot;&lt;/span&gt; &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Fill&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;By binding the ellipses to each relevant point in the Main View Model, and using the converter that we created earlier, you should obtain something similar to this:- &lt;/p&gt;

  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/3324.Untitled_5F00_06D47039.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled" border="0" alt="Untitled" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/1754.Untitled_5F00_thumb_5F00_1694053D.png" width="500" height="401" /&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;p&gt;The Kinect sensor has picked up the skeletons of the two people standing in front of it. By then updating the collection of skeletons and updating the bindings of the items control source, the skeletons should be displayed correctly on the screen. &lt;/p&gt;

  &lt;p&gt;Now, as the frames come in, and the bindings update, the ellipses will seamlessly move around the screen as you move, and there you have it, you’re very own living skeleton! &lt;/p&gt;

  &lt;p&gt;In our next post, we will talk about how to write a gesture service with the SDK, which will recognize the gestures the skeletons on screen are making. &lt;/p&gt;

  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Michael+Tsikkos/default.aspx"&gt;Michael Tsikkos&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/James+Glading/default.aspx"&gt;James Glading&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10193596" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Michael+Tsikkos/">Michael Tsikkos</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/James+Glading/">James Glading</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Kinect/">Kinect</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Kinect+SDK/">Kinect SDK</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Kinect+for+Windows+SDK/">Kinect for Windows SDK</category></item><item><title>F# Console Application Template</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/29/f-console-application-template.aspx</link><pubDate>Fri, 29 Jul 2011 18:03:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10191203</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10191203</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/29/f-console-application-template.aspx#comments</comments><description>&lt;p&gt;If you are like me and often use console applications for a variety of purposes you would have found the F# template not much use (in fact a blank code file). As such I decided to put together a more complete Project Template that I could use.&lt;/p&gt;  &lt;p&gt;The template can be found on the Visual Studio Gallery:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://visualstudiogallery.msdn.microsoft.com/031891a9-06c3-47db-9c7d-8c9d4a32546a" href="http://visualstudiogallery.msdn.microsoft.com/031891a9-06c3-47db-9c7d-8c9d4a32546a"&gt;http://visualstudiogallery.msdn.microsoft.com/031891a9-06c3-47db-9c7d-8c9d4a32546a&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When the template is installed you get the following template added to your F# folder when creating a new F# project:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0815.image_5F00_54A79FFE.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/6170.image_5F00_thumb_5F00_7A8D2A87.png" width="500" height="360" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The Project Template creates a Windows Console Application with the following components:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Program.fs: The application entry point defined&lt;/li&gt;    &lt;li&gt;Arguments.fs: A simple command line parser placing all arguments into a dictionary&lt;/li&gt;    &lt;li&gt;MyConsole.fs: A separate module for the custom console application code&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The application entry point is quite simple:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2a4fdcdc-a945-4aba-9754-a5456bd5f246" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Program =   &lt;br&gt; &lt;br&gt;     [&amp;lt;EntryPoint&amp;gt;]&lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Main(args) = &lt;br&gt; &lt;br&gt;         MyConsole.Run args&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// main entry point return&lt;/span&gt;&lt;br&gt;         0&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The custom console application handles the argument parsing, in addition to providing a TODO for the custom code:&lt;/p&gt;    &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7dcda32e-71a4-479a-b9c5-7ca158e961ff" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; MyConsole =&lt;br&gt;         &lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; Run args =&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// Define what arguments are expected&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; defs = [&lt;br&gt;             {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;a1&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Argument 1&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;true&lt;/span&gt; };&lt;br&gt;             {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;a2&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Argument 2&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; } ]&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// Parse Arguments into a Dictionary&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = Arguments.ParseArgs args defs&lt;br&gt;         &lt;br&gt;         &lt;span style="color:#008000"&gt;// TODO add your code here &lt;/span&gt;&lt;br&gt;         Arguments.DisplayArgs parsedArgs&lt;br&gt;         Console.ReadLine() |&amp;gt; ignore&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;If one does not wish to use the argument parsing module the ArgInfo list can be removed. This list provides a simple means for ensuring that the start-up arguments are as expected. The returned parsed parameters is merely a Dictionary of the found arguments.&lt;/p&gt;  &lt;p&gt;If one so desires one could map this over to the argument parsing provided in the FSharp PowerPack.&lt;/p&gt;  &lt;p&gt;For completeness here is the argument parsing code:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8cabcf86-ce1a-4efa-a8c0-0fee96eb676d" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;module&lt;/span&gt; Arguments =&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// Type for simple argument checking&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;type&lt;/span&gt; ArgInfo = { Command:string; Description:string; Required:bool }&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// Displays the help arguments&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; DisplayHelp (defs:ArgInfo list) =&lt;br&gt;         &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; defs &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;         | [] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;No help text defined.&amp;quot;&lt;/span&gt;&lt;br&gt;         | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;             Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Command Arguments:&amp;quot;&lt;/span&gt;&lt;br&gt;             defs&lt;br&gt;             |&amp;gt; List.iter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; def &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; helpText = sprintf &lt;span style="color:#800000"&gt;&amp;quot;-%s (Required=%b) : %s&amp;quot;&lt;/span&gt; def.Command def.Required def.Description&lt;br&gt;                 Console.WriteLine helpText )&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// Displays the found arguments&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; DisplayArgs (args:Dictionary&amp;lt;string, string&amp;gt;) =&lt;br&gt;         &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; args.Keys.Count &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;         | 0 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;No arguments found.&amp;quot;&lt;/span&gt;&lt;br&gt;         | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;             Console.WriteLine &lt;span style="color:#800000"&gt;&amp;quot;Arguments Found:&amp;quot;&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; arg &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; args.Keys &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; String.IsNullOrEmpty(args.[arg]) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;                     Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;-%s&amp;quot;&lt;/span&gt; arg)&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;                     Console.WriteLine (sprintf &lt;span style="color:#800000"&gt;&amp;quot;-%s &amp;#39;%s&amp;#39;&amp;quot;&lt;/span&gt; arg args.[arg])&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// Parse the input arguments&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; ParseArgs (args:string array) (defs:ArgInfo list) =&lt;br&gt; &lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; parsedArgs = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;string, string&amp;gt;()&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// Ensure help is supported if defintions provided&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; fullDefs = &lt;br&gt;             &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not (List.exists (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; def &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; String.Equals(def.Command, &lt;span style="color:#800000"&gt;&amp;quot;help&amp;quot;&lt;/span&gt;)) defs) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;                 {ArgInfo.Command=&lt;span style="color:#800000"&gt;&amp;quot;help&amp;quot;&lt;/span&gt;; Description=&lt;span style="color:#800000"&gt;&amp;quot;Display Help Text&amp;quot;&lt;/span&gt;; Required=&lt;span style="color:#0000ff"&gt;false&lt;/span&gt; } :: defs&lt;br&gt;             &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;                 defs&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// Report errors&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; reportError errorText =        &lt;br&gt;             DisplayArgs parsedArgs&lt;br&gt;             DisplayHelp fullDefs&lt;br&gt;             &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; errMessage = sprintf &lt;span style="color:#800000"&gt;&amp;quot;Error occured: %A&amp;quot;&lt;/span&gt; errorText&lt;br&gt;             Console.Error.WriteLine errMessage&lt;br&gt;             Console.Error.Flush()&lt;br&gt;             Environment.Exit(1)&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// Capture variables&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; captureArg command value =&lt;br&gt;             &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; defs &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;             | [] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; parsedArgs.Add(command, value)&lt;br&gt;             | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;                &lt;br&gt;                 &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not (List.exists (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; def &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; String.Equals(def.Command, command)) fullDefs) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;                     reportError (sprintf &lt;span style="color:#800000"&gt;&amp;quot;Command &amp;#39;%s&amp;#39; Not in definition list.&amp;quot;&lt;/span&gt; command)&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;                     parsedArgs.Add(command, value)            &lt;br&gt; &lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; (|IsCommand|_|) (command:string) =            &lt;br&gt;             &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; m = Regex.Match(command, &lt;span style="color:#800000"&gt;&amp;quot;^(?:-{1,2}|&amp;#92;/)(?&amp;lt;command&amp;gt;.*)$&amp;quot;&lt;/span&gt;, RegexOptions.IgnoreCase)&lt;br&gt;             &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; m.Success &lt;span style="color:#0000ff"&gt;then&lt;/span&gt; Some(m.Groups.[&lt;span style="color:#800000"&gt;&amp;quot;command&amp;quot;&lt;/span&gt;].Value.ToLower()) &lt;span style="color:#0000ff"&gt;else&lt;/span&gt; None&lt;br&gt; &lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; &lt;span style="color:#0000ff"&gt;rec&lt;/span&gt; loop (argList:string list) =&lt;br&gt;             &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; argList &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;             | [] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; ()&lt;br&gt;             | head::tail &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; head &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;                 | IsCommand command &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;                     &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; tail &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;                     | [] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; captureArg command String.Empty&lt;br&gt;                     | iHead::iTail &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; &lt;br&gt;                         &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; iHead &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;                         | IsCommand iCommand &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;                             captureArg command String.Empty&lt;br&gt;                             loop tail&lt;br&gt;                         | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;                             captureArg command iHead&lt;br&gt;                             loop iTail&lt;br&gt;                 | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; reportError (sprintf &lt;span style="color:#800000"&gt;&amp;quot;Expected a command but got &amp;#39;%s&amp;#39;&amp;quot;&lt;/span&gt; head)&lt;br&gt;         loop (Array.toList args)&lt;br&gt;         &lt;br&gt;         &lt;span style="color:#008000"&gt;// Look to see if help has been requested if not check for required&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (parsedArgs.ContainsKey(&lt;span style="color:#800000"&gt;&amp;quot;help&amp;quot;&lt;/span&gt;)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;             DisplayHelp defs&lt;br&gt;         &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;br&gt;             defs&lt;br&gt;             |&amp;gt; List.filter (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; def &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; def.Required) &lt;br&gt;             |&amp;gt; List.iter ( &lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; def &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;                 &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; not (parsedArgs.ContainsKey(def.Command)) &lt;span style="color:#0000ff"&gt;then&lt;/span&gt;&lt;br&gt;                     reportError (sprintf &lt;span style="color:#800000"&gt;&amp;quot;Command &amp;#39;%s&amp;#39; found but in argument list.&amp;quot;&lt;/span&gt; def.Command))&lt;br&gt;                   &lt;br&gt;         parsedArgs&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;As always, hopefully you will find this template useful.&lt;/p&gt;  &lt;p&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10191203" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Project+Template/">Project Template</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Console/">Console</category></item><item><title>HTML 5 / JavaScript: Creating a Carousel</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/29/html-5-javascript-creating-a-carousel.aspx</link><pubDate>Fri, 29 Jul 2011 17:33:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10191190</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10191190</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/29/html-5-javascript-creating-a-carousel.aspx#comments</comments><description>&lt;div class="ExternalClassFC9A5553921A475FA6A6023E642D0F65"&gt;   &lt;p&gt;Following on from my previous posts on html5 animation and reflection effects, I thought I'd put it all together and create a carousel. &lt;/p&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/2402.image_5F00_4_5F00_70E15ADC1_5F00_15B16D40.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image_4_70E15ADC[1]" border="0" alt="image_4_70E15ADC[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/5582.image_5F00_4_5F00_70E15ADC1_5F00_thumb_5F00_40595FEB.png" width="500" height="348" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Firstly, I create a JavaScript pseudo class called CarouselImage. This takes an image url and draws it at a given co-ordinate, scaled by a co-efficient (used to simulate perspective). This class also applies a reflection effect (as per my &lt;a href="http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/06/html5-javascript-reflections-and-skew-effects.aspx" target="_blank"&gt;previous post&lt;/a&gt;). &lt;/p&gt;    &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;       &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;function&lt;/span&gt; CarouselImage(url, x, y, scale) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.imageUrl = url;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.xPosition = x;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.yPosition = y;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.scaleCoeff = scale;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.DrawImageWithReflection = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;(currentContext) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; mainImage = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Image();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        mainImage.src = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.imageUrl;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; xPos = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.xPosition;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; yPos = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.yPosition;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; scale = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.scaleCoeff;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        mainImage.onload = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; imgWidth = mainImage.width * scale;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; imgHeight = mainImage.height * scale;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Draw main image&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.drawImage(mainImage, xPos, yPos, imgWidth, imgHeight);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Setup a reflection (via reversing scale in y-direction around an axis that is two times the height of the image)  &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.translate(0, yPos + (2 * imgHeight));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.scale(1, -1);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.drawImage(mainImage, xPos, 0, imgWidth, imgHeight);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Revert transform and scale  &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.translate(0, yPos + (2 * imgHeight));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.scale(1, -1);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Reflection image overlay, to created fade out effect (solid colour with increasing opacity).&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; alphaGradient = currentContext.createLinearGradient(xPos, yPos + imgHeight, xPos, yPos + (2 * imgHeight));&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            alphaGradient.addColorStop(0, &lt;span style="color: #006080"&gt;&amp;quot;rgba(255, 255, 255, 0.75)&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            alphaGradient.addColorStop(0.75, &lt;span style="color: #006080"&gt;&amp;quot;rgba(255, 255, 255, 1)&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.fillStyle = alphaGradient;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            currentContext.fillRect(xPos - 1, yPos + imgHeight + 1, imgWidth + 2, imgHeight + 2); &lt;span style="color: #008000"&gt;// Rectangle made 1px bigger in all directions otherwise scaling leave artifacts&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;I then create a pseudo class to calculate the position of images in the carousel. I work out the angle of separation between each image by dividing 360 degrees (2 * Math.PI) by the number of images . I use sine and cosine functions to calculate the image positions on an oval (with co-efficients so that the oval is wider than it is tall to create perspective). I finally scale images, so that images higher up the page are smaller, thus appearing further away.&amp;#160; &lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;function&lt;/span&gt; CarouselPosition(centerX, centerY, ovalWidth, ovalHeight) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Angle = 0;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CenterX = centerX;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CenterY = centerY;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.OvalWidth = ovalWidth;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.OvalHeight = ovalHeight;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CalculateDivisions = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (numberOfItems) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Angle = (2 * Math.PI / numberOfItems);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CalculateXPosition = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (itemPosition, offsetAngle) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.OvalWidth * Math.sin((&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Angle * itemPosition) + offsetAngle) + &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CenterX;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CalculateYPosition = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (itemPosition, offsetAngle) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.OvalHeight * Math.cos((&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Angle * itemPosition) + offsetAngle) + &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CenterY;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.CalculateScale = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (itemPosition, offsetAngle) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 1 - (0.2 * -Math.cos((&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Angle * itemPosition) + offsetAngle)) - 0.2;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;I create a top level class is called Carousel. This takes an array of image urls and plots them at calculated locations via the above classes. An important point to note is that as setting the z-position does not appear to be possible in the Canvas element, I work out all of the images positions and store in array before plotting them . This allows me to sort based on y-position, so images higher up the page appear at the back of the carousel (thus simulating z-position). &lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;function&lt;/span&gt; Carousel(currentContext, images) &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.drawingContext = currentContext;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.carouselItems = images;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.offsetAngle = 0;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.DrawCarousel = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Clear the screen&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.drawingContext.clearRect(0, 0, 1000, 800);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Set the position of the caraousel and calculate the angle between each image&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; position = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CarouselPosition(400, 200, 350, 150);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        position.CalculateDivisions(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.carouselItems.length);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;              &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Update offset angle - this is updated each frame for animation&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.offsetAngle += 0.01;  &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;              &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// We first calculate the positions of all images and put into an array&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; zSortedArray = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Array();&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (i = 0; i &amp;lt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.carouselItems.length; i++) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; x = position.CalculateXPosition(i, &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.offsetAngle);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; y = position.CalculateYPosition(i, &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.offsetAngle);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; scale = position.CalculateScale(i, &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.offsetAngle);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; imgUrl = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.carouselItems[i];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; currentImage = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CarouselImage(imgUrl, x, y, scale);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            zSortedArray.push(currentImage);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;               &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Sort by y position (to simulate z-index)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        zSortedArray.sort(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PeformSort);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Draw images that have been sorted, so images higher on the screen appear in the background&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (i = 0; i &amp;lt; zSortedArray.length; i++) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; image = zSortedArray[i];&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            image.DrawImageWithReflection(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.drawingContext);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PeformSort = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;(a, b) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (a.yPosition &amp;gt; b.yPosition) {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; -1;&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;In the page onload event, I create an instance of my Carousel object, passing in an array of images paths (these make up the nodes on the carousel).&amp;#160; I finally set a setInterval method to redraw the canvas every 40ms (i.e. to produce 25 frames per second). &lt;/p&gt;

  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.window.onload = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; canvas = document.getElementById(&lt;span style="color: #006080"&gt;'myCanvas'&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; context = canvas.getContext(&lt;span style="color: #006080"&gt;'2d'&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;          &lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; images = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Array(&lt;span style="color: #006080"&gt;&amp;quot;images/image1.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image2.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image3.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image4.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image5.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image6.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image7.jpg&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;images/image8.jpg&amp;quot;&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.carousel = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Carousel(context, images);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    setInterval(&lt;span style="color: #006080"&gt;'this.carousel.DrawCarousel();'&lt;/span&gt;, 40);&lt;/pre&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}  &lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;&amp;#160;&lt;/p&gt;

  &lt;p&gt;Note that at present, I haven’t set up any event handling (e.g. responding to mouse click, or arrow key presses). &lt;/p&gt;

  &lt;p&gt;Also note that I have tested this on IE9, Firefox and Chrome. It runs smoothly on IE9, but there’s a reasonable amount of flicker on the other two. &lt;/p&gt;

  &lt;p&gt;&lt;a href="http://rnowik.com/html5tests/SimpleCarousel.htm" target="_blank"&gt;&lt;strong&gt;Click here to see it in action.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

  &lt;p&gt;Please feel free to get in contact if you have any questions. &lt;/p&gt;

  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Rob+Nowik/default.aspx"&gt;Rob Nowik&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10191190" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/User+Experience/">User Experience</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/HTML5/">HTML5</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/IE9/">IE9</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/UX/">UX</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Animation/">Animation</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Rob+Nowik/">Rob Nowik</category></item><item><title>FSharpChart and consuming within a WinForms application</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/24/fsharpchart-and-consuming-within-a-winforms-application.aspx</link><pubDate>Sun, 24 Jul 2011 09:04:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189217</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10189217</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/24/fsharpchart-and-consuming-within-a-winforms-application.aspx#comments</comments><description>&lt;p&gt;In all the previous discussions around FSharpChart, samples have been shown within F# Interactive. I wanted to spend a few moments and demonstrate how FSharpChart can be consumed within a WinForms application, and how chart properties can be modified at runtime.&lt;/p&gt;  &lt;p&gt;Before getting started a quick word is warranted about F# WinForms applications. By default no project template is installed with Visual Studio. However I have posted a Project Template onto the Visual Studio Gallery that can be used for WinForms applications:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://visualstudiogallery.msdn.microsoft.com/eba78049-a17e-4868-9ead-065da1421052" href="http://visualstudiogallery.msdn.microsoft.com/eba78049-a17e-4868-9ead-065da1421052"&gt;http://visualstudiogallery.msdn.microsoft.com/eba78049-a17e-4868-9ead-065da1421052&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Using this template here is some sample code that defines a BoxPlot chart, uses this to create a ChartControl, adds the ChartControl to the form’s Control collection, and renders the Form:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9624c318-4f4c-4946-a4f8-b78f2cab5468" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; BoxplotForm() &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; form =&lt;br&gt;     &lt;span style="color:#0000ff"&gt;inherit&lt;/span&gt; Form()&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; chart =&lt;br&gt;         &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; rnd = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Random()&lt;br&gt; &lt;br&gt;         FSharpChart.BoxPlot&lt;br&gt;              ( [ &lt;span style="color:#800000"&gt;&amp;quot;Eggs&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 20) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Bacon&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 15 + 2) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Sausage&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 5 + 5) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Beans&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 10 + 3) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Mushroom&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 15 + 5) |] ],&lt;br&gt;                  BoxPlotShowUnusualValues = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;, BoxPlotShowMedian = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;,&lt;br&gt;                  BoxPlotShowAverage = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;, BoxPlotWhiskerPercentile = 10,&lt;br&gt;                  Name = &lt;span style="color:#800000"&gt;&amp;quot;Breakfast Food BoxPlot&amp;quot;&lt;/span&gt;)&lt;br&gt;         |&amp;gt; FSharpChart.WithMargin(1.0f, 5.0f, 1.0f, 1.0f) &lt;br&gt;         |&amp;gt; FSharpChart.WithSeries.Style(Color = Color.SeaGreen)&lt;br&gt;         |&amp;gt; FSharpChart.WithLegend(InsideArea = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;, Font = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Font(&lt;span style="color:#800000"&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;, 8.0f), Alignment = StringAlignment.Center, Docking = Docking.Top)&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// initialize your controls&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; chartControl = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; ChartControl(chart, Dock = DockStyle.Fill) &lt;br&gt;     &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; series = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; MultiValue()  &lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;do&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#008000"&gt;// get access to the series&lt;/span&gt;&lt;br&gt;         series.BindSeries(chartControl.ChartSeries)&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// add controls to the form&lt;/span&gt;&lt;br&gt;         form.SuspendLayout();&lt;br&gt;         form.Controls.Add(chartControl)&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// define form properties&lt;/span&gt;&lt;br&gt;         form.ClientSize &amp;lt;- &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Size(600, 600)&lt;br&gt;         form.Text &amp;lt;- &lt;span style="color:#800000"&gt;&amp;quot;F# BoxPlot Tester Utility&amp;quot;&lt;/span&gt;&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;// render&lt;/span&gt;&lt;br&gt;         form.ResumeLayout(&lt;span style="color:#0000ff"&gt;false&lt;/span&gt;)&lt;br&gt;         form.PerformLayout()&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;As you can see not much code is required. Here is the rendered form:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/7382.4274.image_5F00_6A3060BD_5F00_28EC9E9A.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="4274.image_6A3060BD" border="0" alt="4274.image_6A3060BD" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-14-metablogapi/0844.4274.image_5F00_6A3060BD_5F00_thumb_5F00_5A2B632D.png" width="463" height="480" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;A quick word is warranted about the use of the series value. This value is bound to the data series and as such can be used to modify the data rendered by the chart. All one has to do is call SetData:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:adb37984-4f0f-4b40-ae8e-d7e758b261d1" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;let&lt;/span&gt; rnd = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Random()&lt;br&gt; series.SetData([ &lt;span style="color:#800000"&gt;&amp;quot;Cereal&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 20) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Yogurt&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 15 + 2) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Toast&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 15 + 2) |]&lt;br&gt;                  &lt;span style="color:#800000"&gt;&amp;quot;Fruit&amp;quot;&lt;/span&gt;, [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; i &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; 0 .. 20 &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; float (rnd.Next 10 + 5) |] ],&lt;br&gt;                  chart.ChartBinder)&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this instance series variable is defined as a MultiValue() type. However for other chart types this type will vary; such as OneValue, TwoValue, ThreeValue, and FourValue.&lt;/p&gt;  &lt;p&gt;Normally when setting the series data, using SetData, one just has to provide the new data. For the MultiValue type however a binder property is needed so the binding can optionally modify the chart properties.&lt;/p&gt;  &lt;p&gt;Finally, one also has the option of setting other runtime chart properties; such as Name, Title, Margin, Legend, and any Custom property. One just has to set the property value, such as:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:523e5bcb-cfcd-47cc-9757-a2bd50dc06f6" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;chart.Margin &amp;lt;- (2.0f, 12.0f, 2.0f, 2.0f)&lt;br&gt; chart.Title &amp;lt;- Helper.CreateTitle(&lt;span style="color:#800000"&gt;&amp;quot;Chart Sin/Cosine&amp;quot;&lt;/span&gt;, Font = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Font(&lt;span style="color:#800000"&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;, 12.0f, FontStyle.Bold))&lt;br&gt; chart.Legend &amp;lt;- Helper.CreateLegend(InsideArea = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;, Font = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Font(&lt;span style="color:#800000"&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;, 8.0f))&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Hopefully these code snippets demonstrate that using FSharpChart within WinForms applications is relatively simple.&lt;/p&gt;  &lt;p&gt;These samples can be found in the FSharpChart download.&lt;/p&gt;  &lt;p&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189217" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/WinForms/">WinForms</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Windows+Forms/">Windows Forms</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharpChart/">FSharpChart</category></item><item><title>Adventures in TSQL: Adding date and time values</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/19/adventures-in-tsql-adding-date-and-time-values.aspx</link><pubDate>Tue, 19 Jul 2011 20:23:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10187991</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10187991</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/19/adventures-in-tsql-adding-date-and-time-values.aspx#comments</comments><description>&lt;p&gt;With the addition of the SQL Server &lt;strong&gt;date&lt;/strong&gt; and &lt;strong&gt;time&lt;/strong&gt; types, I have often found myself needing to create a datetime (or datetime2) value based on the addition of a date and a time value. However, there is no built-in function for such an operation.&lt;/p&gt;  &lt;p&gt;There are a few solutions to this problem that encompass processing strings; such as:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5de270cf-cfed-42cc-8300-6e10d42fabfa" class="wlWriterSmartContent"&gt;   &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;     &lt;div style="padding-bottom: 2px; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; white-space: nowrap; overflow: auto; padding-top: 2px"&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; @nowdate &lt;span style="color: #0000ff"&gt;date&lt;/span&gt; &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;SYSDATETIME&lt;/span&gt;&lt;span style="color: #808080"&gt;();&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; @nowtime &lt;span style="color: #0000ff"&gt;time&lt;/span&gt; &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;SYSDATETIME&lt;/span&gt;&lt;span style="color: #808080"&gt;();&lt;/span&gt;        &lt;br /&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;CONVERT&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;datetime2&lt;/span&gt;&lt;span style="color: #808080"&gt;,&lt;/span&gt;&lt;span style="color: #ff00ff"&gt;CONVERT&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;&lt;span style="color: #808080"&gt;,&lt;/span&gt; @nowdate&lt;span style="color: #808080"&gt;,&lt;/span&gt; 112&lt;span style="color: #808080"&gt;)&lt;/span&gt; &lt;span style="color: #808080"&gt;+&lt;/span&gt; &lt;span style="color: #ff0000"&gt;' '&lt;/span&gt; &lt;span style="color: #808080"&gt;+&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;CONVERT&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;&lt;span style="color: #808080"&gt;,&lt;/span&gt; @nowtime&lt;span style="color: #808080"&gt;,&lt;/span&gt; 108&lt;span style="color: #808080"&gt;))&lt;/span&gt;&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;However, if one realizes that when a time value is cast to a datetime the date component is set to '1900-01-01', and this date equates to a days equivalent of zero in the SQL date and time functions. Thus the following user-defined function can be used to add a date and time value:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d10363a5-7432-4f26-b6b9-2b19a6a77b24" class="wlWriterSmartContent"&gt;   &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;     &lt;div style="padding-bottom: 2px; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; white-space: nowrap; overflow: auto; padding-top: 2px"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;FUNCTION&lt;/span&gt; [dbo]&lt;span style="color: #808080"&gt;.&lt;/span&gt;[DateTimeAdd]        &lt;br /&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @datepart&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;date&lt;/span&gt;&lt;span style="color: #808080"&gt;,&lt;/span&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @timepart&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;time&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #808080"&gt;)&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;RETURNS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;datetime2&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;RETURN&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;DATEADD&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;dd&lt;span style="color: #808080"&gt;,&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;DATEDIFF&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;dd&lt;span style="color: #808080"&gt;,&lt;/span&gt; 0&lt;span style="color: #808080"&gt;,&lt;/span&gt; @datepart&lt;span style="color: #808080"&gt;),&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;CAST&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;@timepart &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;datetime2&lt;/span&gt;&lt;span style="color: #808080"&gt;));&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This works as the DATEDIFF function with a zero value and a date returns the number of days from the date '1900-01-01'. Thus adding the DATEDIFF result to a time value cast to a datetime value, effectively adds the date and time values.&lt;/p&gt;  &lt;p&gt;Thus one can now write:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3aec37fe-1d94-40ea-a62d-18ac5c021d96" class="wlWriterSmartContent"&gt;   &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;     &lt;div style="padding-bottom: 2px; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; white-space: nowrap; overflow: auto; padding-top: 2px"&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; @nowdate &lt;span style="color: #0000ff"&gt;date&lt;/span&gt; &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;SYSDATETIME&lt;/span&gt;&lt;span style="color: #808080"&gt;();&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; @nowtime &lt;span style="color: #0000ff"&gt;time&lt;/span&gt; &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;SYSDATETIME&lt;/span&gt;&lt;span style="color: #808080"&gt;();&lt;/span&gt;        &lt;br /&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; dbo&lt;span style="color: #808080"&gt;.&lt;/span&gt;DateTimeAdd&lt;span style="color: #808080"&gt;(&lt;/span&gt;@nowdate&lt;span style="color: #808080"&gt;,&lt;/span&gt; @nowtime&lt;span style="color: #808080"&gt;);&lt;/span&gt;&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In the same manner if one wanted to extract just the date portion of a datetime variable, one option is to perform a cast to and from a date type. However one can also start from day 0 and add the corresponding number of days:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e0580c98-0b22-4d00-8b25-e23a47b1ee36" class="wlWriterSmartContent"&gt;   &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;     &lt;div style="padding-bottom: 2px; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; white-space: nowrap; overflow: auto; padding-top: 2px"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;FUNCTION&lt;/span&gt; [dbo]&lt;span style="color: #808080"&gt;.&lt;/span&gt;[DatetimeDateOnly]        &lt;br /&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; @datetime &lt;span style="color: #0000ff"&gt;datetime2&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #808080"&gt;)&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;RETURNS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;datetime2&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;RETURN&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;DATEADD&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;dd&lt;span style="color: #808080"&gt;,&lt;/span&gt; 0&lt;span style="color: #808080"&gt;,&lt;/span&gt; &lt;span style="color: #ff00ff"&gt;DATEDIFF&lt;/span&gt;&lt;span style="color: #808080"&gt;(&lt;/span&gt;dd&lt;span style="color: #808080"&gt;,&lt;/span&gt; 0&lt;span style="color: #808080"&gt;,&lt;/span&gt; @datetime&lt;span style="color: #808080"&gt;));&lt;/span&gt;        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10187991" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/SQL+Server+2008+R2/">SQL Server 2008 R2</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TSQL/">TSQL</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/datetime2/">datetime2</category></item><item><title>F# and Running Parallel Tasks</title><link>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/14/f-and-running-parallel-tasks.aspx</link><pubDate>Thu, 14 Jul 2011 20:22:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10186644</guid><dc:creator>MCS UK Solution Development</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/mcsuksoldev/rsscomments.aspx?WeblogPostID=10186644</wfw:commentRss><comments>http://blogs.msdn.com/b/mcsuksoldev/archive/2011/07/14/f-and-running-parallel-tasks.aspx#comments</comments><description>&lt;p&gt;Recently I have been working a lot with the Task Parallel Libraries. In doing so, in F#,&amp;#160; you will quickly learn that one has to perform quite a bit of casting. As such I have found it useful to define some wrapper members that abstract these casting and calling schematics:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3c9032c1-5a27-4482-ac3d-56249db0c57b" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;type&lt;/span&gt; ParallelEx =&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; &lt;span style="color:#0000ff"&gt;inline&lt;/span&gt; Do (actions:(unit &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; unit) array, ?cancellationToken:CancellationToken) =&lt;br&gt;         &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; actions &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;         | [||] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; ()&lt;br&gt;         | [|action|] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; action()&lt;br&gt;         | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; tasks = &lt;br&gt;                 &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; cancellationToken &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;                 | Some c &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Array.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; x &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Task.Factory.StartNew(Action(x), c)) actions&lt;br&gt;                 | None &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Array.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; x &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Task.Factory.StartNew(Action(x))) actions&lt;br&gt;             Task.WaitAll tasks&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; &lt;span style="color:#0000ff"&gt;inline&lt;/span&gt; Let (funcs:(unit &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; &amp;#39;T) array, ?cancellationToken:CancellationToken) =&lt;br&gt;         &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; funcs &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;         | [||] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Array.empty&lt;br&gt;         | [|func|] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; [| func() |]&lt;br&gt;         | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;             &lt;span style="color:#0000ff"&gt;let&lt;/span&gt; tasks = &lt;br&gt;                 &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; cancellationToken &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;                 | Some c &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Array.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; x &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Task.Factory.StartNew(Func&amp;lt;&amp;#39;T&amp;gt;(x), c)) funcs&lt;br&gt;                 | None &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Array.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; x &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Task.Factory.StartNew(Func&amp;lt;&amp;#39;T&amp;gt;(x))) funcs&lt;br&gt;             Task.WaitAll [| &lt;span style="color:#0000ff"&gt;for&lt;/span&gt; task &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; tasks &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; task :&amp;gt; Task |]&lt;br&gt;             Array.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; (t: Task&amp;lt;&amp;#39;T&amp;gt;) &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; t.Result) tasks&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Each of these members takes an array of functions to execute, in parallel as tasks, only returning when all tasks have completed, performing a WaitAll on the tasks. For the Let member any results are then collected and returned in an array.&lt;/p&gt;  &lt;p&gt;These wrappers use Array prototypes, rather than lists, mostly because the TPL uses arrays. This means one does not have to do any type conversions between list and array types; and vice-versa.&lt;/p&gt;  &lt;p&gt;One thing you will notice in the Let member is the casting of the tasks to type Task, when performing the WaitAll. This is because the tasks, when created using Func types, are of type Task&amp;lt;’T&amp;gt;. Whereas C# will automatically perform the downcast, this has to be explicitly performed in F#.&lt;/p&gt;  &lt;p&gt;These wrappers currently support an optional CancellationToken. They could easily be extended for other Task capabilities such as state and TaskCreationOptions. If I extend these in the near future I will post them up.&lt;/p&gt;  &lt;p&gt;A quick word about Exceptions. As these members are just wrappers over the TPL you will need to cater for exceptions thrown by the TPL, including the AggregateException.&lt;/p&gt;  &lt;p&gt;To demonstrate using the Do member, here is the call one would use when performing a parallel Quicksort:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8bc0c1c7-a92b-40e8-a892-1e3083d519aa" class="class"&gt;   &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;     &lt;div style="padding-bottom: 2px; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; white-space: nowrap; overflow: auto; padding-top: 2px"&gt;ParallelEx.Do [|       &lt;br /&gt;&lt;span style="color: #0000ff"&gt;fun&lt;/span&gt; () &lt;span style="color: #0000ff"&gt;-&amp;gt;&lt;/span&gt; quickSortDepth low (pivot - 1) (depth - 1);        &lt;br /&gt;&lt;span style="color: #0000ff"&gt;fun&lt;/span&gt; () &lt;span style="color: #0000ff"&gt;-&amp;gt;&lt;/span&gt; quickSortDepth (pivot + 1) high (depth - 1) |]&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;As you can see, using these wrappers saves one having to always perform Action and Func casts for parallel executions.&lt;/p&gt;  &lt;p&gt;If one so desired one could just as easily put a wrapper over Parallel.Invoke, rather than using tasks:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:32d85334-cbf2-4ad8-bee5-19eb9ff6bb31" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background-color: #f0f0f0; overflow: auto; padding: 2px 5px; white-space: nowrap"&gt;&lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;member&lt;/span&gt; &lt;span style="color:#0000ff"&gt;inline&lt;/span&gt; Invoke (actions:(unit &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; unit) array) =&lt;br&gt;     &lt;span style="color:#0000ff"&gt;match&lt;/span&gt; actions &lt;span style="color:#0000ff"&gt;with&lt;/span&gt;&lt;br&gt;     | [||] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; ()&lt;br&gt;     | [|action|] &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; action()&lt;br&gt;     | _ &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt;&lt;br&gt;         Array.map (&lt;span style="color:#0000ff"&gt;fun&lt;/span&gt; x &lt;span style="color:#0000ff"&gt;-&amp;gt;&lt;/span&gt; Action(x)) actions&lt;br&gt;         |&amp;gt; Parallel.Invoke&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The usage schematics for this wrapper would be the same as that for the Do member.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Written by &lt;a href="http://blogs.msdn.com/mcsuksoldev/archive/tags/Carl+Nolan/default.aspx"&gt;Carl Nolan&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10186644" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/F_2300_/">F#</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Carl+Nolan/">Carl Nolan</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Task+Parallel+Library/">Task Parallel Library</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/TPL/">TPL</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Parallel+Extensions/">Parallel Extensions</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Func/">Func</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/FSharp/">FSharp</category><category domain="http://blogs.msdn.com/b/mcsuksoldev/archive/tags/Action/">Action</category></item></channel></rss>
