<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>.Net samplettes</title><link>http://blogs.vbcity.com/hotdog/category/38.aspx</link><description>Little code samples in .net</description><managingEditor>Robert Verpalen</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Robert Verpalen</dc:creator><title>AutoDragger: automatically enable start dragging for your controls</title><link>http://blogs.vbcity.com/hotdog/archive/2009/02/10/9273.aspx</link><pubDate>Tue, 10 Feb 2009 22:12:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2009/02/10/9273.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/9273.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2009/02/10/9273.aspx#Feedback</comments><slash:comments>77</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/9273.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/9273.aspx</trackback:ping><description>&lt;P&gt;Another 'old' bit of code that I'm still using a lot none the less. Whenever I needed drag and drop, it annoyed me that I had to use repetitive code to start it manually by tracing the mousedown etc. So what better place for repetitive code than in a reusable component. It isn't any highly fancy or complicated code, but a raincoat doesn't have to be pretty to keep you dry ;) &lt;BR&gt;Anyway, when&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;I was thinking when&amp;nbsp;extending the AutoDragger today to alter the behaviour when dragging from a datagridview, that it was never posted on this blog. So here it is. (As far as I know it hasn't been outdated in the sense that .net now supports this out of the box)&lt;/P&gt;
&lt;P&gt;Usage in Designer: drop the component on your form, select a control you wish to enable auto dragging for, locate the added 'UseAutoDrag' property on that control (under a 'Drag Drop' header) and set it to true.&lt;BR&gt;(Of course the component can be used as a runtime class too.) The cursor can be set in the drag events or by setting a default drag cursor on the component.&lt;/P&gt;

&lt;!-- --Start of code block
--&gt;&lt;DIV Style=" Border='1px #000080 solid'; Margin-Left=10pt; Margin-Right=2pt;" OnKeyDown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;&amp; i&lt;ch.selcount){ch.sel=i;ch.click();}"&gt;&lt;DIV Style=" Font-Size=9pt; Font-Family='Microsoft Sans Serif'; Border-Bottom='1px #000080 solid';" OnClick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'300pt':null;if(i==1&amp;&amp; ch.offsetHeight&gt;h)ch.style.height=h;" sel=1 selold=1 selcount=3&gt;&lt;b&gt;  Code &lt;/b&gt;&lt;a href="javascript:" Style=" Margin-Left=10pt; Margin-Right=10pt;" OnClick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');"&gt;Copy&lt;/a&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=0"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Hide&lt;/SPAN&gt;&lt;SPAN Style=" Font-Weight=bolder; Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=1"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();" Checked=True&gt;Scroll&lt;/SPAN&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=2"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;&lt;DIV Style=" BackGround-Color=#dcdcdc; overflow='auto'; Height=300pt;"&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;namespace&lt;/FONT&gt; Subro.Controls&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;using&lt;/FONT&gt; System;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.ComponentModel;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Windows.Forms;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Drawing;&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Generic component that can start dragging for most control by handling&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; its mouse events.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Set the Controls property to indicate for which controls dragging should be handled&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; automatically. Catch the StartDrag event to alter the data which is to be dragged.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultEvent&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotStartDrag&amp;quot&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ProvideProperty&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotUseAutoDrag&amp;quot&lt;/FONT&gt;,&lt;FONT Color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;))]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AutoDragger&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Component&lt;/FONT&gt;,&lt;FONT Color=#2b91af&gt;IExtenderProvider&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; AutoDragger()&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; AutoDragger(&lt;FONT Color=#2b91af&gt;IContainer&lt;/FONT&gt; c)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;()&lt;/div&gt;{&lt;div style="margin-left:20pt"&gt;c.Add(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; AutoDragger(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; ctr)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;(ctr, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;/div&gt;{&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; AutoDragger(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; ctr, &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt;&amp;gt handler)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;()&lt;/div&gt;{&lt;div style="margin-left:20pt"&gt;Register(ctr);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (handler != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;StartDrag += handler;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;&amp;gt controls = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;&amp;gt();&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Register(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; DragSource)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; i = controls.IndexOf(DragSource);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (i != -1) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; i;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!DesignMode)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DragSource.MouseDown += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MouseEventHandler&lt;/FONT&gt;(Control_MouseDown);&lt;br&gt;DragSource.MouseMove += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MouseEventHandler&lt;/FONT&gt;(Control_MouseMove);&lt;br&gt;DragSource.MouseUp += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MouseEventHandler&lt;/FONT&gt;(Control_MouseUp);&lt;br&gt;DragSource.GiveFeedback += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;GiveFeedbackEventHandler&lt;/FONT&gt;(Control_GiveFeedback);&lt;/div&gt;}&lt;br&gt;controls.Add(DragSource);&lt;br&gt;i = controls.Count - 1;&lt;br&gt;ControlAdded(DragSource);&lt;br&gt;OnControlsChanged();&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;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; i;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ControlAdded(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; c)&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; UnRegister(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; DragSource)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DragSource.MouseDown -= &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MouseEventHandler&lt;/FONT&gt;(Control_MouseDown);&lt;br&gt;DragSource.MouseMove -= &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MouseEventHandler&lt;/FONT&gt;(Control_MouseMove);&lt;br&gt;DragSource.MouseUp -= &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MouseEventHandler&lt;/FONT&gt;(Control_MouseUp);&lt;br&gt;DragSource.GiveFeedback -= &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;GiveFeedbackEventHandler&lt;/FONT&gt;(Control_GiveFeedback);&lt;br&gt;controls.Remove(DragSource);&lt;br&gt;ControlRemoved(DragSource);&lt;br&gt;OnControlsChanged();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ControlRemoved(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; c)&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; UnRegisterAll()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; c = controls.Count -1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i&amp;nbsp&amp;nbsp= c;i&amp;gt=0 ;i--)&lt;div style="margin-left:20pt"&gt;UnRegister(controls[i]);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Category = &lt;FONT Color=#a31515&gt;&amp;quotDragDrop&amp;quot&lt;/FONT&gt;;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Category&lt;/FONT&gt;(Category)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;[] Controls&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; controls.ToArray();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;suspendcontrolschanged = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;while&lt;/FONT&gt; (controls.Count &amp;gt 0)&lt;div style="margin-left:20pt"&gt;UnRegister(controls[0]);&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; c &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Register(c);&lt;/div&gt;}&lt;/div&gt;suspendcontrolschanged = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;br&gt;OnControlsChanged();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; suspendcontrolschanged;&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnControlsChanged()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (!suspendcontrolschanged &amp;amp&amp;amp ControlsChanged != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) ControlsChanged(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt;.Empty);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt; ControlsChanged;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Index]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; controls[Index];&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The amount of registered controls used as a dragsource&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; DragSourceCount&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; controls.Count; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt;&amp;gt StartDrag;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DragDropEffects&lt;/FONT&gt; effects = &lt;FONT Color=#2b91af&gt;DragDropEffects&lt;/FONT&gt;.All;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DragDropEffects&lt;/FONT&gt;.All)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DragDropEffects&lt;/FONT&gt; Effects&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; effects; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { effects = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Dispose(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; disposing)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;UnRegisterAll();&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.Dispose(disposing);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;int&lt;/FONT&gt; diffmin = 2;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(2)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Category&lt;/FONT&gt;(Category)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; DifferenceMinimum&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; diffmin; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;diffmin = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;AutoDragEventArgs&lt;/FONT&gt; curdrag;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; Control_MouseDown(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;MouseEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (e.Button == &lt;FONT Color=#2b91af&gt;MouseButtons&lt;/FONT&gt;.Left)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;curdrag = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt;(sender &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;, e.Location, &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;curdrag = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Control_MouseUp(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;MouseEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (curdrag != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;AutoDragEventArgs&lt;/FONT&gt; de = curdrag;&lt;br&gt;EndCurDrag();&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;br&gt;OnDragEnded(de);&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&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;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnDragEnded(&lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Control_MouseMove(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;MouseEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (e.Button == &lt;FONT Color=#2b91af&gt;MouseButtons&lt;/FONT&gt;.Left &amp;amp&amp;amp curdrag != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;curdrag.CheckStartDrag(e);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Control_GiveFeedback(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;GiveFeedbackEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;curdrag.SetFeedback(e);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Cursor&lt;/FONT&gt; cursor;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Cursor&lt;/FONT&gt; DragCursor&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; cursor; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (cursor == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;br&gt;cursor = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;dragicon = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; ShouldSerializeDragCursor()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; cursor != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp dragicon == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Icon&lt;/FONT&gt; dragicon;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Icon&lt;/FONT&gt; DragIcon&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; dragicon; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (dragicon == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;DragCursor = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;DragCursor = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Cursor&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.Handle);&lt;/div&gt;dragicon = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; alwaysshowcustomcursor;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotOnly applies when the DragCursor property is set. If this value is false, the cursor is only shown when drop is allowed&amp;quot&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AlwaysShowCustomCuror&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; alwaysshowcustomcursor; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { alwaysshowcustomcursor = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; EndCurDrag()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (curdrag != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;curdrag.Dispose();&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; Control;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt; StartPoint;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AutoDragger&lt;/FONT&gt; AutoDragger;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; AutoDragEventArgs(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; Control, &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt; StartPoint, &lt;FONT Color=#2b91af&gt;AutoDragger&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Control = Control;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.StartPoint = StartPoint;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.AutoDragger = Owner;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; dragobj;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; DragObject&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; dragobj; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { dragobj = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&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;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; started;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; DragStarted&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; started; }&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&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;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; CheckStartDrag(&lt;FONT Color=#2b91af&gt;MouseEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; diff = &lt;FONT Color=#2b91af&gt;Math&lt;/FONT&gt;.Abs(e.X - StartPoint.X)&lt;div style="margin-left:20pt"&gt;+ &lt;FONT Color=#2b91af&gt;Math&lt;/FONT&gt;.Abs(e.Y - StartPoint.Y);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (diff &amp;gt= AutoDragger.diffmin)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;started = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;br&gt;Cursor = AutoDragger.DragCursor;&lt;br&gt;AutoDragger.OnStartDrag(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;,e);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Dispose()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (AutoDragger.curdrag == &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;AutoDragger.curdrag = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Cursor&lt;/FONT&gt; cursor;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Cursor&lt;/FONT&gt; Cursor&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; cursor; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;cursor = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&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;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetFeedback(&lt;FONT Color=#2b91af&gt;GiveFeedbackEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (cursor != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (e.Effect != &lt;FONT Color=#2b91af&gt;DragDropEffects&lt;/FONT&gt;.None || AutoDragger.alwaysshowcustomcursor)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;e.UseDefaultCursors = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;Cursor&lt;/FONT&gt;.Current = cursor;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; GetDragObject()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Control&lt;/FONT&gt; c = Control;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (c &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListControl&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; (c &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListControl&lt;/FONT&gt;).SelectedValue;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (c &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;TextBoxBase&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDragObject(c &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;TextBoxBase&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (c &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Label&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; c.Text;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (c &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;TreeView&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDragObject(c &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;TreeView&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (c &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DataGridView&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDragObject(c &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DataGridView&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;object&lt;/FONT&gt; GetDragObject(&lt;FONT Color=#2b91af&gt;TextBoxBase&lt;/FONT&gt; tb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (!tb.ReadOnly)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//when in edit mode and selecting text, don't start dragging&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;//TODO: make optional&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp &lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (tb.SelectionLength == 0)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; tb.Text;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; tb.SelectedText;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;object&lt;/FONT&gt; GetDragObject(&lt;FONT Color=#2b91af&gt;TreeView&lt;/FONT&gt; t)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;TreeNode&lt;/FONT&gt; node = t.GetNodeAt(StartPoint);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (node == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;t.SelectedNode = node;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; node;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;object&lt;/FONT&gt; GetDragObject(&lt;FONT Color=#2b91af&gt;DataGridView&lt;/FONT&gt; dg)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DataGridView&lt;/FONT&gt;.&lt;FONT Color=#2b91af&gt;HitTestInfo&lt;/FONT&gt; ht = dg.HitTest(StartPoint.X, StartPoint.Y);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (ht.RowIndex == -1) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (ht.ColumnIndex &amp;gt -1 &amp;amp&amp;amp !dg.Columns[ht.ColumnIndex].ReadOnly &amp;amp&amp;amp dg[ht.ColumnIndex, ht.RowIndex].IsInEditMode)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;; &lt;FONT Color=#008000&gt;//when on a cell in edit mode, don't start drag drop&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (ht.ColumnIndex == -1 || dg.SelectionMode == &lt;FONT Color=#2b91af&gt;DataGridViewSelectionMode&lt;/FONT&gt;.FullRowSelect || AutoDragger.AlwaysDragFullRow)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DataGridViewRow&lt;/FONT&gt; row = dg.Rows[ht.RowIndex];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (row.DataBoundItem != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; row.DataBoundItem;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; row;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; dg[ht.ColumnIndex, ht.RowIndex].Value;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;Browsable&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt; LastDragInfo&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; curdrag;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnStartDrag(&lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt; e,&lt;FONT Color=#2b91af&gt;MouseEventArgs&lt;/FONT&gt; me)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (StartDrag != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;StartDrag(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, e);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (e.DragObject == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;e.DragObject = GetDragObject(e);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (e.DragObject != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;e.Control.DoDragDrop(e.DragObject, Effects);&lt;br&gt;OnDragStarted(e);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//dragging not allowed&lt;/FONT&gt;&lt;br&gt;curdrag = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnDragStarted(&lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; GetDragObject(&lt;FONT Color=#2b91af&gt;AutoDragEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; e.GetDragObject();&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;&amp;nbsp&amp;nbsp&amp;nbsp&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; fullrow;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotOnly applies when dragging on a datagridview.\r\nIf this value is not set, the full row only will be dragged if the selection mode of the grid is FullRowSelect or the rowheader is dragged and the cell value otherwise.&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AlwaysDragFullRow&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; fullrow; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { fullrow = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; IExtenderProvider Members&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IExtenderProvider&lt;/FONT&gt;.CanExtend(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; extendee)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; extendee &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Category&lt;/FONT&gt;(Category)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;.Hidden)] &lt;FONT Color=#008000&gt;//serialized in the control property&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; GetUseAutoDrag(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; c)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (controls.Count == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; controls.Contains(c);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetUseAutoDrag(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; c, &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; value)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (GetUseAutoDrag(c) == value) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!value)&lt;div style="margin-left:20pt"&gt;UnRegister(c);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;Register(c);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;}&lt;/DIV&gt;&lt;DIV Style=" Display='none'; BackGround-Color=#dcdcdc;" OnDblClick="var o = parentNode.firstChild;o.sel =1;o.click()"&gt;&lt;b&gt; . . .&lt;/b&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/9273.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>Generic comparer: for comparing/sorting sources of unknown types</title><link>http://blogs.vbcity.com/hotdog/archive/2008/12/29/9232.aspx</link><pubDate>Mon, 29 Dec 2008 03:56:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2008/12/29/9232.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/9232.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2008/12/29/9232.aspx#Feedback</comments><slash:comments>151</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/9232.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/9232.aspx</trackback:ping><description>&lt;P&gt;It's been a long time since making this class and don't believe I posted it yet, but since I'm going to use it in the DataGridViewGrouper (see previous post), thought I'd post it now.&lt;BR&gt;Since it's &amp;#8220;older&amp;#8221; code, it's fully .net 2.0 compatible. It can be uses where ever an IComparer interface is used. (or the Compare function of the GenericComparer&amp;lt;&amp;gt; class for a Comparison&amp;lt;&amp;gt; call)&lt;/P&gt;
&lt;P&gt;Usage example: &lt;BR&gt;&lt;!-- --Start of code block
--&gt;
&lt;DIV style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#2b91af&gt;Array&lt;/FONT&gt;.Sort(YourArray, &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;GenericComparer&lt;/FONT&gt;());&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;There is a generic comparer class already in the framework, but it will fail on certain types. It's been a while, but I believe the .net native class doesn't support the Nullable struct and&amp;nbsp;strong implementers of the generic&amp;nbsp;IComparer&amp;lt;&amp;gt; interface. (The new Linq will fail if the object sorted on is not an IComparable)&lt;/P&gt;&lt;!-- --Start of code block
--&gt;
&lt;DIV onkeydown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;amp;&amp;amp; i&lt;ch.selcount){ch.sel=i;ch.click();}" style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'" onclick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'300pt':null;if(i==1&amp;amp;&amp;amp; ch.offsetHeight&gt;h)ch.style.height=h;" sel="1" selold="1" selcount="3"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=0&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Hide&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bolder; MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=1&gt;&lt;INPUT onclick=this.blur(); type=radio CHECKED&gt;Scroll&lt;/SPAN&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=2&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 300pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt; System;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Linq;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Text;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Collections;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.ComponentModel;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;namespace&lt;/FONT&gt; Subro&lt;BR&gt;{&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Comparer that tries to find the 'strongest' comparer for a type. &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; if the type implements a generic IComparable, that is used.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; otherwise if it implements a normal IComparable, that is used.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; If neither are implemented, the ToString versions are compared. &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; INullable structures are also supported.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This way, the DefaultComparer can compare any object types and can be used for sorting any source.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;/summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;example&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;Array.Sort(YourArray,new GenericComparer());&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;/example&amp;gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;GenericComparer&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; GenericComparer()&lt;BR&gt;{&lt;/DIV&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; GenericComparer(&lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; Type)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.Type = Type;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;Type&lt;/FONT&gt; type;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; Type&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; type;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;throw&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ArgumentNullException&lt;/FONT&gt;();&lt;BR&gt;type = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;;&lt;BR&gt;comp = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;Type&lt;/FONT&gt; targettype;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; normally the same as the type, but can be set to a different type&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;/summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; TargetType&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (targettype == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; type;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; targettype;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (TargetType == &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;;&lt;BR&gt;targettype = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;;&lt;BR&gt;comp = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;IComparer&lt;/FONT&gt; comp;&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;IComparer&lt;/FONT&gt; GetGenericComparer(&lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; From, &lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; To)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;while&lt;/FONT&gt; (To != &lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt;))&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;IComparable&lt;/FONT&gt;&amp;lt;&amp;gt;).MakeGenericType(To).IsAssignableFrom(From))&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;)&lt;FONT color=#2b91af&gt;Activator&lt;/FONT&gt;.CreateInstance(&lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;StrongCompare&lt;/FONT&gt;&amp;lt;,&amp;gt;).MakeGenericType(From,To));&lt;/DIV&gt;To = To.BaseType;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt; GetComparer(&lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; From, &lt;FONT color=#2b91af&gt;Type&lt;/FONT&gt; To)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; gen = GetGenericComparer(From,To);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (gen != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; gen;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;else&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;if&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;IComparable&lt;/FONT&gt;).IsAssignableFrom(type))&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;)&lt;FONT color=#2b91af&gt;Activator&lt;/FONT&gt;.CreateInstance(&lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;NonGenericCompare&lt;/FONT&gt;&amp;lt;&amp;gt;).MakeGenericType(type));&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;if&lt;/FONT&gt; (type.IsGenericType &amp;amp;&amp;amp; &lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;Nullable&lt;/FONT&gt;&amp;lt;&amp;gt;) == type.GetGenericTypeDefinition())&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; basetype = type.GetGenericArguments()[0];&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;)&lt;FONT color=#2b91af&gt;Activator&lt;/FONT&gt;.CreateInstance(&lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;NullableComparer&lt;/FONT&gt;&amp;lt;&amp;gt;).MakeGenericType(basetype),
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;GetComparer(basetype, To == From ? basetype : To));&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringComparer&lt;/FONT&gt;();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;NullableComparer&lt;/FONT&gt;&amp;lt;T&amp;gt;:&lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;where&lt;/FONT&gt; T:&lt;FONT color=#0000ff&gt;struct&lt;/FONT&gt;&lt;/DIV&gt;{&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt; BaseComparer;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; NullableComparer(&lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt; BaseComparer)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.BaseComparer = BaseComparer;&lt;BR&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;object&lt;/FONT&gt; getval(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; o)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; ((&lt;FONT color=#2b91af&gt;Nullable&lt;/FONT&gt;&amp;lt;T&amp;gt;)o).Value;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Compare(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; x, &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; y)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; BaseComparer.Compare(getval(x), getval(y));&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StrongCompare&lt;/FONT&gt;&amp;lt;F,T&amp;gt; : &lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;where&lt;/FONT&gt; F : &lt;FONT color=#2b91af&gt;IComparable&lt;/FONT&gt;&amp;lt;T&amp;gt;&lt;/DIV&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Compare(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; x, &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; y)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; ((F)x).CompareTo((T)y);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;NonGenericCompare&lt;/FONT&gt;&amp;lt;T&amp;gt; : &lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;where&lt;/FONT&gt; T: &lt;FONT color=#2b91af&gt;IComparable&lt;/FONT&gt;&lt;/DIV&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Compare(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; x, &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; y)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; ((T)x).CompareTo(y);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringComparer&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Compare(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; x, &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; y)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; x.ToString().CompareTo(y.ToString());&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; Descending&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; factor &amp;lt; 0;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;factor = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt; ? -1 : 1;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;int&lt;/FONT&gt; factor = 1;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;int&lt;/FONT&gt; compare(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; x, &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; y)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (x == y) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; 0;&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;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (x == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; -1;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (y == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; 1;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (type == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Type = x.GetType();&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (comp == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;comp = GetComparer(type, TargetType);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;return&lt;/FONT&gt; comp.Compare(x, y);&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;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Compare(&lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; x, &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt; y)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; factor * compare(x, y);&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;GenericComparer&lt;/FONT&gt;&amp;lt;T&amp;gt; : &lt;FONT color=#2b91af&gt;GenericComparer&lt;/FONT&gt;,&lt;FONT color=#2b91af&gt;IComparer&lt;/FONT&gt;&amp;lt;T&amp;gt;&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; GenericComparer()
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;typeof&lt;/FONT&gt;(T))&lt;/DIV&gt;{ }&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Compare(T a, T b)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;.Compare(a, b);&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;PropertyDescriptorComparer&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;GenericComparer&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;PropertyDescriptor&lt;/FONT&gt; Prop;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; PropertyDescriptorComparer(&lt;FONT color=#2b91af&gt;PropertyDescriptor&lt;/FONT&gt; Prop)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;(Prop, &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;)&lt;/DIV&gt;{&lt;BR&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; PropertyDescriptorComparer(&lt;FONT color=#2b91af&gt;PropertyDescriptor&lt;/FONT&gt; Prop, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; Descending)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;(Prop.PropertyType)&lt;/DIV&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.Prop = Prop;&lt;FONT color=#0000ff&gt;&lt;BR&gt;this&lt;/FONT&gt;.Descending = Descending;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;partial&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Extend&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Sort&amp;lt;T&amp;gt;(&lt;FONT color=#0000ff&gt;this&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;T&amp;gt; list, &lt;FONT color=#2b91af&gt;Func&lt;/FONT&gt;&amp;lt;T, T, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&amp;gt; Comparer)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;list.Sort(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Comparison&lt;/FONT&gt;&amp;lt;T&amp;gt;(Comparer));&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Sort on a property or field&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;/summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Sort&amp;lt;T, S&amp;gt;(&lt;FONT color=#0000ff&gt;this&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;T&amp;gt; list, &lt;FONT color=#2b91af&gt;Func&lt;/FONT&gt;&amp;lt;T, S&amp;gt; Property)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; c = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; Subro.&lt;FONT color=#2b91af&gt;GenericComparer&lt;/FONT&gt;&amp;lt;S&amp;gt;();&lt;BR&gt;Sort(list, (t1, t2) =&amp;gt; c.Compare(Property(t1), Property(t2)));&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;}&lt;FONT color=#2b91af&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV ondblclick="var o = parentNode.firstChild;o.sel =1;o.click()" style="DISPLAY: none; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;/S&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/9232.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>Grouping a datagridview: the DataGridViewGrouper component</title><link>http://blogs.vbcity.com/hotdog/archive/2008/12/19/9226.aspx</link><pubDate>Fri, 19 Dec 2008 06:56:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2008/12/19/9226.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/9226.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2008/12/19/9226.aspx#Feedback</comments><slash:comments>85</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/9226.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/9226.aspx</trackback:ping><description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT size=4&gt;Complete Source Code: &lt;/FONT&gt;&lt;/STRONG&gt;&lt;A href="http://blogs.vbcity.com/hotdog/archive/2008/12/19/9225.aspx"&gt;&lt;STRONG&gt;&lt;FONT size=4&gt;http://blogs.vbcity.com/hotdog/archive/2008/12/19/9225.aspx&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;
&lt;HR id=null&gt;
Note: the code is now rewritten to be 2.0 compatible (the project was written in vs2008 with compatibility set on framework 2.0), but older designers may still have trouble compiling because of the use of newer syntax (such as automatic properties). All 'var' keywords should be replaced, but they tend to sneak in because they are so easy to use ;)&lt;BR&gt;If the newer syntax is a problem for many of you, drop me a note and I'll try to remove all of those syntaxes too.
&lt;HR id=null&gt;
&lt;BR&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example&lt;/STRONG&gt;:&lt;BR&gt;Assuming you have a form with a datagridview called dataGridView1, add this code (after setting its datasource): &lt;!-- --Start of code block
--&gt;
&lt;DIV onkeydown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;amp;&amp;amp; i&lt;ch.selcount){ch.sel=i;ch.click();}" style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'" onclick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'125pt':null;if(i==1&amp;amp;&amp;amp; ch.offsetHeight&gt;h)ch.style.height=h;" selcount="3" selold="2" sel="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=0&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Hide&lt;/SPAN&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=1&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Scroll&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bolder; MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=2&gt;&lt;INPUT onclick=this.blur(); type=radio CHECKED&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; grouper = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; Subro.Controls.&lt;FONT color=#2b91af&gt;DataGridViewGrouper&lt;/FONT&gt;(dataGridView1);&lt;BR&gt;grouper.SetGroupOn(&lt;FONT color=#a31515&gt;"NameOfThePropertyToGroupOn"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV ondblclick="var o = parentNode.firstChild;o.sel =2;o.click()" style="DISPLAY: none; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Functionality&lt;/STRONG&gt;:&lt;BR&gt;The DataGridViewGrouper is a component that can be added in the forms designer or in runtime to add grouping to any existing (databound) DataGridView. Grouping can be done on existing properties of the underlying data or with a custom value function. The displayed data can be altered through the exposed Display event.&lt;BR&gt;Grouped rows can be quickly selected by double clicking the group header, and the rows can be collapsed and expanded by the user. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Usage&lt;/STRONG&gt;:&lt;BR&gt;3&amp;nbsp;simple steps&lt;BR&gt;- Add the component to the designer or create it in runtime&lt;BR&gt;-&amp;nbsp;Set its DataGridView property to&amp;nbsp;any existing databound DataGridView &lt;BR&gt;-In runtime set the GroupOn property or call any of the SetGroupOn methods to start grouping&lt;/P&gt;
&lt;P&gt;Other settings include &lt;BR&gt;-the sorting of the groups (asc,desc or none, using the lists original sources order as leading)&lt;BR&gt;-if the count of rows has to be shown (the shown information can be altered by catching the Display event)&lt;BR&gt;-if the property name on which is grouped has to be shown (can also be altered by the Display event)&lt;BR&gt;-besides the options above, the shown group value can also be altered in the Display event.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Background&lt;/STRONG&gt;:&lt;BR&gt;For a while now I was facing a request to add grouping to an overview in a DataGridView. And as you may have noticed: there is no grouping functionality in the default System.Windows.Forms.DataGridView.&lt;BR&gt;Now there are ways of course, by adding DataGridViewRows manually and creating the groups by adding rows, but that would screw up the underlying data binding and automatic buffering/formatting/filtering/sorting, etc. Wanted to keep the bound functionality intact, but still create group rows. The solution in itself is simply to create a wrapper source that includes those rows and the grouped rows underneath and asign that to the grid, leaving the original source unaltered, and override the grouping rows painting/editing. A theory simple enough in itself, of course the implementation was a bit more work, but still less difficult than expected. &lt;BR&gt;The grouping source was created easily enough, especially with the great functionality of Linq. The trick was in seperating what the grid saw from the underlying functionality. By inheriting from BindingSource all tools were available for that job.&amp;nbsp;The DataSource and DataMember properties are set&amp;nbsp;by the original values of the same properties in the Grid, therefor exposing the proper 'Columns'.&amp;nbsp;All adding and removing had to be done in the underlying datagrid source, so those values were overridden.&lt;BR&gt;The DataGridViewGrouper component itself is assigned to a grid and the Source of the grid itself is set to the grouped source. When a group row has to be painted, it is handled by the component, the other rows follow the default behaviour. Editing for a grouprow is simply cancelled. If the original source is a BindingSource, the source's positioning is synchronized.&lt;BR&gt;Note that the index of the datagridview row won't be the same as the index in the original source, so you shouldn't be getting an object out of the original source directly with the row index. Then again, you should never do that anyway ;)&amp;nbsp; Use the Grid.Rows[position].DataBoundItem property instead.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.vbcity.com/hotdog/archive/2008/12/19/9225.aspx"&gt;Source Code&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;TODO: &lt;BR&gt;* Now the component synchronizes navigation if the source is another BindingSource. Will look later to synchronize with any CurrencyManager.&lt;BR&gt;* Adding code comments&amp;nbsp;:p&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/9226.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>Feedback (visualizer) sourcecode</title><link>http://blogs.vbcity.com/hotdog/archive/2008/02/22/8983.aspx</link><pubDate>Fri, 22 Feb 2008 01:09:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2008/02/22/8983.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/8983.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2008/02/22/8983.aspx#Feedback</comments><slash:comments>77</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/8983.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/8983.aspx</trackback:ping><description>&lt;!-- --Start of code block
--&gt;&lt;DIV Style=" Border='1px #000080 solid'; Margin-Left=10pt; Margin-Right=2pt;" OnKeyDown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;&amp; i&lt;ch.selcount){ch.sel=i;ch.click();}"&gt;&lt;DIV Style=" Font-Size=9pt; Font-Family='Microsoft Sans Serif'; Border-Bottom='1px #000080 solid';" OnClick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'500pt':null;if(i==1&amp;&amp; ch.offsetHeight&gt;h)ch.style.height=h;" sel=1 selold=1 selcount=3&gt;&lt;b&gt;  Code &lt;/b&gt;&lt;a href="javascript:" Style=" Margin-Left=10pt; Margin-Right=10pt;" OnClick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');"&gt;Copy&lt;/a&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=0"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Hide&lt;/SPAN&gt;&lt;SPAN Style=" Font-Weight=bolder; Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=1"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();" Checked=True&gt;Scroll&lt;/SPAN&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=2"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;&lt;DIV Style=" BackGround-Color=#dcdcdc; overflow='auto'; Height=500pt;"&gt;&lt;FONT Color=#0000ff&gt;using&lt;/FONT&gt; System;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Drawing;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Text;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Windows.Forms;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.ComponentModel;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.IO;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; Subro.Exceptions;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;namespace&lt;/FONT&gt; Subro.Interaction&lt;br&gt;{&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; A single feedback item. A feedback item can provide information&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; on status, progress and datetimes of execution&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; Feedback(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Message):&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.message = Message;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; Feedback()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.lastupdate = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.DateTime;&lt;/div&gt;}&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The time the feedback object was created&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; DateTime = &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.Now;&lt;FONT Color=#2b91af&gt;&lt;br&gt;DateTime&lt;/FONT&gt; lastupdate;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The last time the Feedback was updated (for example by updating the progress)&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; LastUpdate&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; lastupdate; }&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetLastUpdate()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;lastupdate = &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.Now;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The main information of this feedback&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; message;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Message&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; message; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;message = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;NotifyUpdate();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;int&lt;/FONT&gt; progress;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The progress of this item. The total progress is in relation&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; to the the value set at &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotProgressTarget&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltseealso cref=&amp;quotProgressTarget&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotProgressPercentage&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&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;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Progress&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; progress; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;progress = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;IsProgressUpdate = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;br&gt;NotifyUpdate();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt; Updated;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; NotifyUpdate()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SetLastUpdate();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Updated != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;Updated(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt;.Empty);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;int&lt;/FONT&gt; progresstarget = 100;&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; progressinpercentage = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Normal target of process is 100 as in 100 percent. Whatever value this&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; is set to, progress relates to it.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; For example: if looping through a number of lines,&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; you can set this target to the number of lines and &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotProgress&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; to&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; the line being processed&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; ProgressTarget&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; progresstarget; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;progresstarget = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;progressinpercentage = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;br&gt;NotifyUpdate();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The relative progress of this item.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;float&lt;/FONT&gt; ProgressPercentage&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (!IsProgressUpdate) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; 1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;float&lt;/FONT&gt;)progress / progresstarget;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetProgressString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (progressinpercentage)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; ProgressPercentage.ToString(&lt;FONT Color=#a31515&gt;&amp;quot###%&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; progress.ToString() + &lt;FONT Color=#a31515&gt;&amp;quot/&amp;quot&lt;/FONT&gt; + progresstarget.ToString();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Increase the &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotProgress&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; by one&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Increase()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Progress++;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowAlive()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;IsAliveIndicator = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsProgressUpdate = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; alivecount;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; AliveCount { &lt;FONT Color=#0000ff&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; alivecount; } }&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsAliveIndicator&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; alivecount &amp;gt 0; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (++alivecount == 0)&lt;div style="margin-left:20pt"&gt;alivecount++;&lt;/div&gt;NotifyUpdate();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;alivecount = 0;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.Format(&lt;FONT Color=#a31515&gt;&amp;quot{0}\t{1}&amp;quot&lt;/FONT&gt;, DateTime, message);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The level, this can be a custom level or set with &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackLevel&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt;.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; 0 = normal&amp;nbsp&amp;nbspnegative value is not so important, positive value is more important&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Level = (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)&lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;.Normal;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt; FeedbackLevel&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;)Level;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;.Custom;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Level = (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsNormalLevel { &lt;FONT Color=#0000ff&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Level == (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)&lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;.Normal; } }&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; CanShowExtraInfo&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; HasChildren; }&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowExtraInfo()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ShowExtraInfo(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowExtraInfo(&lt;FONT Color=#2b91af&gt;IWin32Window&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;children.Show(Owner);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; AppendExtraInfo(&lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; info)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;children.AppendFeedbackText(info);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemPainter&lt;/FONT&gt; GetPainter(&lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt; info)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemPainter&lt;/FONT&gt;(info);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; AppendInfo(&lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; info,&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; RowNumber)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;var&lt;/FONT&gt; sb = info.StringBuilder;&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltDIV&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; bold = Level &amp;gt 0, smaller = Level &amp;lt 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (bold) sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltB&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (smaller) sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltspan style='font-size:smaller'&amp;gt&amp;quot&lt;/FONT&gt;);&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltspan style='font-size:smaller;font-style:italic;'&amp;gt&amp;quot&lt;/FONT&gt;).Append(DateTime)&lt;div style="margin-left:20pt"&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/span&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (IsProgressUpdate)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; p = (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)(ProgressPercentage * 100);&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;@&amp;quot&amp;ltspan style=&amp;quot&amp;quotborder:'1 solid black';width:75px;margin-left:10;font-size:smaller&amp;quot&amp;quot&amp;gt&amp;quot&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt; .Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltspan style='position:absolute;width:&amp;quot&lt;/FONT&gt;)&lt;br&gt; .Append(p)&lt;br&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot%;background-color:green'&amp;gt&amp;lt/span&amp;gt&amp;quot&lt;/FONT&gt;)&lt;br&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltspan style='position:relative;width:100%'&amp;gt&amp;quot&lt;/FONT&gt;)&lt;br&gt;.Append(GetProgressString()).Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/span&amp;gt&amp;quot&lt;/FONT&gt;)&lt;br&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/span&amp;gt&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;}&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltspan style='margin-left:10'&amp;gt&amp;quot&lt;/FONT&gt;).Append(message)&lt;div style="margin-left:20pt"&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/span&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (CanShowExtraInfo)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; ExtraInfoAnchor = &lt;FONT Color=#a31515&gt;&amp;quotExtraInfo&amp;quot&lt;/FONT&gt; + RowNumber.ToString();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (info.AllowScripts)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;sb.Append(&lt;FONT Color=#a31515&gt;@&amp;quot&amp;ltA style='margin-left:5' href='javascript:' onclick=&amp;quot&amp;quot&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;this.index=1-this.index;&lt;br&gt;var&lt;div style="margin-left:20pt"&gt;index = this.index,&lt;br&gt;modes=new Array('none',''),&lt;br&gt;texts=new Array('Show details','Hide details');&lt;/div&gt;this.nextSibling.style.display=modes[index];&lt;br&gt;this.innerText=texts[index];&amp;quot&amp;quot&lt;br&gt;index=1&amp;gtHide details&amp;lt/A&amp;gt&amp;quot&lt;/FONT&gt;);&lt;div style="margin-left:80pt"&gt;}&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltdiv style='margin-left:20;background-color:lightblue;'&amp;gt&amp;quot&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lta name='&amp;quot&lt;/FONT&gt;).Append(ExtraInfoAnchor).Append(&lt;FONT Color=#a31515&gt;&amp;quot'&amp;gt&amp;lt/a&amp;gt&amp;quot&lt;/FONT&gt;);&lt;/div&gt;AppendExtraInfo(info);&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/div&amp;gt&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (bold) sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/B&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (smaller) sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/span&amp;gt&amp;quot&lt;/FONT&gt;);&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/DIV&amp;gt&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;FeedbackCollection&lt;/FONT&gt; children;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Use this colleciton to add children. NB calling this function the first time will&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; create the collection&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; Children&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (children == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;children = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt;();&lt;br&gt;children.Parent = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; children;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HasChildren&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; children != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp children.Count &amp;gt 0; }&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; static&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; mail&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;delegate&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SendMailDelegate&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Subject, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Body, &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsHTML);&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SendMailDelegate&lt;/FONT&gt; sendmail = &lt;FONT Color=#0000ff&gt;delegate&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Subject, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Body, &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsHTML)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;System.Net.Mail.&lt;FONT Color=#2b91af&gt;MailMessage&lt;/FONT&gt; sm = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT Color=#2b91af&gt;MailMessage&lt;/FONT&gt;();&lt;br&gt;sm.IsBodyHtml = IsHTML;&lt;br&gt;sm.Body = Body;&lt;br&gt;sm.Subject = Subject;&lt;br&gt;System.Net.Mail.&lt;FONT Color=#2b91af&gt;SmtpClient&lt;/FONT&gt; smtp = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT Color=#2b91af&gt;SmtpClient&lt;/FONT&gt;();&lt;br&gt;smtp.Send(sm);&lt;/div&gt;};&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SendMailDelegate&lt;/FONT&gt; DefaultSendMailMethod&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; sendmail; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ArgumentNullException&lt;/FONT&gt;();&lt;/div&gt;sendmail = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Exceptions&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;delegate&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ShowExceptionDelegate&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex);&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ShowExceptionDelegate&lt;/FONT&gt; showex =&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;delegate&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; m = ex.Message + &lt;FONT Color=#a31515&gt;&amp;quot\r\n----------------\r\nStack:\r\n&amp;quot&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;+ ex.StackTrace;&lt;FONT Color=#2b91af&gt;&lt;/div&gt;MessageBox&lt;/FONT&gt;.Show(m);&lt;/div&gt;};&lt;FONT Color=#0000ff&gt;&lt;/div&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ShowExceptionDelegate&lt;/FONT&gt; DefaultShowExceptionMethod&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; showex; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ArgumentNullException&lt;/FONT&gt;();&lt;br&gt;showex = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;} &lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/div&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; value)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;(value);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; General settings when the text of feedback is obtained.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltseealso cref=&amp;quotFeedbackCollection.GetTotalFeedbackText&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedback.AppendInfo&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; AppendInfoSettings():&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt;())&lt;br&gt;{&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; AppendInfoSettings(&lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.StringBuilder = sb;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt; StringBuilder;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AllowScripts;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; MaxLines;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; Append(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;StringBuilder.Append(Value);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; Append&amp;ltT&amp;gt(T Value)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;StringBuilder.Append(Value);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; A collection of &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedback&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; items. Besides being a collection&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; for different Feedback items, this class contains the methods to&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; visualize the feedback&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;BindingList&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&amp;gt&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; FeedbackCollection() { }&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FeedbackCollection(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; MaximumValues)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;maxcount = MaximumValues;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; This value can be set to indicate that this set is a childset of &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; another Feedback item&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Parent;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Add/Update&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; InsertItem(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index, &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;base&lt;/FONT&gt;.InsertItem(index, fb); &lt;br&gt;CheckMaxValues();&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;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnListChanged(&lt;FONT Color=#2b91af&gt;ListChangedEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;base&lt;/FONT&gt;.OnListChanged(e);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Parent != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;Parent.NotifyUpdate();&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Add(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Text)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Feedback&lt;/FONT&gt; fb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;(Text);&lt;br&gt;Add(fb);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; fb;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Add(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Text, &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt; Level)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Feedback&lt;/FONT&gt; fb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;(Text);&lt;br&gt;fb.FeedbackLevel = Level;&lt;br&gt;Add(fb);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; fb;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Add(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Progress)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;fb.Progress = Progress;&lt;br&gt;Add(fb);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ExceptionFeedback&lt;/FONT&gt; Add(&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ExceptionFeedback&lt;/FONT&gt; ef = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ExceptionFeedback&lt;/FONT&gt;(ex);&lt;br&gt;Add(ef);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; ef;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Zero result&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; By default this value is &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltc&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt;false&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/c&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt;, but the executing (batch) code&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; can set this value to indicate that all in all nothing has happened.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; (eg, code to import file did not find a file)&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; To include a reason, use &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotSetZeroResult&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ZeroResult&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; lastzeroresult != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (ZeroResult != &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;SetZeroResult(&lt;FONT Color=#a31515&gt;&amp;quotNo reason specified&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;LastZeroResult = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;ZeroResultFeedback&lt;/FONT&gt; lastzeroresult;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ZeroResultFeedback&lt;/FONT&gt; LastZeroResult&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; lastzeroresult;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (lastzeroresult == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#008000&gt;&lt;br&gt;/*&lt;br&gt;if (Parent != null)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (value != null)&lt;div style="margin-left:20pt"&gt;Parent.LastZeroResult = value;&lt;/div&gt;else if (Parent.lastzeroresult == lastzeroresult)&lt;div style="margin-left:20pt"&gt;Parent.LastZeroResult = null;&lt;/div&gt;&lt;/div&gt;}*/&lt;/FONT&gt;&lt;br&gt;lastzeroresult = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ZeroResultFeedback&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Reason;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ZeroResultFeedback(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; reason)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotBatch has zero result: [&amp;quot&lt;/FONT&gt; + reason + &lt;FONT Color=#a31515&gt;&amp;quot]&amp;quot&lt;/FONT&gt;)&lt;/div&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.FeedbackLevel = &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;.Important;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Reason = reason;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The reason that was indicated that the code where this feedback&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; was used with did not actually do anything.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; This value can be set when using &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotSetZeroResult&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ZeroResultReason&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (ZeroResult) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; lastzeroresult.Reason;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetZeroResult(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; reason)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ZeroResultFeedback&lt;/FONT&gt; fb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ZeroResultFeedback&lt;/FONT&gt;(reason);&lt;br&gt;Add(fb);&lt;br&gt;LastZeroResult = fb;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/div&gt;&lt;br&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Last&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[Count - 1];&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; StartTime&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Count == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.MinValue;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[0].DateTime;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; EndTime&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Count == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.MinValue;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; Last.LastUpdate;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;TimeSpan&lt;/FONT&gt; Duration&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; EndTime.Subtract(StartTime); }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; maxcount;&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The maximum amount of entries allowed&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; MaximumValues&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; maxcount; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;maxcount = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;CheckMaxValues();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; CheckMaxValues()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (maxcount &amp;gt 0)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;while&lt;/FONT&gt; (Count &amp;gt maxcount)&lt;div style="margin-left:20pt"&gt;RemoveAt(0);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Save/Mail&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Description is used when saving or mailing the list, so&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; this should contain information about the contents&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Description = &lt;FONT Color=#a31515&gt;&amp;quotFeedback list&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Save()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; file = &lt;FONT Color=#2b91af&gt;Application&lt;/FONT&gt;.CommonAppDataPath + &lt;FONT Color=#a31515&gt;@&amp;quot\Feedback\&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!&lt;FONT Color=#2b91af&gt;Directory&lt;/FONT&gt;.Exists(file)) &lt;FONT Color=#2b91af&gt;Directory&lt;/FONT&gt;.CreateDirectory(file);&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; notallowed = &lt;FONT Color=#a31515&gt;&amp;quot /\\&amp;quot&lt;/FONT&gt;, descr = Description;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (descr != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt notallowed.Length; i++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;descr = descr.Replace(notallowed[i], &lt;FONT Color=#a31515&gt;'_'&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;descr = &lt;FONT Color=#a31515&gt;&amp;quotfeedback&amp;quot&lt;/FONT&gt;;&lt;/div&gt;file += descr + &lt;FONT Color=#a31515&gt;&amp;quot.htm&amp;quot&lt;/FONT&gt;;&lt;br&gt;Save(file);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; file;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Save(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;lock&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;StreamWriter&lt;/FONT&gt; sw = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StreamWriter&lt;/FONT&gt;(file, &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;, System.Text.&lt;FONT Color=#2b91af&gt;Encoding&lt;/FONT&gt;.ASCII);&lt;br&gt;sw.Write(GetTotalFeedBackText());&lt;br&gt;sw.Close();&lt;br&gt;Add(&lt;FONT Color=#a31515&gt;&amp;quotList saved to &amp;quot&lt;/FONT&gt; + file);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Mail()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Mail(&lt;div style="margin-left:20pt"&gt;(ZeroResult&lt;br&gt;? &lt;FONT Color=#a31515&gt;&amp;quotZero result &amp;quot&lt;/FONT&gt;&lt;br&gt;: &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;+ &lt;FONT Color=#a31515&gt;&amp;quotBatch Feedback '&amp;quot&lt;/FONT&gt; + Description + &lt;FONT Color=#a31515&gt;&amp;quot'&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Mail(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Subject)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Feedback&lt;/FONT&gt;.DefaultSendMailMethod(Subject,GetTotalFeedBackText(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;),&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; MailExceptions()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Feedback&lt;/FONT&gt;.DefaultSendMailMethod(&lt;FONT Color=#a31515&gt;&amp;quotErrors in &amp;quot&lt;/FONT&gt; + Description,&lt;div style="margin-left:20pt"&gt;AppendFeedbackText(&lt;FONT Color=#0000ff&gt;&lt;br&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt;(),EnumerateAll&amp;lt&lt;FONT Color=#2b91af&gt;ExceptionFeedback&lt;/FONT&gt;&amp;gt(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)).ToString(),&lt;FONT Color=#0000ff&gt;&lt;br&gt;true&lt;/FONT&gt;&lt;br&gt;);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetTotalFeedBackText()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetTotalFeedBackText(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetTotalFeedBackText(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AllowScripts)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; AppendFeedbackText(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; { AllowScripts=AllowScripts}).ToString();&lt;/div&gt;}&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HasExceptions()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (fb.FeedbackLevel== &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;.Exception) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (fb.HasChildren &amp;amp&amp;amp fb.Children.HasExceptions())&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&amp;gt EnumerateAll&amp;ltFeedbackType&amp;gt()&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;where&lt;/FONT&gt; FeedbackType : &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&lt;/div&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; EnumerateAll&amp;ltFeedbackType&amp;gt(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&amp;gt EnumerateAll&amp;ltFeedbackType&amp;gt(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IncludeChildren)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;where&lt;/FONT&gt; FeedbackType : &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&lt;/div&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (fb &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; FeedbackType) &lt;FONT Color=#0000ff&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; fb;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (IncludeChildren &amp;amp&amp;amp fb.HasChildren)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (FeedbackType f &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; fb.Children.EnumerateAll&amp;ltFeedbackType&amp;gt(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;))&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; f;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendFeedbackText(&lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AllowScripts)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; AppendFeedbackText(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt;(sb) { AllowScripts = AllowScripts });&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendFeedbackText(&lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; info)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; AppendFeedbackText(info, &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendFeedbackText(&lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; info, &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&amp;gt list)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;var&lt;/FONT&gt; sb = info.StringBuilder;&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltDIV style=\&amp;quotborder='1px black solid'\&amp;quot&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Parent == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot\tFeedback &amp;quot&lt;/FONT&gt;)&lt;br&gt;.Append(Description)&lt;br&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot. Info created on &amp;quot&lt;/FONT&gt;).Append(&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.Now);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (ZeroResult)&lt;div style="margin-left:20pt"&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltdiv style=\&amp;quotborder:'1 solid black';background-color:cyan\&amp;quot&amp;gt&amp;ltb&amp;gtFinished with zero result: &amp;lt/b&amp;gt&amp;quot&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;.Append(ZeroResultReason)&lt;br&gt;.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/div&amp;gt&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;ltHR&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; i = 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; list)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;fb.AppendInfo(info, i++);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (info.MaxLines &amp;gt 0 &amp;amp&amp;amp i == info.MaxLines) &lt;FONT Color=#0000ff&gt;break&lt;/FONT&gt;;&lt;/div&gt;}&lt;br&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot&amp;lt/DIV&amp;gt&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; sb;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowHTML()&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (System.Threading.&lt;FONT Color=#2b91af&gt;Thread&lt;/FONT&gt;.CurrentThread.GetApartmentState() == System.Threading.&lt;FONT Color=#2b91af&gt;ApartmentState&lt;/FONT&gt;.STA)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Form&lt;/FONT&gt; f = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Form&lt;/FONT&gt;();&lt;FONT Color=#2b91af&gt;&lt;br&gt;WebBrowser&lt;/FONT&gt; wb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;WebBrowser&lt;/FONT&gt;();&lt;br&gt;wb.Dock = &lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Fill;&lt;br&gt;f.Controls.Add(wb);&lt;br&gt;wb.DocumentText = GetTotalFeedBackText();&lt;br&gt;f.WindowState = &lt;FONT Color=#2b91af&gt;FormWindowState&lt;/FONT&gt;.Maximized;&lt;br&gt;f.Show();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//Unfortunately, using the webbrowser requires an STA &lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;//if this is not the case of the current thread, save and show with explorer&lt;/FONT&gt;&lt;br&gt;System.Diagnostics.&lt;FONT Color=#2b91af&gt;Process&lt;/FONT&gt;.Start(Save());&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/div&gt;&lt;br&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Creates a &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackForm&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; with a &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackControl&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; and shows it or&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; shows an existing form if it was already created&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; Show()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Show((&lt;FONT Color=#2b91af&gt;IWin32Window&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; Show(&lt;FONT Color=#2b91af&gt;IWin32Window&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Owner &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Show(Owner &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (frm == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;CreateFeedbackForm();&lt;br&gt;frm.Show(Owner);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;frm.Activate();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; frm;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;delegate&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;show&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; owner);&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; Show(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Owner == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Show();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Owner.InvokeRequired)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;Owner.Invoke(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;show&lt;/FONT&gt;(Show), Owner);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;&lt;/div&gt;if&lt;/FONT&gt; (frm == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;CreateFeedbackForm(Owner);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:80pt"&gt;Form&lt;/FONT&gt; f = Owner.FindForm();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (f != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (f.IsMdiContainer)&lt;div style="margin-left:20pt"&gt;frm.MdiParent = f;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (f.IsMdiChild)&lt;div style="margin-left:20pt"&gt;frm.MdiParent = f.MdiParent;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;if&lt;/FONT&gt; (frm.MdiParent == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;frm.Show(Owner);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;frm.Show();&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;frm.Activate();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; frm;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;FONT Color=#2b91af&gt;&lt;br&gt;FeedbackForm&lt;/FONT&gt; frm;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowDialog()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ShowDialog(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowDialog(&lt;FONT Color=#2b91af&gt;IWin32Window&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;CreateFeedbackForm().ShowDialog(Owner);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; creates a feedbackform based on this collection&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&amp;gt&amp;lt/returns&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; CreateFeedbackForm()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;createForm();&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; frm;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; createForm()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (frm == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;frm = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; This overload of &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotCreateFeedbackForm()&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; makes sure&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; the &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackForm&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; is created on the same thread&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; as the &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltc&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt;ThreadControl&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/c&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; CreateFeedbackForm(&lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt; ThreadControl)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (ThreadControl == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; || !ThreadControl.InvokeRequired)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; CreateFeedbackForm();&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;CloseFeedbackForm();&lt;br&gt;ThreadControl.Invoke(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Threading.&lt;FONT Color=#2b91af&gt;ThreadStart&lt;/FONT&gt;(createForm));&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; frm;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; If a &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackForm&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; is shown, this method will close it&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; CloseFeedbackForm()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (frm != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (frm.InvokeRequired)&lt;div style="margin-left:20pt"&gt;frm.Invoke(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Threading.&lt;FONT Color=#2b91af&gt;ThreadStart&lt;/FONT&gt;(frm.Dispose));&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;frm.Dispose();&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt; { }&lt;br&gt;frm = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#008000&gt;&lt;br&gt;/*&lt;div style="margin-left:60pt"&gt;internal void FormClosed()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;frm = null;&lt;/div&gt;}&lt;/div&gt; * */&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Basically just a form with a &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackControl&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackForm&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Form&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;FeedbackControl&lt;/FONT&gt; fc = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackControl&lt;/FONT&gt;();&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FeedbackForm()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Text = DefaultText;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;br&gt;KeyPreview = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&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;br&gt;fc.CollectionChanged += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(fc_CollectionChanged);&lt;br&gt;fc.Dock = &lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Fill;&lt;br&gt;Controls.Add(fc);&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; FeedbackForm(&lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; collection)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;()&lt;/div&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Collection = collection;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Add(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; fc.Add(fb);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; Collection&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; fc.Collection; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { fc.Collection = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; fc_CollectionChanged(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SetText();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; DefaultText = &lt;FONT Color=#a31515&gt;&amp;quotFeedback information&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; SetText()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; text = DefaultText;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt;(Collection!=&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp Collection.Description!=&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;text = &lt;FONT Color=#a31515&gt;&amp;quot[&amp;quot&lt;/FONT&gt; + Collection.Description + &lt;FONT Color=#a31515&gt;&amp;quot] &amp;quot&lt;/FONT&gt; + text;&lt;/div&gt;Text = text;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Size&lt;/FONT&gt; DefaultFormSize = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Size&lt;/FONT&gt;(300, 300);&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Size&lt;/FONT&gt; DefaultSize&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; DefaultFormSize;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnKeyDown(&lt;FONT Color=#2b91af&gt;KeyEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (e.KeyCode == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Escape) Close();&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.OnKeyDown(e);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnClosed(&lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Collection.CloseFeedbackForm();&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; A control containing a &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotFeedbackListBox&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; and&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; some extra linklabels for extra gui options&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackControl&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Control&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;FeedbackListBox&lt;/FONT&gt; lb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackListBox&lt;/FONT&gt;();&lt;FONT Color=#2b91af&gt;&lt;br&gt;BottomPanel&lt;/FONT&gt; pnlBottom;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FeedbackControl()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;lb.Dock = &lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Fill;&lt;br&gt;lb.CollectionChanged += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(lb_DataSourceChanged);&lt;br&gt;Controls.Add(lb);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;pnlBottom = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;BottomPanel&lt;/FONT&gt;();&lt;br&gt;Controls.Add(pnlBottom);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; lb_DataSourceChanged(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pnlBottom.Visible = Collection != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; By Asigning a collection, the listbox will update&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; itself when messages are received.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; NB: each collection can have only one FeedbackControl asigned to it.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; Collection&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; lb.Collection; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;lb.Collection = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt; CollectionChanged&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;add&lt;/FONT&gt; { lb.CollectionChanged += &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;remove&lt;/FONT&gt; { lb.CollectionChanged -= &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;BottomPanel&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Panel&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;LinkLabel&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;llMail = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;LinkLabel&lt;/FONT&gt;(),&lt;br&gt;llSave = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;LinkLabel&lt;/FONT&gt;(),&lt;br&gt;llShow = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;LinkLabel&lt;/FONT&gt;();&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; BottomPanel()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Dock = &lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Bottom;&lt;br&gt;Padding = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Padding&lt;/FONT&gt;(1);&lt;br&gt;Height = 20;&lt;br&gt;AddLabel(llMail);&lt;br&gt;AddLabel(llSave);&lt;br&gt;AddLabel(llShow);&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;llMail.Click += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(llMail_Click);&lt;br&gt;llMail.Text = &lt;FONT Color=#a31515&gt;&amp;quotMail list&amp;quot&lt;/FONT&gt;;&lt;br&gt;llSave.Click += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(llSave_Click);&lt;br&gt;llSave.Text = &lt;FONT Color=#a31515&gt;&amp;quotSave list&amp;quot&lt;/FONT&gt;;&lt;br&gt;llShow.Click += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(llShow_Click);&lt;br&gt;llShow.Text = &lt;FONT Color=#a31515&gt;&amp;quotShow overview&amp;quot&lt;/FONT&gt;;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;void&lt;/FONT&gt; llShow_Click(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (InvokeRequired)&lt;div style="margin-left:20pt"&gt;Invoke(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(llShow_Click), sender, e);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;coll.ShowHTML();&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackControl&lt;/FONT&gt; Parent&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;.Parent &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackControl&lt;/FONT&gt;; }&lt;/div&gt;}&lt;FONT Color=#2b91af&gt;&lt;br&gt;FeedbackCollection&lt;/FONT&gt; coll&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Parent.Collection; }&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; llSave_Click(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (InvokeRequired)&lt;div style="margin-left:20pt"&gt;Invoke(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(llSave_Click), sender, e);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;SaveFileDialog&lt;/FONT&gt; sf = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SaveFileDialog&lt;/FONT&gt;();&lt;br&gt;sf.Filter = &lt;FONT Color=#a31515&gt;&amp;quotHTML file|*.htm;*.html&amp;quot&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:120pt"&gt;if&lt;/FONT&gt; (sf.ShowDialog(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;) == &lt;FONT Color=#2b91af&gt;DialogResult&lt;/FONT&gt;.OK)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;coll.Save(sf.FileName);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:100pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;MessageBox&lt;/FONT&gt;.Show(&lt;FONT Color=#a31515&gt;&amp;quotError saving list:\r\n&amp;quot&lt;/FONT&gt; + ex.Message);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;void&lt;/FONT&gt; llMail_Click(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (InvokeRequired)&lt;div style="margin-left:20pt"&gt;Invoke(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(llMail_Click), sender, e);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;coll.Mail();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;MessageBox&lt;/FONT&gt;.Show(&lt;FONT Color=#a31515&gt;&amp;quotError mailing list:\r\n&amp;quot&lt;/FONT&gt; + ex.Message);&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;void&lt;/FONT&gt; AddLabel(&lt;FONT Color=#2b91af&gt;LinkLabel&lt;/FONT&gt; ll)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ll.Dock = &lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Left;&lt;br&gt;Controls.Add(ll);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Add(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; lb.Add(fb);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Count&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; lb.Count; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Index]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; lb[Index]; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackAlivePanel&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Panel&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;PulseRectangle&lt;/FONT&gt; pr = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PulseRectangle&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FeedbackAlivePanel()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SetStyle(&lt;FONT Color=#2b91af&gt;ControlStyles&lt;/FONT&gt;.UserPaint&lt;br&gt;| &lt;FONT Color=#2b91af&gt;ControlStyles&lt;/FONT&gt;.AllPaintingInWmPaint, &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnResize(&lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; eventargs)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pr.Bounds = Bounds;&lt;br&gt;Increase();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Increase()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Invalidate();&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnPaint(&lt;FONT Color=#2b91af&gt;PaintEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pr.Paint(e.Graphics);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; A listbox specifically for feedback items. The items are graphically shown to clearly&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; outline their type of feedback&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackListBox&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;ListBox&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; FeedbackListBox()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DrawMode = &lt;FONT Color=#2b91af&gt;DrawMode&lt;/FONT&gt;.OwnerDrawFixed;&lt;br&gt;SetStyle(&lt;FONT Color=#2b91af&gt;ControlStyles&lt;/FONT&gt;.AllPaintingInWmPaint&lt;div style="margin-left:20pt"&gt;| &lt;FONT Color=#2b91af&gt;ControlStyles&lt;/FONT&gt;.OptimizedDoubleBuffer, &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;);&lt;/div&gt;items = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ItemCollection&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (coll == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotNo collection has been started yet&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; coll[index];&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;Browsable&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt; .Hidden)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ItemCollection&lt;/FONT&gt; Items&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; items; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;ItemCollection&lt;/FONT&gt; items;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ItemCollection&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackListBox&lt;/FONT&gt; Owner;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ItemCollection(&lt;FONT Color=#2b91af&gt;FeedbackListBox&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Owner = Owner;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Index]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Owner[Index];&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Count { &lt;FONT Color=#0000ff&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Owner.Count; } }&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Add(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Owner.Add(fb);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; IndexOf(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Owner.IndexOf(fb);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Add(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (coll == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) Collection = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt;();&lt;br&gt;coll.Add(fb);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; fb;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Collection_ListChanged(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;ListChangedEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;switch&lt;/FONT&gt; (e.ListChangedType)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemAdded:&lt;FONT Color=#0000ff&gt;&lt;br&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemChanged:&lt;FONT Color=#0000ff&gt;&lt;br&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemDeleted:&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//this inbetween class is used because in threading environments&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;//the collection can be updated before the invoke is finished&lt;/FONT&gt;&lt;br&gt;update(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Index=e.NewIndex,&lt;br&gt;Item=((&lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt;)sender)[e.NewIndex],&lt;br&gt;Type= e.ListChangedType&lt;/div&gt;});&lt;FONT Color=#0000ff&gt;&lt;br&gt;break&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt;&lt;br&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;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Index;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Item;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt; Type;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;Queue&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt;&amp;gt updates = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Queue&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt;&amp;gt();&lt;FONT Color=#0000ff&gt;&lt;br&gt;volatile&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; updating;&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; update(&lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt; info)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;lock&lt;/FONT&gt; (updates)&lt;div style="margin-left:20pt"&gt;updates.Enqueue(info);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (!updating &amp;amp&amp;amp !IsDisposed)&lt;div style="margin-left:20pt"&gt;BeginInvoke((&lt;FONT Color=#2b91af&gt;Void&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;delegate&lt;/FONT&gt;()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;update();&lt;/div&gt;});&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Console&lt;/FONT&gt;.WriteLine(ex.Message);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; update()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (updating) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;br&gt;updating = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;updateinfo&lt;/FONT&gt; info ;&lt;FONT Color=#0000ff&gt;&lt;br&gt;while&lt;/FONT&gt;(updates.Count&amp;gt0)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;lock&lt;/FONT&gt;(updates)&lt;div style="margin-left:20pt"&gt;info = updates.Dequeue();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;switch&lt;/FONT&gt; (info.Type)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemAdded:&lt;div style="margin-left:20pt"&gt;Init(info.Item, info.Index);&lt;FONT Color=#0000ff&gt;&lt;br&gt;break&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemChanged:&lt;div style="margin-left:20pt"&gt;Update(info.Item, info.Index);&lt;FONT Color=#0000ff&gt;&lt;br&gt;break&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemDeleted:&lt;div style="margin-left:20pt"&gt;Remove(info);&lt;FONT Color=#0000ff&gt;&lt;br&gt;break&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#2b91af&gt;&lt;br&gt;Application&lt;/FONT&gt;.DoEvents();&lt;br&gt;updating = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Init(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;fb.Updated += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(Feedback_Updated);&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&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;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.Items.Insert(index, fb);&lt;br&gt;SetIndex(index);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; Remove(&lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt; inf)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;inf.Item.Updated -= &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(Feedback_Updated);&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.Items.RemoveAt(inf.Index);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Feedback_Updated(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;var&lt;/FONT&gt; u = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;updateinfo&lt;/FONT&gt;();&lt;br&gt;u.Item= (&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;)sender;&lt;br&gt;u.Index=IndexOf(u.Item);&lt;br&gt;u.Type =u.Index==-1 ? &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemDeleted : &lt;FONT Color=#2b91af&gt;ListChangedType&lt;/FONT&gt;.ItemChanged;&lt;br&gt;update(u);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;delegate&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Void&lt;/FONT&gt;();&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; UpdateSummary()&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; Update(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (fb.IsAliveIndicator)&lt;div style="margin-left:20pt"&gt;UpdatePulse(fb);&lt;FONT Color=#008000&gt;&lt;/div&gt;//System.Diagnostics.Debug.Assert(index &amp;gt= 0);&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (index &amp;gt= 0)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; r = GetRectangle(index);&lt;br&gt;Invalidate(r);&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;SetIndex(index);&lt;FONT Color=#2b91af&gt;&lt;br&gt;Application&lt;/FONT&gt;.DoEvents();&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;fb.Updated -= &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(Feedback_Updated);&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;Rectangle&lt;/FONT&gt; GetRectangle(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; r = ClientRectangle;&lt;br&gt;r.Height = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.ItemHeight;&lt;br&gt;r.Y = r.Height*index;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; r;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; SetIndex(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SelectedIndex = index;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; IndexOf(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (coll == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; -1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; coll.IndexOf(fb);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Count&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (coll == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; coll.Count;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&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;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnDrawItem(&lt;FONT Color=#2b91af&gt;DrawItemEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;object&lt;/FONT&gt; item = &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;.Items[e.Index];&lt;FONT Color=#2b91af&gt;&lt;br&gt;Feedback&lt;/FONT&gt; fb = (&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;)item ;&lt;FONT Color=#2b91af&gt;&lt;br&gt;FeedbackItemInfo&lt;/FONT&gt; inf = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt;(fb,e,coll.StartTime,&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;br&gt;fb.GetPainter(inf).Paint();&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt; CollectionChanged;&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;FeedbackCollection&lt;/FONT&gt; coll;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; Collection&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; coll;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (coll == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;br&gt;BeginUpdate();&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.Items.Clear();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt;(coll!=&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;coll.ListChanged += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedEventHandler&lt;/FONT&gt;(Collection_ListChanged);&lt;FONT Color=#008000&gt;&lt;/div&gt;//base.DataSource =&amp;nbsp&amp;nbspDataSource not used because of threading problems&lt;/FONT&gt;&lt;br&gt;coll = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&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;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (coll != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&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;div style="margin-left:20pt"&gt;coll.ListChanged += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ListChangedEventHandler&lt;/FONT&gt;(Collection_ListChanged);&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt coll.Count; i++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Init(coll[i], i);&lt;/div&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;/div&gt;}&lt;br&gt;EndUpdate();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (CollectionChanged != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;CollectionChanged(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt;.Empty);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt; .Hidden)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; DataSource&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; coll; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;Dictionary&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;PulseRectangle&lt;/FONT&gt;&amp;gt pulses;&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; UpdatePulse(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;GetPulse(fb).Update();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PulseRectangle&lt;/FONT&gt; GetPulse(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; fb)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (pulses == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;pulses = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Dictionary&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;PulseRectangle&lt;/FONT&gt;&amp;gt();&lt;FONT Color=#2b91af&gt;&lt;/div&gt;PulseRectangle&lt;/FONT&gt; pr;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!pulses.TryGetValue(fb, &lt;FONT Color=#0000ff&gt;out&lt;/FONT&gt; pr))&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pr = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PulseRectangle&lt;/FONT&gt;();&lt;br&gt;pr.Count = 20;&lt;br&gt;pulses.Add(fb, pr);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; pr;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnClick(&lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (mouseonbutton != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;mouseonbutton.ShowExtraInfo(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.OnClick(e);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;Feedback&lt;/FONT&gt; mouseonbutton;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnMouseMove(&lt;FONT Color=#2b91af&gt;MouseEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;&lt;FONT Color=#2b91af&gt;&lt;br&gt;Feedback&lt;/FONT&gt; onbutton = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Count &amp;gt 0 &amp;amp&amp;amp &lt;FONT Color=#2b91af&gt;FeedbackItemPainter&lt;/FONT&gt;.ExtraInfoButtonArea.Contains(e.X,e.Y))&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; index = IndexFromPoint(e.Location);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (index != -1 &amp;amp&amp;amp index &amp;lt Count)&lt;div style="margin-left:20pt"&gt;onbutton = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[index];&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (mouseonbutton != onbutton)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (onbutton != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp onbutton.CanShowExtraInfo)&lt;div style="margin-left:20pt"&gt;mouseonbutton = onbutton;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;mouseonbutton = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;Cursor = mouseonbutton != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; ? &lt;FONT Color=#2b91af&gt;Cursors&lt;/FONT&gt;.Hand : &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;br&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt;&lt;br&gt;{&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DrawItemEventArgs&lt;/FONT&gt; DrawItemEventArgs;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsSelected;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Item;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Index;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; Bounds;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; CollectionStartTime;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackListBox&lt;/FONT&gt; Owner;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; FeedbackItemInfo(&lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt; Item, &lt;FONT Color=#2b91af&gt;DrawItemEventArgs&lt;/FONT&gt; e, &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; CollectionStartTime, &lt;FONT Color=#2b91af&gt;FeedbackListBox&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Item = Item;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.DrawItemEventArgs = e;&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;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.IsSelected = (e.State &amp;amp &lt;FONT Color=#2b91af&gt;DrawItemState&lt;/FONT&gt;.Selected) &amp;gt 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Index = e.Index;&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;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Owner = Owner;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Bounds = e.Bounds;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.CollectionStartTime = CollectionStartTime;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemPainter&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; r;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FontFamily&lt;/FONT&gt; FontFamily;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; MessageArea;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt; Info;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Graphics&lt;/FONT&gt; Graphics;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FeedbackItemPainter(&lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt; info)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Info = info;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.r = info.Bounds;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.FontFamily = info.DrawItemEventArgs.Font.FontFamily;&lt;br&gt;MessageArea = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt;(MessageOffset, r.Y, r.Width - MessageOffset, r.Height);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Graphics = info.DrawItemEventArgs.Graphics;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;ExtraInfoOffset = 75,&lt;br&gt;ExtraInfoWidth = 10,&lt;br&gt;ProgressWidth = 40,&lt;br&gt;MessageOffset = 90,&lt;br&gt;TimeOffset = 32;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; ExtraInfoButtonArea = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt;(ExtraInfoOffset, 0, ExtraInfoWidth, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;.MaxValue);&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawDateTime()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DrawDateTime(Info.Index &amp;gt 0,&lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.Black);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawDateTime(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; Relative,&lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; b)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//clear background&lt;/FONT&gt;&lt;br&gt;ClearDateTimeBackGround(&lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.White);&lt;FONT Color=#008000&gt;&lt;br&gt;//draw text&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Relative)&lt;div style="margin-left:20pt"&gt;DrawRelativeTime(Info.Item.LastUpdate.Subtract(Info.CollectionStartTime),b);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;DrawAbsoluteTime(b);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; DrawAbsoluteTime(&lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; b)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Graphics.DrawString(&lt;div style="margin-left:20pt"&gt;Info.Item.DateTime.ToShortDateString() + &lt;FONT Color=#a31515&gt;&amp;quot &amp;quot&lt;/FONT&gt; + Info.Item.DateTime.ToString(&lt;FONT Color=#a31515&gt;&amp;quothh:mm.ss&amp;quot&lt;/FONT&gt;),&lt;br&gt;GetFont(6.5f), b, r.Left, r.Top + 1);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; DrawRelativeTime(&lt;FONT Color=#2b91af&gt;TimeSpan&lt;/FONT&gt; diff,&lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; b)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Graphics.DrawString(&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt;.Format(&lt;FONT Color=#a31515&gt;&amp;quot+{0:00}:{1:00}.{2:00}.{3:000}&amp;quot&lt;/FONT&gt;,&lt;div style="margin-left:20pt"&gt;diff.Hours, diff.Minutes, diff.Seconds, diff.Milliseconds),&lt;br&gt;GetFont(7.2f)&lt;br&gt;, b, r.Left, r.Top);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Font&lt;/FONT&gt; GetFont(&lt;FONT Color=#0000ff&gt;float&lt;/FONT&gt; size)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Font&lt;/FONT&gt;(FontFamily, size);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ClearDateTimeBackGround(&lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; b)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Graphics.FillRectangle(b, DateTimeArea);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; DateTimeArea&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt;(r.Left, r.Top, r.Left + ExtraInfoOffset, r.Height);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt; GetBackgroundColor()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt;(Info.IsSelected)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.Blue;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.White;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawSelectionRectangle()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DrawSelectionRectangle(GetBackgroundColor());&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawSelectionRectangle(&lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt; c)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Graphics.DrawRectangle(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Pen&lt;/FONT&gt;(c), r);&lt;br&gt;ClearMessageBackGround(c);&lt;/div&gt;}&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ClearMessageBackGround(&lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt; c)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Graphics.FillRectangle(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SolidBrush&lt;/FONT&gt;(c), MessageArea);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawExtraInfoButton()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; rectEI = ExtraInfoButtonArea;&lt;br&gt;rectEI.Y = r.Y;&lt;br&gt;rectEI.Height = r.Height;&lt;br&gt;DrawExtraInfoButton(rectEI);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawExtraInfoButton(&lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; r)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ControlPaint&lt;/FONT&gt;.DrawButton(Graphics, r, &lt;FONT Color=#2b91af&gt;ButtonState&lt;/FONT&gt;.Normal);&lt;br&gt;r.X += 2;&lt;br&gt;Graphics.DrawString(&lt;FONT Color=#a31515&gt;&amp;quoti&amp;quot&lt;/FONT&gt;, GetFont(7), &lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.Blue, r);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawMessage()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DrawMessage(offset);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawMessage(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Offset)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Color&lt;/FONT&gt; c = Info.IsSelected ? &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.WhiteSmoke : &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.Black;&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;FONT Color=#2b91af&gt;&lt;br&gt;Rectangle&lt;/FONT&gt; r = MessageArea;&lt;br&gt;r.X += Offset;&lt;br&gt;r.Width -= Offset;&lt;br&gt;DrawMessage(r, &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SolidBrush&lt;/FONT&gt;(c));&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawMessage(&lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; r,&lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; b)&lt;br&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;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Font&lt;/FONT&gt; f = GetFont(7);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Info.Item.Level &amp;gt 0)&lt;div style="margin-left:20pt"&gt;f = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Font&lt;/FONT&gt;(f, &lt;FONT Color=#2b91af&gt;FontStyle&lt;/FONT&gt;.Bold);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;Graphics.DrawString(Info.Item.Message, f, b, r);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;int&lt;/FONT&gt; offset;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; PaintProgress()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;RectangleF&lt;/FONT&gt; rectProg = GetProgressRectangle();&lt;br&gt;rectProg.X++;&lt;br&gt;rectProg.Inflate(0, -1);&lt;br&gt;Graphics.FillRectangle(&lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.White, rectProg);&lt;FONT Color=#2b91af&gt;&lt;br&gt;Pen&lt;/FONT&gt; p = &lt;FONT Color=#2b91af&gt;Pens&lt;/FONT&gt;.Black;&lt;br&gt;Graphics.DrawRectangle(p, &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt;.Round(rectProg));&lt;FONT Color=#0000ff&gt;&lt;br&gt;float&lt;/FONT&gt; penwidth = .5f;&lt;br&gt;rectProg.Inflate(-penwidth, -penwidth);&lt;br&gt;rectProg.Width *= Info.Item.ProgressPercentage;&lt;br&gt;Graphics.FillRectangle(&lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.Green, rectProg);&lt;FONT Color=#2b91af&gt;&lt;br&gt;Font&lt;/FONT&gt; f = GetFont(7);&lt;br&gt;Graphics.DrawString(Info.Item.GetProgressString(), f,&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Brushes&lt;/FONT&gt;.Navy, rectProg.Left + 1, rectProg.Top - 1);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; PaintAlive()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; r = GetProgressRectangle();&lt;br&gt;r.Inflate(0, -1);&lt;FONT Color=#2b91af&gt;&lt;br&gt;PulseRectangle&lt;/FONT&gt; pr = Info.Owner.GetPulse(Info.Item);&lt;br&gt;pr.Bounds = r;&lt;br&gt;pr.Paint(Graphics);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; GetProgressRectangle()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; r = MessageArea;&lt;br&gt;r.X += offset;&lt;br&gt;offset += ProgressWidth + 2;&lt;br&gt;r.Width = ProgressWidth;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; r;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; IncreaseOffset(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; by)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;offset += by;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Paint()&lt;br&gt;{&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;DrawDateTime();&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (Info.Item.CanShowExtraInfo)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DrawExtraInfoButton();&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;DrawSelectionRectangle();&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:60pt"&gt;//draw progress&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Info.Item.Progress &amp;gt 0)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;PaintProgress();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:60pt"&gt;//draw alive&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Info.Item.IsAliveIndicator)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;PaintAlive();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:60pt"&gt;//draw message&lt;/FONT&gt;&lt;br&gt;DrawMessage();&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PulseRectangle&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; bounds;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; Bounds&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; bounds; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (bounds == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;Rectangle&lt;/FONT&gt; r = bounds;&lt;br&gt;bounds = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (r.Width != &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.Width || ps == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;Update();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;FillDrawPoints();&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; transform(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; x, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; y)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (x == 0 &amp;amp&amp;amp y == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt ps.Length; i++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ps[i].X -= x;&lt;br&gt;ps[i].Y -= y;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The number of points to draw.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Call Update manually after setting this value&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Count = 200;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;[] ps, drawpoints;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Update()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Random&lt;/FONT&gt; r = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Random&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;double&lt;/FONT&gt; step = (&lt;FONT Color=#0000ff&gt;double&lt;/FONT&gt;)bounds.Width / Count;&lt;br&gt;ps = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;[Count];&lt;br&gt;drawpoints = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt Count; i++)&lt;div style="margin-left:20pt"&gt;ps[i] = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;((&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)(step * i), r.Next(100));&lt;/div&gt;FillDrawPoints();&lt;/div&gt;}&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The pen with which the pulses are drawn&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Pen&lt;/FONT&gt; Pen = &lt;FONT Color=#2b91af&gt;Pens&lt;/FONT&gt;.LightGreen;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; BackGroundBrush = &lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.Black;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; FillDrawPoints()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; left = bounds.Left, h = bounds.Height, top = bounds.Top;&lt;br&gt;drawpoints = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;[ps.Length];&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt ps.Length; i++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;drawpoints[i].X = ps[i].X + left;&lt;br&gt;drawpoints[i].Y = top + (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)(h * ps[i].Y / 100);&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Paint(&lt;FONT Color=#2b91af&gt;Graphics&lt;/FONT&gt; g)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (ps == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) Update();&lt;br&gt;g.FillRectangle(BackGroundBrush, bounds);&lt;br&gt;g.DrawLines(Pen, drawpoints);&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The importance of the feedback&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Custom = 100,&lt;br&gt;Trivial = -100,&lt;br&gt;Normal = 0,&lt;br&gt;SuperNormal = 200,&lt;br&gt;Exception = 500,&lt;br&gt;Important = 1000&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;interface&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IFeedBackSupporter&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;FeedbackCollection&lt;/FONT&gt; Feedback { &lt;FONT Color=#0000ff&gt;get&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;#region&lt;/FONT&gt; Specific feedback &lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FileReferenceFeedback&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; File;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FileReferenceFeedback(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; MessagePrefix, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; File)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;(&lt;br&gt;MessagePrefix&lt;br&gt;+ System.IO.&lt;FONT Color=#2b91af&gt;Path&lt;/FONT&gt;.GetFileName(File)&lt;br&gt;+ &lt;FONT Color=#a31515&gt;&amp;quot in &amp;quot&lt;/FONT&gt;&lt;br&gt;+ System.IO.&lt;FONT Color=#2b91af&gt;Path&lt;/FONT&gt;.GetDirectoryName(File))&lt;/div&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.File = File;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; FileReferenceFeedback(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; File)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotFile: &amp;quot&lt;/FONT&gt;, File)&lt;/div&gt;{&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; CanShowExtraInfo&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowExtraInfo(&lt;FONT Color=#2b91af&gt;IWin32Window&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;System.Diagnostics.&lt;FONT Color=#2b91af&gt;Process&lt;/FONT&gt;.Start(&lt;FONT Color=#a31515&gt;&amp;quotExplorer&amp;quot&lt;/FONT&gt;, &lt;FONT Color=#a31515&gt;&amp;quot/select,&amp;quot&lt;/FONT&gt; + File);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ExceptionFeedback&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;Feedback&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; Exception;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ExceptionFeedback(&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Exception = ex;&lt;br&gt;FeedbackLevel = &lt;FONT Color=#2b91af&gt;FeedBackLevel&lt;/FONT&gt;.Exception;&lt;br&gt;System.Diagnostics.&lt;FONT Color=#2b91af&gt;StackTrace&lt;/FONT&gt; stack = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Diagnostics.&lt;FONT Color=#2b91af&gt;StackTrace&lt;/FONT&gt;(ex);&lt;br&gt;Message = &lt;FONT Color=#a31515&gt;&amp;quotError '&amp;quot&lt;/FONT&gt; + ex.Message + &lt;FONT Color=#a31515&gt;&amp;quot' occured on &amp;quot&lt;/FONT&gt; + stack.GetFrame(0);&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; CanShowExtraInfo&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ShowExtraInfo(&lt;FONT Color=#2b91af&gt;IWin32Window&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;DefaultShowExceptionMethod(Exception);&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;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ErrorPainter&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;FeedbackItemPainter&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; ErrorPainter(&lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt; inf)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;(inf)&lt;/div&gt;{&lt;br&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; DrawMessage(&lt;FONT Color=#2b91af&gt;Rectangle&lt;/FONT&gt; r, &lt;FONT Color=#2b91af&gt;Brush&lt;/FONT&gt; b)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;Rectangle&lt;/FONT&gt; ri = r;&lt;br&gt;ri.Width = ri.Height;&lt;br&gt;Graphics.DrawIcon(&lt;FONT Color=#2b91af&gt;SystemIcons&lt;/FONT&gt;.Error, ri);&lt;br&gt;r.X = ri.Right;&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.DrawMessage(r,Info.IsSelected ? &lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.Orange : &lt;FONT Color=#2b91af&gt;Brushes&lt;/FONT&gt;.Red);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;FeedbackItemPainter&lt;/FONT&gt; GetPainter(&lt;FONT Color=#2b91af&gt;FeedbackItemInfo&lt;/FONT&gt; info)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ErrorPainter&lt;/FONT&gt;(info);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; AppendExtraInfo(&lt;FONT Color=#2b91af&gt;AppendInfoSettings&lt;/FONT&gt; info)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;(Exception).AppendMessage(info.StringBuilder);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;}&lt;br&gt;&lt;/DIV&gt;&lt;DIV Style=" Display='none'; BackGround-Color=#dcdcdc;" OnDblClick="var o = parentNode.firstChild;o.sel =1;o.click()"&gt;&lt;b&gt; . . .&lt;/b&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;


&lt;BR&gt;&lt;B&gt;Also needed:&lt;/B&gt; (this is used to show complete exception information in HTML, you could also strip the exception adding functionality, but I use this class a lot to quickly debug and get better stacktraces than the default .net block of code. &lt;!-- --Start of code block
--&gt;
&lt;DIV onkeydown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;amp;&amp;amp; i&lt;ch.selcount){ch.sel=i;ch.click();}" style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'" onclick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'200pt':null;if(i==1&amp;amp;&amp;amp; ch.offsetHeight&gt;h)ch.style.height=h;" selcount="3" selold="1" sel="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=0&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Hide&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bolder; MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=1&gt;&lt;INPUT onclick=this.blur(); type=radio CHECKED&gt;Scroll&lt;/SPAN&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=2&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 200pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt; System;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Linq;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Text;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Reflection;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Diagnostics;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Data.SqlClient;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.IO;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;namespace&lt;/FONT&gt; Subro.Exceptions&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The original Exception where this info object is based on&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ExceptionInfo(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.Exception = ex;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//get stack trace information&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;StackTrace&lt;/FONT&gt; st = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StackTrace&lt;/FONT&gt;(Exception, &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;);&lt;BR&gt;frames = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;[st.FrameCount];&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; frames.Length; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;frames[i] = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;(st.GetFrame(i));&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (usercodeindex == -1 &amp;amp;&amp;amp; frames[i].IsUserCode)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;usercodeindex = i;&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//determine total exception count&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;while&lt;/FONT&gt; (ex != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;exceptioncount++;&lt;BR&gt;ex = ex.InnerException;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; General properties&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The date/time of the exception. This is not the time the exception&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; was thrown, but rather when the ExceptionInfo object was created.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; For most debugging purposes that difference in time does not matter, but&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; when the exact time is required, do not rely on this value!&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt; DateTime = &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;.Now;&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;ErrorFrame&lt;/FONT&gt;[] frames;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gets the different StackFrames that led to this&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;[] Frames&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; frames; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; FrameCount&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; frames.Length; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;int&lt;/FONT&gt; usercodeindex = -1;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Returns the index of the first frame that occured in user code (and thus&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; the first frame that is actually debuggable ;-) )&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; UserFrameIndex&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; usercodeindex; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Information about the last step before this error occured. The returned&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; object contains information about that step, such as the method that was running.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; When running in debug, the pdb files also provide info on the original code filename and line number&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; LastFrame&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (frames.Length &amp;gt; 0) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; frames[0];&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Where &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="LastFrame"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the last step in general, this property&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the last step in non-system code&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;seealso cref="UserFrameIndex"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; LastUserFrame&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (usercodeindex == -1) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; frames[usercodeindex];&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The exception type&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Type&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Exception.GetType().Name; }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; Mail NB: framework specific&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This mail section was created in .net 2.0, you might&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; want to remove this part or alter it if using earlier versions&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Sends an email to the specified address&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="To"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Send(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; To)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; m = GetExceptionMail();&lt;BR&gt;m.To.Add(To);&lt;BR&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;SmtpClient&lt;/FONT&gt; client = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;SmtpClient&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"mail"&lt;/FONT&gt;);&lt;BR&gt;client.Send(m);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Send the exception info (in html format) to the addressee.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; NB, some presumtions were made when trying to create a quick and &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; dirty send method. Safest way it to use &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="FillMailMessage"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; or &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="GetExceptionMail"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; and do the sending manually&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ex"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="To"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Send(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; To)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;GetInfo(ex).Send(To);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gets a mailmessage instance containing the Exception info.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The from address is tried to be set to a custom address. If this&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; fails (or if you want to set a custom one), you'll have to set the From&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; address manually.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;returns&amp;gt;&lt;/RETURNS&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; GetExceptionMail(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; GetInfo(ex).GetExceptionMail();&lt;/DIV&gt;}&lt;BR&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; GetExceptionMail()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; m = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt;();&lt;BR&gt;FillMailMessage(m);&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;m.From = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;MailAddress&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"Exceptions@"&lt;/FONT&gt; + &lt;FONT color=#2b91af&gt;Environment&lt;/FONT&gt;.UserDomainName);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; { }&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; m;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Sets the body of the message to hold the exeption info&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="m"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; FillMailMessage(System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; m)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;m.IsBodyHtml = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;BR&gt;m.Body = GetTotalMessage();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; ExtraInfo NB&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This class can hold extra info for an &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ExceptionInfo"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Its main purpose is to output this extra info to the html text&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;abstract&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; With this method, the extra info writes itself (in html format) to&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; the stringbuilder&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="sb"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;abstract&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei);&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; text)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt;(text);&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ValuesInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;&amp;gt; values = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;&amp;gt;();&lt;FONT color=#0000ff&gt;&lt;BR&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name, Text;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Header;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddText(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; text)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AddValue(&lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;, text);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddValue(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ValueEntry&lt;/FONT&gt; v = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;();&lt;BR&gt;v.Name = Name;&lt;BR&gt;v.Text = Value;&lt;BR&gt;values.Add(v);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.openBlock(1, 1);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (Header != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;"&lt;/FONT&gt;).Append(Header).Append(&lt;FONT color=#a31515&gt;":&lt;/B&gt;&lt;/I&gt;"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (values.Count &amp;gt; 0)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.openBlock(1, 1);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt; ve &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; values)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (ve.Name == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(ve.Text);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.appendInfo(ve.Name, ve.Text);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;BR&gt;ei.closeBlock();&lt;/DIV&gt;}&lt;BR&gt;ei.closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Adds plain text as extrainfo&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Text;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; TextInfo(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; text) { Text = text; }&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(Text);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; SQL extra info&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Used to display the history of sql strings.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SQlStringInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt; list = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt;();&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Add(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; sql)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;list.Add(sql);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddRange(&lt;FONT color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt; values)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;list.AddRange(values);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.openBlock(1);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;Recent sql strings:&lt;/B&gt;"&lt;/FONT&gt;);&lt;BR&gt;ei.openBlock(&lt;FONT color=#a31515&gt;"border:'gray 1 solid';margin-left:15"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; i = 0;&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; sql &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; list)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;SPAN&amp;gt;&amp;lt;B&amp;gt;--"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(i++ + 1)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"--&lt;/B&gt;&amp;lt;span style='margin-left:10'&amp;gt;"&lt;/FONT&gt;)&lt;BR&gt;.Append(sql)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;BR&gt;ei.closeBlock();&lt;BR&gt;ei.closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Add one or more sql strings to the list to be displayed in the recent&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; sql list.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This is usefull when you keep a list of recent executed sql strings somewhere&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; and want to include them in the exception output&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="SQL"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddSQL(&lt;FONT color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt; SQL)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (sqls == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sqls = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SQlStringInfo&lt;/FONT&gt;();&lt;BR&gt;AddExtraInfo(sqls);&lt;/DIV&gt;}&lt;BR&gt;sqls.AddRange(SQL);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;SQlStringInfo&lt;/FONT&gt; sqls;&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Add &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ExtraInfo"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;. You can also use a string as parameter&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ei"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddExtraInfo(&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt; ei)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (extrainfo == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) extrainfo = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&amp;gt;();&lt;BR&gt;extrainfo.Add(ei);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&amp;gt; extrainfo;&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the amount of &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ExtraInfo"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; objects added&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; ExtraInfoCount&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (extrainfo == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; 0;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; extrainfo.Count;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; HTML&lt;FONT color=#0000ff&gt;&lt;BR&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; ExtraInfoAnchor = &lt;FONT color=#a31515&gt;"ExtraInfo"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendExtraInfo()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (extrainfo != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendBR();&lt;BR&gt;appendHR();&lt;BR&gt;openBlock(2);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;&amp;lt;A name='"&lt;/FONT&gt;).Append(ExtraInfoAnchor)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(&lt;FONT color=#a31515&gt;"'&amp;gt;Extra Info&lt;/A&gt;&lt;/B&gt;&amp;lt;BR&amp;gt;&amp;lt;HR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;openBlock(&lt;FONT color=#a31515&gt;"margin-left:10;font-size:smaller"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt; ei &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; extrainfo)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.AppendHTML(sb, &lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; Static&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Rather than creating a new instance manually, use&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; this method to choose the proper exception object&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ex"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;returns&amp;gt;&lt;/RETURNS&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; GetInfo(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (ex == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ex &lt;FONT color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlExceptionInfo&lt;/FONT&gt;(ex &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ex &lt;FONT color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadExceptionInfo&lt;/FONT&gt;(ex &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;(ex);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; GetInfo(ex);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; Inner Exceptions&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; exceptioncount;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the total number of exceptions (Main Exception + all inner exceptions)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; ExceptionCount&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; exceptioncount; }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; html information&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; BEWARE: this code is manufactured to quickly create the html information &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; and is not nicely constructed for reusability.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; A bit more friendly code for html is used in the AutoFormatter (http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx) ,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; but did not use that here to keep the code portable for fresh applications&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gets information about this exception and all inner exceptions in HTML format&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;returns&amp;gt;&lt;/RETURNS&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetTotalMessage()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; AppendMessage(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt;()).ToString();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This stringbuilder is only used in the html functions&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Border)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(Border, 0);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Border, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Indent)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#a31515&gt;"Border='"&lt;/FONT&gt; + Border + &lt;FONT color=#a31515&gt;"px black solid'"&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;+ (Indent &amp;gt; 0 ? &lt;FONT color=#a31515&gt;"margin-left="&lt;/FONT&gt; + (Indent * 20) : &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Style)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openclose(&lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;, Style);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; closeBlock()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openclose(&lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;void&lt;/FONT&gt; openclose(&lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; close, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Style)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (close) sb.Append(&lt;FONT color=#a31515&gt;"/"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"DIV"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (Style != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;" Style=\""&lt;/FONT&gt;).Append(Style).Append(&lt;FONT color=#a31515&gt;"\""&lt;/FONT&gt;);&lt;/DIV&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendMessage(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; builder)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb = builder;&lt;BR&gt;openBlock(2);&lt;BR&gt;appendTop();&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Exception info created on"&lt;/FONT&gt;, DateTime.ToString());&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Application"&lt;/FONT&gt;, &lt;FONT color=#2b91af&gt;AppDomain&lt;/FONT&gt;.CurrentDomain.FriendlyName);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"font-size:smaller;margin-left:20"&lt;/FONT&gt;);&lt;BR&gt;appendHeaderBottom();&lt;BR&gt;closeBlock();&lt;FONT color=#2b91af&gt;&lt;BR&gt;Exception&lt;/FONT&gt; ex = Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; depth = 0;&lt;FONT color=#0000ff&gt;&lt;BR&gt;while&lt;/FONT&gt; (append(ex, depth++)) { ex = ex.InnerException; }&lt;BR&gt;appendExtraInfo();&lt;BR&gt;appendBottom();&lt;BR&gt;closeBlock();&lt;BR&gt;sb = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; builder;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; appendMessage()&lt;BR&gt;{&lt;BR&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;.AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.sb = sb;&lt;BR&gt;openBlock(2, 1);&lt;BR&gt;appendTitle(&lt;FONT color=#a31515&gt;"Exception Info"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AppendMessage(sb);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"Error obtaining exception info: "&lt;/FONT&gt; + ex.Message);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html text at the top&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of the info block, inside the main border&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendTop()&lt;BR&gt;{&lt;BR&gt;}&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html inside the header&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of the info block.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The base functionality adds links to the main and inner exceptions (if there are any)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendHeaderBottom()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (exceptioncount &amp;gt; 1)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; exceptioncount; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openHeaderLink(AnchorNamePrefix + i);&lt;BR&gt;AppendExceptionTitle(i);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&lt;/A&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (extrainfo != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openHeaderLink(ExtraInfoAnchor);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"Extra Info&lt;/A&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html inside the header&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of the Exception info block.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendExceptionHeader()&lt;BR&gt;{&lt;BR&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Used to add links in the header&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="href"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="name"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openHeaderLink(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; href)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;A style='margin-left:15' href='#"&lt;/FONT&gt;).Append(href)
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Append(&lt;FONT color=#a31515&gt;"'&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html text at the&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; end of the exception info, but before the main block is closed&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendBottom()&lt;BR&gt;{&lt;BR&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The prefix of the name that is added per depth so that code can&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; point directly to one of the inner exceptions&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The Name for the first exception is ExDepth0 , the second ExDepth1 and so forth.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Pointing to it in a href is subseqeuntly done with href = "#ExDepthX" where X is the inner exception index&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; AnchorNamePrefix = &lt;FONT color=#a31515&gt;"ExDepth"&lt;/FONT&gt;;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; AppendExceptionTitle(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; depth)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (depth == 0)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"Main Exception"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"Inner Exception ["&lt;/FONT&gt;).Append(depth).Append(&lt;FONT color=#a31515&gt;"]"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;bool&lt;/FONT&gt; append(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; depth)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (ex == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;;&lt;BR&gt;appendHR();&lt;FONT color=#008000&gt;&lt;BR&gt;//add anchor information&lt;/FONT&gt;&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;A NAME=\""&lt;/FONT&gt;).Append(AnchorNamePrefix).Append(depth)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(&lt;FONT color=#a31515&gt;"\" style='font-size:smaller'&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;AppendExceptionTitle(depth);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;": &lt;/A&gt;&amp;lt;span style='background-color:#990000;color:white;font-weight:bolder;width:100%'&amp;gt;"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(ex.Message)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;openBlock(1, 1);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (depth &amp;gt; 0)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ExceptionInfo&lt;/FONT&gt; ei = GetInfo(ex);&lt;BR&gt;ei.sb = sb;&lt;BR&gt;ei.appendHeader();&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.appendExtraInfo();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex2)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"Error writing extra info: "&lt;/FONT&gt; + ex2.Message);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendHeader();&lt;/DIV&gt;closeBlock();&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;usercodecolor = &lt;FONT color=#a31515&gt;"lightblue"&lt;/FONT&gt;,&lt;BR&gt;systemcodecolor = &lt;FONT color=#a31515&gt;"beige"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;void&lt;/FONT&gt; appendHeader()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#a31515&gt;"border:'1 green solid';"&lt;/FONT&gt;);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Type"&lt;/FONT&gt;, Type);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (usercodeindex &amp;gt;= 0)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ErrorFrame&lt;/FONT&gt; ef = LastUserFrame;&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Last user code"&lt;/FONT&gt;, ef.FullMethodSignature + &lt;FONT color=#a31515&gt;" (Line "&lt;/FONT&gt; + ef.Line + &lt;FONT color=#a31515&gt;" in '"&lt;/FONT&gt; + ef.FileName + &lt;FONT color=#a31515&gt;"')"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;appendExceptionHeader();&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (frames.Length &amp;gt; 0)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"Stack"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;span style='margin-left:20;font-size:smaller'&amp;gt;Legend: "&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; 2; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;span style=\"background-color:"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(i == 0 ? systemcodecolor : usercodecolor)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"border='1 black solid';margin-left:15\"&amp;gt;"&lt;/FONT&gt;)&lt;BR&gt;.Append(i == 0 ? &lt;FONT color=#a31515&gt;"No debug information"&lt;/FONT&gt; : &lt;FONT color=#a31515&gt;"With debug information"&lt;/FONT&gt;)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"margin-left:40;font-size:smaller"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; ef &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; frames)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendStack(ef);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"--No StackTrace available--"&lt;/FONT&gt;);&lt;/DIV&gt;closeBlock();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendTitle(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;"&lt;/FONT&gt;).Append(Name).Append(&lt;FONT color=#a31515&gt;"&lt;/B&gt;: "&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendInfo(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(Name);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;SPAN style='position:relative;left:20'&amp;gt;"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(Value).Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendHR()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;HR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendBR()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; appendStack(&lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; ef)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#a31515&gt;"border:'1 solid black';background-color:"&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;+ (ef.IsUserCode ? usercodecolor : systemcodecolor)&lt;BR&gt;);&lt;/DIV&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;span style='font-size:larger;font-style:italic;color:olive'&amp;gt;&amp;lt;U&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Method"&lt;/FONT&gt;, ef.MethodName);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&lt;/U&gt;&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"NameSpace"&lt;/FONT&gt;, ef.NameSpace);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Full Signature"&lt;/FONT&gt;, ef.MethodSignature);&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;if&lt;/FONT&gt; (ef.IsUserCode)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"File"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;A href='"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(ef.FileName).Append(&lt;FONT color=#a31515&gt;"'&amp;gt;"&lt;/FONT&gt;).Append(ef.FileName).Append(&lt;FONT color=#a31515&gt;"&lt;/A&gt;"&lt;/FONT&gt;)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;appendInfo(&lt;FONT color=#a31515&gt;"Line"&lt;/FONT&gt;, ef.Line.ToString());&lt;BR&gt;appendTitle(&lt;FONT color=#a31515&gt;"Code snippet"&lt;/FONT&gt;);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"border='1 black dotted';margin-left=25"&lt;/FONT&gt;);&lt;BR&gt;ef.AppendCode(sb, CodeSnippetExtraLines);&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Only applies when getting html text. This is the number of lines on&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; each side of the offending line, that should be included in code snippets&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; CodeSnippetExtraLines = 3;&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; Exception.ToString();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; IO&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Shows the exception in html format by outputting to a default file first&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; and then opening it with the default browser.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; (a form could have been used to do this, but tried to keep this info&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; class usable for Console applications as well)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowException()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ShowExceptionFile(&lt;FONT color=#a31515&gt;"default"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Shows the exception in a browser, see &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ShowException()"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; for more info&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ex"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowException(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;GetInfo(ex).ShowException();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; First outputs the file (see &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="CreateExceptionFile"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;), then opens&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; it with the default connected viewer.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; NB: the file is NOT appended. Existing info will be overwritten&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; NB2: if no writing is necessary&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowExceptionFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ShowExceptionFile(file, &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Same as &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ShowExceptionFile(string)"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;, but with the option&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; to choose whether to append or not&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="append"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowExceptionFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; append)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;CreateExceptionFile(file, append);&lt;BR&gt;ShowFile(file);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; All this does is run the file (using System.Diagnostics.Process.Start)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; If an exception file is to be shown, make sure it is created first, or&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; use &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ShowExceptionFile"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; to create and show the file instead&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of this method&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;CheckFile(&lt;FONT color=#0000ff&gt;ref&lt;/FONT&gt; file);&lt;FONT color=#2b91af&gt;&lt;BR&gt;Process&lt;/FONT&gt;.Start(file);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Appends complete directory information to a name (see code for details ;-) )&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; CheckFile(&lt;FONT color=#0000ff&gt;ref&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;FileInfo&lt;/FONT&gt; fi = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;FileInfo&lt;/FONT&gt;(file);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (fi.FullName.Length &amp;gt; file.Length)&lt;BR&gt;{&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;//no directory provided -&amp;gt; use application directory&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; dir =&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Environment&lt;/FONT&gt;.GetFolderPath(&lt;FONT color=#2b91af&gt;Environment&lt;/FONT&gt;.&lt;FONT color=#2b91af&gt;SpecialFolder&lt;/FONT&gt;.ApplicationData)&lt;BR&gt;+ &lt;FONT color=#a31515&gt;"\\Exceptions"&lt;/FONT&gt;&lt;BR&gt;+ &lt;FONT color=#a31515&gt;"\\"&lt;/FONT&gt; + &lt;FONT color=#2b91af&gt;AppDomain&lt;/FONT&gt;.CurrentDomain.FriendlyName&lt;BR&gt;+ &lt;FONT color=#a31515&gt;"\\"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (!&lt;FONT color=#2b91af&gt;Directory&lt;/FONT&gt;.Exists(dir))&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Directory&lt;/FONT&gt;.CreateDirectory(dir);&lt;/DIV&gt;file = dir + file;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (fi.Extension.Length == 0) file += &lt;FONT color=#a31515&gt;".htm"&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Outputs the exception to the specified file. Make sure the extension can&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; be read by explorer. If no extension is provided, ".htm" is used&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="append"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; CreateExceptionFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; append)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;CheckFile(&lt;FONT color=#0000ff&gt;ref&lt;/FONT&gt; file);&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;StreamWriter&lt;/FONT&gt; sw = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;StreamWriter&lt;/FONT&gt;(file, append, System.Text.&lt;FONT color=#2b91af&gt;Encoding&lt;/FONT&gt;.ASCII))&lt;BR&gt;sw.Write(GetTotalMessage());&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlExceptionInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt; Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; SqlExceptionInfo(&lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt; ex)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;(ex)&lt;/DIV&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Exception = ex;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; HTML&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; AnchorSQL = &lt;FONT color=#a31515&gt;"sqlinfo"&lt;/FONT&gt;;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendExceptionHeader()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;base&lt;/FONT&gt;.appendTop();&lt;BR&gt;appendTitle(&lt;FONT color=#a31515&gt;"SQL Errors ("&lt;/FONT&gt; + Exception.Errors.Count + &lt;FONT color=#a31515&gt;")"&lt;/FONT&gt;);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"border:'1 gray solid';font-size:0.6em;margin-left:40;margin-right:20"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; Exception.Errors.Count; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendSQLError(i);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendHeaderBottom()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;base&lt;/FONT&gt;.appendHeaderBottom();&lt;BR&gt;openHeaderLink(AnchorSQL);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"SQL info"&lt;/FONT&gt;).Append(&lt;FONT color=#a31515&gt;"&lt;/A&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; appendSQLError(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (index &amp;gt; 0) appendHR();&lt;FONT color=#2b91af&gt;&lt;BR&gt;SqlError&lt;/FONT&gt; se = Exception.Errors[index];&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"SQL class (severity)"&lt;/FONT&gt;, se.Class.ToString());&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Server"&lt;/FONT&gt;, se.Server);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"T-sql line number:"&lt;/FONT&gt;, se.LineNumber.ToString());&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Message"&lt;/FONT&gt;, se.Message);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Procedure"&lt;/FONT&gt;, se.Procedure);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Source"&lt;/FONT&gt;, se.Source);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Sql error number"&lt;/FONT&gt;, se.Number.ToString());&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#endregion&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadExceptionInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt; ReflectionTypeLoadException;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ReflectionTypeLoadExceptionInfo(&lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt; Exception)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;(Exception)&lt;/DIV&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.ReflectionTypeLoadException = Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; ReflectionTypeLoadException.LoaderExceptions)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AddExtraInfo(GetInfo(e));&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AddExtraInfo(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"Error obtaining exception info: "&lt;/FONT&gt; + ex.Message));&lt;BR&gt;AddExtraInfo(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt;(e.Message));&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Wrapper around a &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="StackFrame"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;. Not that much added functionality, but&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; some properties instead of methods to be able to use easy databinding&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StackFrame&lt;/FONT&gt; Base;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ErrorFrame(&lt;FONT color=#2b91af&gt;StackFrame&lt;/FONT&gt; frame)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Base = frame;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Line&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetFileLineNumber(); }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; FileName&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetFileName(); }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; MethodName&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetMethod().Name; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; MethodSignature&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetMethod().ToString(); }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; FullMethodSignature&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; NameSpace + &lt;FONT color=#a31515&gt;" - "&lt;/FONT&gt; + MethodSignature; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; NameSpace&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetMethod().ReflectedType.FullName; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; IsUserCode&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Line &amp;gt; 0; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;MethodBase&lt;/FONT&gt; GetMethod()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; Base.GetMethod();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetCode()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; GetCode(2);&lt;/DIV&gt;}&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="Lines"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;indicates the amount of lines before and after the Errorline to show &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetCode(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Lines)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (!IsUserCode)&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#a31515&gt;"No code available for a system method"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;string&lt;/FONT&gt; file = FileName;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (file == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt; || !&lt;FONT color=#2b91af&gt;File&lt;/FONT&gt;.Exists(file))&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#a31515&gt;"File not found!"&lt;/FONT&gt;;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;try&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; AppendCode(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt;(), Lines).ToString();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#a31515&gt;"Error obtaining code information: "&lt;/FONT&gt; + ex.Message;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;internal&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendCode(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Lines)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;int&lt;/FONT&gt; line = Line, from = line - Lines, to = line + Lines, curline = 0; ;&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; len = sb.Length;&lt;FONT color=#0000ff&gt;&lt;BR&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; space = &lt;FONT color=#a31515&gt;"&amp;amp;nbsp;"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; tab = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; tabcount = 0; tabcount &amp;lt; 4; tabcount++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;tab += space;&lt;/DIV&gt;}&lt;FONT color=#2b91af&gt;&lt;BR&gt;StreamReader&lt;/FONT&gt; sr = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sr = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StreamReader&lt;/FONT&gt;(FileName);&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; l;&lt;FONT color=#0000ff&gt;&lt;BR&gt;while&lt;/FONT&gt; ((l = sr.ReadLine()) != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (++curline &amp;gt;= from)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (curline &amp;gt; to) &lt;FONT color=#0000ff&gt;break&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (line == curline) sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(l.Replace(&lt;FONT color=#a31515&gt;"\t"&lt;/FONT&gt;, tab).Replace(&lt;FONT color=#a31515&gt;" "&lt;/FONT&gt;, space));&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (line == curline) sb.Append(&lt;FONT color=#a31515&gt;"&lt;/B&gt;"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Length = len;&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"Error obtaining code information: "&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(ex.Message);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;finally&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (sr != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) sr.Close();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; sb;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;interface&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Linq;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Text;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Reflection;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Diagnostics;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Data.SqlClient;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.IO;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;namespace&lt;/FONT&gt; Subro.Exceptions&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The original Exception where this info object is based on&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ExceptionInfo(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.Exception = ex;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//get stack trace information&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;StackTrace&lt;/FONT&gt; st = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StackTrace&lt;/FONT&gt;(Exception, &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;);&lt;BR&gt;frames = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;[st.FrameCount];&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; frames.Length; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;frames[i] = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;(st.GetFrame(i));&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (usercodeindex == -1 &amp;amp;&amp;amp; frames[i].IsUserCode)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;usercodeindex = i;&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//determine total exception count&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;while&lt;/FONT&gt; (ex != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;exceptioncount++;&lt;BR&gt;ex = ex.InnerException;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; General properties&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The date/time of the exception. This is not the time the exception&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; was thrown, but rather when the ExceptionInfo object was created.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; For most debugging purposes that difference in time does not matter, but&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; when the exact time is required, do not rely on this value!&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt; DateTime = &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;.Now;&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;ErrorFrame&lt;/FONT&gt;[] frames;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gets the different StackFrames that led to this&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;[] Frames&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; frames; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; FrameCount&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; frames.Length; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;int&lt;/FONT&gt; usercodeindex = -1;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Returns the index of the first frame that occured in user code (and thus&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; the first frame that is actually debuggable ;-) )&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; UserFrameIndex&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; usercodeindex; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Information about the last step before this error occured. The returned&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; object contains information about that step, such as the method that was running.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; When running in debug, the pdb files also provide info on the original code filename and line number&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; LastFrame&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (frames.Length &amp;gt; 0) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; frames[0];&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Where &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="LastFrame"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the last step in general, this property&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the last step in non-system code&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;seealso cref="UserFrameIndex"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; LastUserFrame&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (usercodeindex == -1) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; frames[usercodeindex];&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The exception type&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Type&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Exception.GetType().Name; }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; Mail NB: framework specific&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This mail section was created in .net 2.0, you might&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; want to remove this part or alter it if using earlier versions&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Sends an email to the specified address&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="To"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Send(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; To)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; m = GetExceptionMail();&lt;BR&gt;m.To.Add(To);&lt;BR&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;SmtpClient&lt;/FONT&gt; client = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;SmtpClient&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"mail"&lt;/FONT&gt;);&lt;BR&gt;client.Send(m);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Send the exception info (in html format) to the addressee.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; NB, some presumtions were made when trying to create a quick and &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; dirty send method. Safest way it to use &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="FillMailMessage"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; or &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="GetExceptionMail"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; and do the sending manually&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ex"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="To"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Send(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; To)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;GetInfo(ex).Send(To);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gets a mailmessage instance containing the Exception info.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The from address is tried to be set to a custom address. If this&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; fails (or if you want to set a custom one), you'll have to set the From&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; address manually.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;returns&amp;gt;&lt;/RETURNS&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; GetExceptionMail(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; GetInfo(ex).GetExceptionMail();&lt;/DIV&gt;}&lt;BR&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; GetExceptionMail()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; m = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt;();&lt;BR&gt;FillMailMessage(m);&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;m.From = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; System.Net.Mail.&lt;FONT color=#2b91af&gt;MailAddress&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"Exceptions@"&lt;/FONT&gt; + &lt;FONT color=#2b91af&gt;Environment&lt;/FONT&gt;.UserDomainName);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; { }&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; m;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Sets the body of the message to hold the exeption info&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="m"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; FillMailMessage(System.Net.Mail.&lt;FONT color=#2b91af&gt;MailMessage&lt;/FONT&gt; m)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;m.IsBodyHtml = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;BR&gt;m.Body = GetTotalMessage();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; ExtraInfo NB&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This class can hold extra info for an &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ExceptionInfo"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Its main purpose is to output this extra info to the html text&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;abstract&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; With this method, the extra info writes itself (in html format) to&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; the stringbuilder&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="sb"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;abstract&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei);&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; text)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt;(text);&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ValuesInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;&amp;gt; values = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;&amp;gt;();&lt;FONT color=#0000ff&gt;&lt;BR&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name, Text;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Header;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddText(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; text)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AddValue(&lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;, text);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddValue(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ValueEntry&lt;/FONT&gt; v = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt;();&lt;BR&gt;v.Name = Name;&lt;BR&gt;v.Text = Value;&lt;BR&gt;values.Add(v);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.openBlock(1, 1);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (Header != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;"&lt;/FONT&gt;).Append(Header).Append(&lt;FONT color=#a31515&gt;":&lt;/B&gt;&lt;/I&gt;"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (values.Count &amp;gt; 0)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.openBlock(1, 1);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ValueEntry&lt;/FONT&gt; ve &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; values)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (ve.Name == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(ve.Text);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.appendInfo(ve.Name, ve.Text);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;BR&gt;ei.closeBlock();&lt;/DIV&gt;}&lt;BR&gt;ei.closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Adds plain text as extrainfo&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Text;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; TextInfo(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; text) { Text = text; }&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(Text);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; SQL extra info&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Used to display the history of sql strings.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SQlStringInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt; list = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt;();&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Add(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; sql)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;list.Add(sql);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddRange(&lt;FONT color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt; values)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;list.AddRange(values);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.openBlock(1);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;Recent sql strings:&lt;/B&gt;"&lt;/FONT&gt;);&lt;BR&gt;ei.openBlock(&lt;FONT color=#a31515&gt;"border:'gray 1 solid';margin-left:15"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; i = 0;&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; sql &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; list)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;SPAN&amp;gt;&amp;lt;B&amp;gt;--"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(i++ + 1)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"--&lt;/B&gt;&amp;lt;span style='margin-left:10'&amp;gt;"&lt;/FONT&gt;)&lt;BR&gt;.Append(sql)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;BR&gt;ei.closeBlock();&lt;BR&gt;ei.closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Add one or more sql strings to the list to be displayed in the recent&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; sql list.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This is usefull when you keep a list of recent executed sql strings somewhere&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; and want to include them in the exception output&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="SQL"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddSQL(&lt;FONT color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt; SQL)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (sqls == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sqls = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SQlStringInfo&lt;/FONT&gt;();&lt;BR&gt;AddExtraInfo(sqls);&lt;/DIV&gt;}&lt;BR&gt;sqls.AddRange(SQL);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;SQlStringInfo&lt;/FONT&gt; sqls;&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Add &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ExtraInfo"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;. You can also use a string as parameter&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ei"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; AddExtraInfo(&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt; ei)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (extrainfo == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) extrainfo = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&amp;gt;();&lt;BR&gt;extrainfo.Add(ei);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&amp;gt; extrainfo;&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the amount of &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ExtraInfo"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; objects added&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; ExtraInfoCount&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (extrainfo == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; 0;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; extrainfo.Count;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; HTML&lt;FONT color=#0000ff&gt;&lt;BR&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; ExtraInfoAnchor = &lt;FONT color=#a31515&gt;"ExtraInfo"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendExtraInfo()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (extrainfo != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendBR();&lt;BR&gt;appendHR();&lt;BR&gt;openBlock(2);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;&amp;lt;A name='"&lt;/FONT&gt;).Append(ExtraInfoAnchor)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(&lt;FONT color=#a31515&gt;"'&amp;gt;Extra Info&lt;/A&gt;&lt;/B&gt;&amp;lt;BR&amp;gt;&amp;lt;HR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;openBlock(&lt;FONT color=#a31515&gt;"margin-left:10;font-size:smaller"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt; ei &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; extrainfo)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.AppendHTML(sb, &lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; Static&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Rather than creating a new instance manually, use&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; this method to choose the proper exception object&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ex"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;returns&amp;gt;&lt;/RETURNS&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; GetInfo(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (ex == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ex &lt;FONT color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlExceptionInfo&lt;/FONT&gt;(ex &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ex &lt;FONT color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadExceptionInfo&lt;/FONT&gt;(ex &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;(ex);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; GetInfo(ex);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; Inner Exceptions&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; exceptioncount;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; returns the total number of exceptions (Main Exception + all inner exceptions)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; ExceptionCount&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; exceptioncount; }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; html information&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; BEWARE: this code is manufactured to quickly create the html information &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; and is not nicely constructed for reusability.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; A bit more friendly code for html is used in the AutoFormatter (http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx) ,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; but did not use that here to keep the code portable for fresh applications&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gets information about this exception and all inner exceptions in HTML format&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;returns&amp;gt;&lt;/RETURNS&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetTotalMessage()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; AppendMessage(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt;()).ToString();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; This stringbuilder is only used in the html functions&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Border)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(Border, 0);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Border, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Indent)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#a31515&gt;"Border='"&lt;/FONT&gt; + Border + &lt;FONT color=#a31515&gt;"px black solid'"&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;+ (Indent &amp;gt; 0 ? &lt;FONT color=#a31515&gt;"margin-left="&lt;/FONT&gt; + (Indent * 20) : &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openBlock(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Style)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openclose(&lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;, Style);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; closeBlock()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openclose(&lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;void&lt;/FONT&gt; openclose(&lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; close, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Style)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (close) sb.Append(&lt;FONT color=#a31515&gt;"/"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"DIV"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (Style != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;" Style=\""&lt;/FONT&gt;).Append(Style).Append(&lt;FONT color=#a31515&gt;"\""&lt;/FONT&gt;);&lt;/DIV&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendMessage(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; builder)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb = builder;&lt;BR&gt;openBlock(2);&lt;BR&gt;appendTop();&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Exception info created on"&lt;/FONT&gt;, DateTime.ToString());&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Application"&lt;/FONT&gt;, &lt;FONT color=#2b91af&gt;AppDomain&lt;/FONT&gt;.CurrentDomain.FriendlyName);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"font-size:smaller;margin-left:20"&lt;/FONT&gt;);&lt;BR&gt;appendHeaderBottom();&lt;BR&gt;closeBlock();&lt;FONT color=#2b91af&gt;&lt;BR&gt;Exception&lt;/FONT&gt; ex = Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; depth = 0;&lt;FONT color=#0000ff&gt;&lt;BR&gt;while&lt;/FONT&gt; (append(ex, depth++)) { ex = ex.InnerException; }&lt;BR&gt;appendExtraInfo();&lt;BR&gt;appendBottom();&lt;BR&gt;closeBlock();&lt;BR&gt;sb = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; builder;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; appendMessage()&lt;BR&gt;{&lt;BR&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;.AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.sb = sb;&lt;BR&gt;openBlock(2, 1);&lt;BR&gt;appendTitle(&lt;FONT color=#a31515&gt;"Exception Info"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AppendMessage(sb);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"Error obtaining exception info: "&lt;/FONT&gt; + ex.Message);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html text at the top&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of the info block, inside the main border&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendTop()&lt;BR&gt;{&lt;BR&gt;}&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html inside the header&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of the info block.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The base functionality adds links to the main and inner exceptions (if there are any)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendHeaderBottom()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (exceptioncount &amp;gt; 1)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; exceptioncount; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openHeaderLink(AnchorNamePrefix + i);&lt;BR&gt;AppendExceptionTitle(i);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&lt;/A&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (extrainfo != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openHeaderLink(ExtraInfoAnchor);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"Extra Info&lt;/A&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html inside the header&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of the Exception info block.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendExceptionHeader()&lt;BR&gt;{&lt;BR&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Used to add links in the header&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="href"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="name"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; openHeaderLink(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; href)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;A style='margin-left:15' href='#"&lt;/FONT&gt;).Append(href)
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Append(&lt;FONT color=#a31515&gt;"'&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Gives inheriting classes the possibility to append html text at the&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; end of the exception info, but before the main block is closed&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendBottom()&lt;BR&gt;{&lt;BR&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The prefix of the name that is added per depth so that code can&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; point directly to one of the inner exceptions&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The Name for the first exception is ExDepth0 , the second ExDepth1 and so forth.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Pointing to it in a href is subseqeuntly done with href = "#ExDepthX" where X is the inner exception index&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; AnchorNamePrefix = &lt;FONT color=#a31515&gt;"ExDepth"&lt;/FONT&gt;;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; AppendExceptionTitle(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; depth)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (depth == 0)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"Main Exception"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"Inner Exception ["&lt;/FONT&gt;).Append(depth).Append(&lt;FONT color=#a31515&gt;"]"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;bool&lt;/FONT&gt; append(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; depth)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (ex == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;;&lt;BR&gt;appendHR();&lt;FONT color=#008000&gt;&lt;BR&gt;//add anchor information&lt;/FONT&gt;&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;A NAME=\""&lt;/FONT&gt;).Append(AnchorNamePrefix).Append(depth)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(&lt;FONT color=#a31515&gt;"\" style='font-size:smaller'&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;AppendExceptionTitle(depth);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;": &lt;/A&gt;&amp;lt;span style='background-color:#990000;color:white;font-weight:bolder;width:100%'&amp;gt;"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(ex.Message)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;openBlock(1, 1);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (depth &amp;gt; 0)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ExceptionInfo&lt;/FONT&gt; ei = GetInfo(ex);&lt;BR&gt;ei.sb = sb;&lt;BR&gt;ei.appendHeader();&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ei.appendExtraInfo();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex2)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"Error writing extra info: "&lt;/FONT&gt; + ex2.Message);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendHeader();&lt;/DIV&gt;closeBlock();&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;usercodecolor = &lt;FONT color=#a31515&gt;"lightblue"&lt;/FONT&gt;,&lt;BR&gt;systemcodecolor = &lt;FONT color=#a31515&gt;"beige"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;void&lt;/FONT&gt; appendHeader()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#a31515&gt;"border:'1 green solid';"&lt;/FONT&gt;);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Type"&lt;/FONT&gt;, Type);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (usercodeindex &amp;gt;= 0)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ErrorFrame&lt;/FONT&gt; ef = LastUserFrame;&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Last user code"&lt;/FONT&gt;, ef.FullMethodSignature + &lt;FONT color=#a31515&gt;" (Line "&lt;/FONT&gt; + ef.Line + &lt;FONT color=#a31515&gt;" in '"&lt;/FONT&gt; + ef.FileName + &lt;FONT color=#a31515&gt;"')"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;appendExceptionHeader();&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (frames.Length &amp;gt; 0)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"Stack"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;span style='margin-left:20;font-size:smaller'&amp;gt;Legend: "&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; 2; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;span style=\"background-color:"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(i == 0 ? systemcodecolor : usercodecolor)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"border='1 black solid';margin-left:15\"&amp;gt;"&lt;/FONT&gt;)&lt;BR&gt;.Append(i == 0 ? &lt;FONT color=#a31515&gt;"No debug information"&lt;/FONT&gt; : &lt;FONT color=#a31515&gt;"With debug information"&lt;/FONT&gt;)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"margin-left:40;font-size:smaller"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; ef &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; frames)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendStack(ef);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"--No StackTrace available--"&lt;/FONT&gt;);&lt;/DIV&gt;closeBlock();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendTitle(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;"&lt;/FONT&gt;).Append(Name).Append(&lt;FONT color=#a31515&gt;"&lt;/B&gt;: "&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendInfo(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(Name);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;SPAN style='position:relative;left:20'&amp;gt;"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(Value).Append(&lt;FONT color=#a31515&gt;"&lt;/SPAN&gt;&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendHR()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;HR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendBR()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; appendStack(&lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt; ef)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;openBlock(&lt;FONT color=#a31515&gt;"border:'1 solid black';background-color:"&lt;/FONT&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;+ (ef.IsUserCode ? usercodecolor : systemcodecolor)&lt;BR&gt;);&lt;/DIV&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;span style='font-size:larger;font-style:italic;color:olive'&amp;gt;&amp;lt;U&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Method"&lt;/FONT&gt;, ef.MethodName);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&lt;/U&gt;&lt;/SPAN&gt;"&lt;/FONT&gt;);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"NameSpace"&lt;/FONT&gt;, ef.NameSpace);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Full Signature"&lt;/FONT&gt;, ef.MethodSignature);&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;if&lt;/FONT&gt; (ef.IsUserCode)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendTitle(&lt;FONT color=#a31515&gt;"File"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;A href='"&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(ef.FileName).Append(&lt;FONT color=#a31515&gt;"'&amp;gt;"&lt;/FONT&gt;).Append(ef.FileName).Append(&lt;FONT color=#a31515&gt;"&lt;/A&gt;"&lt;/FONT&gt;)&lt;BR&gt;.Append(&lt;FONT color=#a31515&gt;"&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;appendInfo(&lt;FONT color=#a31515&gt;"Line"&lt;/FONT&gt;, ef.Line.ToString());&lt;BR&gt;appendTitle(&lt;FONT color=#a31515&gt;"Code snippet"&lt;/FONT&gt;);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"border='1 black dotted';margin-left=25"&lt;/FONT&gt;);&lt;BR&gt;ef.AppendCode(sb, CodeSnippetExtraLines);&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Only applies when getting html text. This is the number of lines on&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; each side of the offending line, that should be included in code snippets&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; CodeSnippetExtraLines = 3;&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; Exception.ToString();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; IO&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Shows the exception in html format by outputting to a default file first&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; and then opening it with the default browser.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; (a form could have been used to do this, but tried to keep this info&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; class usable for Console applications as well)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowException()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ShowExceptionFile(&lt;FONT color=#a31515&gt;"default"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Shows the exception in a browser, see &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ShowException()"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; for more info&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="ex"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowException(&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;GetInfo(ex).ShowException();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; First outputs the file (see &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="CreateExceptionFile"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;), then opens&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; it with the default connected viewer.&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; NB: the file is NOT appended. Existing info will be overwritten&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; NB2: if no writing is necessary&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowExceptionFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ShowExceptionFile(file, &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Same as &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ShowExceptionFile(string)"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;, but with the option&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; to choose whether to append or not&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="append"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowExceptionFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; append)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;CreateExceptionFile(file, append);&lt;BR&gt;ShowFile(file);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; All this does is run the file (using System.Diagnostics.Process.Start)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; If an exception file is to be shown, make sure it is created first, or&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; use &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="ShowExceptionFile"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt; to create and show the file instead&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; of this method&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; ShowFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;CheckFile(&lt;FONT color=#0000ff&gt;ref&lt;/FONT&gt; file);&lt;FONT color=#2b91af&gt;&lt;BR&gt;Process&lt;/FONT&gt;.Start(file);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Appends complete directory information to a name (see code for details ;-) )&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; CheckFile(&lt;FONT color=#0000ff&gt;ref&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;FileInfo&lt;/FONT&gt; fi = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;FileInfo&lt;/FONT&gt;(file);&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (fi.FullName.Length &amp;gt; file.Length)&lt;BR&gt;{&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;//no directory provided -&amp;gt; use application directory&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; dir =&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Environment&lt;/FONT&gt;.GetFolderPath(&lt;FONT color=#2b91af&gt;Environment&lt;/FONT&gt;.&lt;FONT color=#2b91af&gt;SpecialFolder&lt;/FONT&gt;.ApplicationData)&lt;BR&gt;+ &lt;FONT color=#a31515&gt;"\\Exceptions"&lt;/FONT&gt;&lt;BR&gt;+ &lt;FONT color=#a31515&gt;"\\"&lt;/FONT&gt; + &lt;FONT color=#2b91af&gt;AppDomain&lt;/FONT&gt;.CurrentDomain.FriendlyName&lt;BR&gt;+ &lt;FONT color=#a31515&gt;"\\"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (!&lt;FONT color=#2b91af&gt;Directory&lt;/FONT&gt;.Exists(dir))&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Directory&lt;/FONT&gt;.CreateDirectory(dir);&lt;/DIV&gt;file = dir + file;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (fi.Extension.Length == 0) file += &lt;FONT color=#a31515&gt;".htm"&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Outputs the exception to the specified file. Make sure the extension can&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; be read by explorer. If no extension is provided, ".htm" is used&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="file"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="append"&amp;gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; CreateExceptionFile(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; file, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; append)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;CheckFile(&lt;FONT color=#0000ff&gt;ref&lt;/FONT&gt; file);&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;StreamWriter&lt;/FONT&gt; sw = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;StreamWriter&lt;/FONT&gt;(file, append, System.Text.&lt;FONT color=#2b91af&gt;Encoding&lt;/FONT&gt;.ASCII))&lt;BR&gt;sw.Write(GetTotalMessage());&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;#endregion&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlExceptionInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt; Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; SqlExceptionInfo(&lt;FONT color=#2b91af&gt;SqlException&lt;/FONT&gt; ex)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;(ex)&lt;/DIV&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Exception = ex;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#region&lt;/FONT&gt; HTML&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; AnchorSQL = &lt;FONT color=#a31515&gt;"sqlinfo"&lt;/FONT&gt;;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendExceptionHeader()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;base&lt;/FONT&gt;.appendTop();&lt;BR&gt;appendTitle(&lt;FONT color=#a31515&gt;"SQL Errors ("&lt;/FONT&gt; + Exception.Errors.Count + &lt;FONT color=#a31515&gt;")"&lt;/FONT&gt;);&lt;BR&gt;openBlock(&lt;FONT color=#a31515&gt;"border:'1 gray solid';font-size:0.6em;margin-left:40;margin-right:20"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; Exception.Errors.Count; i++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;appendSQLError(i);&lt;/DIV&gt;}&lt;BR&gt;closeBlock();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; appendHeaderBottom()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;base&lt;/FONT&gt;.appendHeaderBottom();&lt;BR&gt;openHeaderLink(AnchorSQL);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"SQL info"&lt;/FONT&gt;).Append(&lt;FONT color=#a31515&gt;"&lt;/A&gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;void&lt;/FONT&gt; appendSQLError(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (index &amp;gt; 0) appendHR();&lt;FONT color=#2b91af&gt;&lt;BR&gt;SqlError&lt;/FONT&gt; se = Exception.Errors[index];&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"SQL class (severity)"&lt;/FONT&gt;, se.Class.ToString());&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Server"&lt;/FONT&gt;, se.Server);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"T-sql line number:"&lt;/FONT&gt;, se.LineNumber.ToString());&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Message"&lt;/FONT&gt;, se.Message);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Procedure"&lt;/FONT&gt;, se.Procedure);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Source"&lt;/FONT&gt;, se.Source);&lt;BR&gt;appendInfo(&lt;FONT color=#a31515&gt;"Sql error number"&lt;/FONT&gt;, se.Number.ToString());&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;#endregion&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadExceptionInfo&lt;/FONT&gt; : &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt; ReflectionTypeLoadException;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ReflectionTypeLoadExceptionInfo(&lt;FONT color=#2b91af&gt;ReflectionTypeLoadException&lt;/FONT&gt; Exception)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;: &lt;FONT color=#0000ff&gt;base&lt;/FONT&gt;(Exception)&lt;/DIV&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.ReflectionTypeLoadException = Exception;&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; ReflectionTypeLoadException.LoaderExceptions)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AddExtraInfo(GetInfo(e));&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;AddExtraInfo(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"Error obtaining exception info: "&lt;/FONT&gt; + ex.Message));&lt;BR&gt;AddExtraInfo(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;TextInfo&lt;/FONT&gt;(e.Message));&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Wrapper around a &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;see cref="StackFrame"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;. Not that much added functionality, but&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; some properties instead of methods to be able to use easy databinding&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ErrorFrame&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StackFrame&lt;/FONT&gt; Base;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ErrorFrame(&lt;FONT color=#2b91af&gt;StackFrame&lt;/FONT&gt; frame)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Base = frame;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Line&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetFileLineNumber(); }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; FileName&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetFileName(); }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; MethodName&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetMethod().Name; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; MethodSignature&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetMethod().ToString(); }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; FullMethodSignature&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; NameSpace + &lt;FONT color=#a31515&gt;" - "&lt;/FONT&gt; + MethodSignature; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; NameSpace&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Base.GetMethod().ReflectedType.FullName; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; IsUserCode&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; Line &amp;gt; 0; }&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;MethodBase&lt;/FONT&gt; GetMethod()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; Base.GetMethod();&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetCode()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; GetCode(2);&lt;/DIV&gt;}&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;param name="Lines"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;indicates the amount of lines before and after the Errorline to show &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/PARAM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetCode(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Lines)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (!IsUserCode)&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#a31515&gt;"No code available for a system method"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;string&lt;/FONT&gt; file = FileName;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (file == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt; || !&lt;FONT color=#2b91af&gt;File&lt;/FONT&gt;.Exists(file))&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#a31515&gt;"File not found!"&lt;/FONT&gt;;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;try&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; AppendCode(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt;(), Lines).ToString();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#a31515&gt;"Error obtaining code information: "&lt;/FONT&gt; + ex.Message;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;internal&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; AppendCode(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; Lines)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;int&lt;/FONT&gt; line = Line, from = line - Lines, to = line + Lines, curline = 0; ;&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; len = sb.Length;&lt;FONT color=#0000ff&gt;&lt;BR&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; space = &lt;FONT color=#a31515&gt;"&amp;amp;nbsp;"&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; tab = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; tabcount = 0; tabcount &amp;lt; 4; tabcount++)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;tab += space;&lt;/DIV&gt;}&lt;FONT color=#2b91af&gt;&lt;BR&gt;StreamReader&lt;/FONT&gt; sr = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sr = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;StreamReader&lt;/FONT&gt;(FileName);&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; l;&lt;FONT color=#0000ff&gt;&lt;BR&gt;while&lt;/FONT&gt; ((l = sr.ReadLine()) != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (++curline &amp;gt;= from)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (curline &amp;gt; to) &lt;FONT color=#0000ff&gt;break&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (line == curline) sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;B&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(l.Replace(&lt;FONT color=#a31515&gt;"\t"&lt;/FONT&gt;, tab).Replace(&lt;FONT color=#a31515&gt;" "&lt;/FONT&gt;, space));&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (line == curline) sb.Append(&lt;FONT color=#a31515&gt;"&lt;/B&gt;"&lt;/FONT&gt;);&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"&amp;lt;BR&amp;gt;"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;sb.Length = len;&lt;BR&gt;sb.Append(&lt;FONT color=#a31515&gt;"Error obtaining code information: "&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Append(ex.Message);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;finally&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (sr != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;) sr.Close();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; sb;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;interface&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IExtraInfo&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;void&lt;/FONT&gt; AppendHTML(&lt;FONT color=#2b91af&gt;StringBuilder&lt;/FONT&gt; sb, &lt;FONT color=#2b91af&gt;ExceptionInfo&lt;/FONT&gt; ei);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV ondblclick="var o = parentNode.firstChild;o.sel =1;o.click()" style="DISPLAY: none; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;BR&gt;&lt;B&gt;Example Usage&lt;/B&gt; &lt;!-- --Start of code block
--&gt;
&lt;DIV onkeydown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;amp;&amp;amp; i&lt;ch.selcount){ch.sel=i;ch.click();}" style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'" onclick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'500pt':null;if(i==1&amp;amp;&amp;amp; ch.offsetHeight&gt;h)ch.style.height=h;" selcount="3" selold="1" sel="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=0&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Hide&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bolder; MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=1&gt;&lt;INPUT onclick=this.blur(); type=radio CHECKED&gt;Scroll&lt;/SPAN&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=2&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 500pt; BACKGROUND-COLOR: #dcdcdc"&gt;Subro.Interaction.&lt;FONT color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; fbc = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; Subro.Interaction.&lt;FONT color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt;();&lt;BR&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//A thread is not obligatory of course, but for batch usage the thread&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//should be thread safe, this example shows that the feedback visualizer&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//is thread safe&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;Thread&lt;/FONT&gt; t = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Thread&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;delegate&lt;/FONT&gt;()&lt;BR&gt;{&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;//shows&lt;/FONT&gt;&lt;BR&gt;fbc.Add(&lt;FONT color=#a31515&gt;"Start"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//feedback with progress bar&lt;/FONT&gt;&lt;BR&gt;Subro.Interaction.&lt;FONT color=#2b91af&gt;Feedback&lt;/FONT&gt; fb = fbc.Add(&lt;FONT color=#a31515&gt;"Working towards a known target"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; target = 150;&lt;BR&gt;fb.ProgressTarget = target;&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt;= target; i++)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Thread&lt;/FONT&gt;.Sleep(10);&lt;BR&gt;fb.Progress = i;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;fb = fbc.Add(&lt;FONT color=#a31515&gt;"busy with something"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; 100; i++)&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 100pt"&gt;//Show alive shows a 'pulse' line to indicate that &lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//the process is still busy (used when the exact progress is unknown)&lt;/FONT&gt;&lt;BR&gt;fb.ShowAlive();&lt;FONT color=#2b91af&gt;&lt;BR&gt;Thread&lt;/FONT&gt;.Sleep(10);&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 100pt"&gt;//Each feedback item in turn can have 'children' attached&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//this means that information you want to have accessible,&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//but not necessarily shown each time can be added easily.&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//each child item in turn of course can also posses child items&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//when the feedback is shown, an 'i' button will appear to&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//indicate there is extra information available&lt;/FONT&gt;&lt;BR&gt;fb.Children.Add(&lt;FONT color=#a31515&gt;"Proccessed "&lt;/FONT&gt; + i.ToString());&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//special feedback items such as excpetions are available as&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//well. Exception example&lt;/FONT&gt;&lt;BR&gt;fbc.Add(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"If something went wrong, you would find the exception info here"&lt;/FONT&gt;));&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//of course custom feedback items (inheriting from Feedback)&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//could be added as well, where you can show your own custom&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//info, eg, you could show your own form when the information&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//button is clicked by overriding the ShowExtraInfo method&lt;/DIV&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//instead of, or after,&amp;nbsp;&amp;nbsp;showing, the results could also be&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//saved (or mailed), eg for saving:&lt;/FONT&gt;&lt;BR&gt;fbc.Save(&lt;FONT color=#a31515&gt;@"c:\temp\testresults.htm"&lt;/FONT&gt;);&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;});&lt;BR&gt;t.IsBackground = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;BR&gt;t.Start();&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//if no feedbackform was created, the feedback would still&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//be gathered, without the (relatively small) overhead of the feedback&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;/FONT&gt;&lt;BR&gt;fbc.ShowDialog();&lt;FONT color=#008000&gt;&lt;BR&gt;//other options are non modal Show and ShowHTML&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//The latter outputs all feedback to a html page with the complete overview&lt;/DIV&gt;&lt;/FONT&gt;&lt;BR&gt;Subro.Interaction.&lt;FONT color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt; fbc = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; Subro.Interaction.&lt;FONT color=#2b91af&gt;FeedbackCollection&lt;/FONT&gt;();&lt;BR&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//A thread is not obligatory of course, but for batch usage the thread&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//should be thread safe, this example shows that the feedback visualizer&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//is thread safe&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;Thread&lt;/FONT&gt; t = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Thread&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;delegate&lt;/FONT&gt;()&lt;BR&gt;{&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;//shows&lt;/FONT&gt;&lt;BR&gt;fbc.Add(&lt;FONT color=#a31515&gt;"Start"&lt;/FONT&gt;);&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//feedback with progress bar&lt;/FONT&gt;&lt;BR&gt;Subro.Interaction.&lt;FONT color=#2b91af&gt;Feedback&lt;/FONT&gt; fb = fbc.Add(&lt;FONT color=#a31515&gt;"Working towards a known target"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; target = 150;&lt;BR&gt;fb.ProgressTarget = target;&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt;= target; i++)&lt;BR&gt;{&lt;FONT color=#2b91af&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Thread&lt;/FONT&gt;.Sleep(10);&lt;BR&gt;fb.Progress = i;&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;fb = fbc.Add(&lt;FONT color=#a31515&gt;"busy with something"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt; 100; i++)&lt;BR&gt;{&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 100pt"&gt;//Show alive shows a 'pulse' line to indicate that &lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//the process is still busy (used when the exact progress is unknown)&lt;/FONT&gt;&lt;BR&gt;fb.ShowAlive();&lt;FONT color=#2b91af&gt;&lt;BR&gt;Thread&lt;/FONT&gt;.Sleep(10);&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 100pt"&gt;//Each feedback item in turn can have 'children' attached&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//this means that information you want to have accessible,&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//but not necessarily shown each time can be added easily.&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//each child item in turn of course can also posses child items&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//when the feedback is shown, an 'i' button will appear to&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//indicate there is extra information available&lt;/FONT&gt;&lt;BR&gt;fb.Children.Add(&lt;FONT color=#a31515&gt;"Proccessed "&lt;/FONT&gt; + i.ToString());&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;}&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//special feedback items such as excpetions are available as&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//well. Exception example&lt;/FONT&gt;&lt;BR&gt;fbc.Add(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;Exception&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"If something went wrong, you would find the exception info here"&lt;/FONT&gt;));&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//of course custom feedback items (inheriting from Feedback)&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//could be added as well, where you can show your own custom&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//info, eg, you could show your own form when the information&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//button is clicked by overriding the ShowExtraInfo method&lt;/DIV&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;//instead of, or after,&amp;nbsp;&amp;nbsp;showing, the results could also be&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//saved (or mailed), eg for saving:&lt;/FONT&gt;&lt;BR&gt;fbc.Save(&lt;FONT color=#a31515&gt;@"c:\temp\testresults.htm"&lt;/FONT&gt;);&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;});&lt;BR&gt;t.IsBackground = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;BR&gt;t.Start();&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//if no feedbackform was created, the feedback would still&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//be gathered, without the (relatively small) overhead of the feedback&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;/FONT&gt;&lt;BR&gt;fbc.ShowDialog();&lt;FONT color=#008000&gt;&lt;BR&gt;//other options are non modal Show and ShowHTML&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//The latter outputs all feedback to a html page with the complete overview&lt;/DIV&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV ondblclick="var o = parentNode.firstChild;o.sel =1;o.click()" style="DISPLAY: none; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/8983.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>ActiveDirectory and C#</title><link>http://blogs.vbcity.com/hotdog/archive/2007/07/05/8489.aspx</link><pubDate>Thu, 05 Jul 2007 08:40:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2007/07/05/8489.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/8489.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2007/07/05/8489.aspx#Feedback</comments><slash:comments>62</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/8489.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/8489.aspx</trackback:ping><description>&lt;P&gt;the System.DirectoryServices namespace from .net allready contains a lot of build&amp;nbsp;in functionality for use with Active Directory. However some default task have to coded manually still. Of course that meant writing some support tools which I've been happilly using for some time now :)&lt;BR&gt;The code posted here are the base classes used for those tools. At a later time if anyone is interested I'll include the tools project too (simple LDAP browser, user form that can lock/unlock, set pw and mail forwardings)&lt;/P&gt;
&lt;P&gt;The code is wrapped around the System.DirectoryServices objects and thus need a reference to that (default .net) namespace. The static ActiveDirectory class contains methods to quickly search entries. The ActiveDirectoryEntry class is a wrapper around the .net DirectoryEntry class which encapsulates functions to quickly access properties. ADFilter makes creating queries easier and UserInfo is a class that uses the other classes to quickly get and set user info.&lt;/P&gt;
&lt;P&gt;Example usage:&lt;/P&gt;&lt;!-- --Start of code block
--&gt;
&lt;DIV style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//get a single entry&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;ActiveDirectoryEntry&lt;/FONT&gt; d = &lt;FONT color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetEntry(&lt;FONT color=#a31515&gt;"srv*"&lt;/FONT&gt;, &lt;FONT color=#a31515&gt;"computer"&lt;/FONT&gt;);&lt;FONT color=#2b91af&gt;&lt;BR&gt;Console&lt;/FONT&gt;.WriteLine(d[&lt;FONT color=#a31515&gt;"whenCreated"&lt;/FONT&gt;]);&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//The default activedirectory queries can be used to find entries&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//list all computers:&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetEntries(&lt;FONT color=#a31515&gt;"objectClass=computer"&lt;/FONT&gt;))&lt;BR&gt;{&lt;FONT color=#2b91af&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Console&lt;/FONT&gt;.WriteLine(de.Name);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//list all users whose password was changed in the last 2 months&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; date = &lt;FONT color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.FormatDateTime( &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;.Today.AddMonths(-2));&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetEntries(&lt;FONT color=#a31515&gt;"(&amp;amp;(objectClass=user)(whenCreated&amp;gt;="&lt;/FONT&gt;+date+&lt;FONT color=#a31515&gt;"))"&lt;/FONT&gt;))&lt;BR&gt;{&lt;FONT color=#2b91af&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Console&lt;/FONT&gt;.WriteLine(&lt;FONT color=#a31515&gt;"{0}, created: {1}"&lt;/FONT&gt;, de.Name, de[&lt;FONT color=#a31515&gt;"whenCreated"&lt;/FONT&gt;]);&lt;/DIV&gt;}&lt;BR&gt;&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//Another method is to use the ADFilter object, which makes writing those nasty queries somewhat easer&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//Doing the same as above:&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;BR&gt;filter.objectClass = &lt;FONT color=#a31515&gt;"user"&lt;/FONT&gt;;&lt;BR&gt;filter.Add(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ADCriterium&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"whenCreated"&lt;/FONT&gt;, &lt;FONT color=#2b91af&gt;Operator&lt;/FONT&gt;.Equals | &lt;FONT color=#2b91af&gt;Operator&lt;/FONT&gt;.GreaterThan,&lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;.Today.AddMonths(-2)));&lt;FONT color=#2b91af&gt;&lt;BR&gt;Console&lt;/FONT&gt;.WriteLine(filter);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetEntries(filter))&lt;BR&gt;{&lt;FONT color=#2b91af&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Console&lt;/FONT&gt;.WriteLine(&lt;FONT color=#a31515&gt;"{0}, created: {1}"&lt;/FONT&gt;, de.Name, de[&lt;FONT color=#a31515&gt;"whenCreated"&lt;/FONT&gt;]);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//for a small query as above the filter isn't so important, but imagine the more complicated&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//scenario of also wanting to search for&amp;nbsp;&amp;nbsp;at names beginning with w or a badlogincount of 0&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;ADFilter&lt;/FONT&gt; subquery = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;BR&gt;subquery[&lt;FONT color=#a31515&gt;"cn"&lt;/FONT&gt;] = &lt;FONT color=#a31515&gt;"w*"&lt;/FONT&gt;;&lt;BR&gt;subquery[&lt;FONT color=#a31515&gt;"badPwdCount"&lt;/FONT&gt;] = 0;&lt;BR&gt;filter.Add(subquery);&lt;FONT color=#008000&gt;&lt;BR&gt;//this produces the following filter:&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&amp;amp;(objectClass=user)(whenCreated&amp;gt;=070505000000Z)(&amp;amp;(cn=w*)(badPwdCount=0)))&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;Console&lt;/FONT&gt;.WriteLine(filter);&lt;FONT color=#0000ff&gt;&lt;BR&gt;foreach&lt;/FONT&gt; (&lt;FONT color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetEntries(filter))&lt;BR&gt;{&lt;FONT color=#2b91af&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Console&lt;/FONT&gt;.WriteLine(&lt;FONT color=#a31515&gt;"{0}, created: {1}"&lt;/FONT&gt;, de.Name, de[&lt;FONT color=#a31515&gt;"whenCreated"&lt;/FONT&gt;]);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Example usage UserInfo class:&lt;/P&gt;&lt;!-- --Start of code block
--&gt;
&lt;DIV style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;//getting the current user can be done with the GetCurrentUser function&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;BR&gt;UserInfo&lt;/FONT&gt; ui = &lt;FONT color=#2b91af&gt;UserInfo&lt;/FONT&gt;.GetCurrentUser();&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; surname = ui.SurName;&lt;BR&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//some other user (when using wildcard searches, the first found entry is used)&lt;/FONT&gt;&lt;BR&gt;ui = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;UserInfo&lt;/FONT&gt;(&lt;FONT color=#a31515&gt;"Hotd*"&lt;/FONT&gt;);&lt;FONT color=#008000&gt;&lt;BR&gt;//NB: if the user is not found, calling properties will throw an exception&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;// which informs that no active directory entry exists&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;// You can check if a valid entry was found by checking the HasActiveDirectoryEntry property&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (!ui.HasActiveDirectoryEntry) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ui.IsMailForwarded)&lt;BR&gt;{&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;string&lt;/FONT&gt; mail = ui.MailForwardedTo.FullName;&lt;/DIV&gt;}&lt;FONT color=#008000&gt;&lt;BR&gt;//other functions included, for example password changing&lt;/FONT&gt;&lt;BR&gt;ui.SetPassword(&lt;FONT color=#a31515&gt;"NewPassword"&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;The classes:&lt;/P&gt;

&lt;!-- --Start of code block
--&gt;&lt;DIV Style=" Border='1px #000080 solid'; Margin-Left=10pt; Margin-Right=2pt;" OnKeyDown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;&amp; i&lt;ch.selcount){ch.sel=i;ch.click();}"&gt;&lt;DIV Style=" Font-Size=9pt; Font-Family='Microsoft Sans Serif'; Border-Bottom='1px #000080 solid';" OnClick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'300pt':null;if(i==1&amp;&amp; ch.offsetHeight&gt;h)ch.style.height=h;" sel=1 selold=1 selcount=3&gt;&lt;b&gt;  Code &lt;/b&gt;&lt;a href="javascript:" Style=" Margin-Left=10pt; Margin-Right=10pt;" OnClick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');"&gt;Copy&lt;/a&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=0"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Hide&lt;/SPAN&gt;&lt;SPAN Style=" Font-Weight=bolder; Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=1"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();" Checked=True&gt;Scroll&lt;/SPAN&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=2"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;&lt;DIV Style=" BackGround-Color=#dcdcdc; overflow='auto'; Height=300pt;"&gt;&lt;FONT Color=#008000&gt;//#define Framework30 //uncomment this line if you want to include framework 3.0 functions such as Linq&lt;br&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Text;&lt;FONT Color=#008000&gt;&lt;br&gt;//needs a reference to System.DirectoryServices&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.DirectoryServices;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; ad = System.DirectoryServices.ActiveDirectory;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Runtime.InteropServices;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections.Specialized;&lt;FONT Color=#0000ff&gt;&lt;br&gt;#if&lt;/FONT&gt; Framework30&lt;FONT Color=#808080&gt;&lt;br&gt;using System.Linq;&lt;br&gt;using System.Linq.Expressions;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;namespace&lt;/FONT&gt; AD&lt;br&gt;{&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Base class for all returned directory entries&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DirectoryEntry&lt;/FONT&gt; Entry;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ActiveDirectoryEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Path)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DirectoryEntry&lt;/FONT&gt;(Path))&lt;/div&gt;{&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;internal&lt;/FONT&gt; ActiveDirectoryEntry(&lt;FONT Color=#2b91af&gt;DirectoryEntry&lt;/FONT&gt; Entry)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Entry == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ArgumentNullException&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;this&lt;/FONT&gt;.Entry = Entry;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetEntry(&lt;FONT Color=#2b91af&gt;DirectoryEntry&lt;/FONT&gt; Entry)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Entry == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;(Entry);&lt;/div&gt;}&lt;FONT Color=#008000&gt;&lt;br&gt;/*&lt;br&gt;public static implicit operator ActiveDirectoryEntry(DirectoryEntry de)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (de == null) return null;&lt;br&gt;return new ActiveDirectoryEntry(de);&lt;/div&gt;}*/&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;/*&lt;br&gt;public static implicit operator DirectoryEntry(ActiveDirectoryEntry de)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return de.Entry;&lt;/div&gt;}*/&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Path&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Entry.Path; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Invoke(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; methodName, &lt;FONT Color=#0000ff&gt;params&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;[] args)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Entry.Invoke(methodName, args);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; InvokeGet(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; methodName)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Entry.InvokeGet(methodName);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; InvokeSet(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; methodName, &lt;FONT Color=#0000ff&gt;params&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;[] args)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Entry.InvokeSet(methodName, args);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; CommitChanges()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Entry.CommitChanges();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; RefreshCache()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Entry.RefreshCache();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;ActiveDirectoryEntry&lt;/FONT&gt; parent;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; Parent&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (parent == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;parent = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;(Entry.Parent);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; parent;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; memberof = &lt;FONT Color=#a31515&gt;&amp;quotmemberof&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; members = &lt;FONT Color=#a31515&gt;&amp;quotmember&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt EnumerateMemberOf()&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; Properties[memberof])&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetEntry(s);&lt;/div&gt;}&lt;FONT Color=#2b91af&gt;&lt;br&gt;ActiveDirectoryEntry&lt;/FONT&gt; e = GetPrimaryGroup();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (e != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; e;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsMemberOf(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Group)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[memberof];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;&amp;gt owners = o &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ? &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;[] { (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;)o } : (&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;[])o;&lt;br&gt;Group = &lt;FONT Color=#a31515&gt;&amp;quotCN=&amp;quot&lt;/FONT&gt; + Group;&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; owners)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (s.Contains(Group)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsMemberOf(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; group)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ad &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; EnumerateMemberOf())&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (ad.Equals(group)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccessType&lt;/FONT&gt; GetAccessType(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; group)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt list = GetMemberOf();&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ad &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; list)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (ad.Equals(group)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccessType&lt;/FONT&gt;.Direct;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ad &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; list)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;AccessType&lt;/FONT&gt; at = ad.GetAccessType(group);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (at != &lt;FONT Color=#2b91af&gt;AccessType&lt;/FONT&gt;.None)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccessType&lt;/FONT&gt;.Nested;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccessType&lt;/FONT&gt;.None;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Prefix&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Path.Remove(Path.IndexOf(&lt;FONT Color=#a31515&gt;&amp;quot//&amp;quot&lt;/FONT&gt;) + 2);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; path = Prefix + Clean(s);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;(path);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; Clean(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (s.IndexOf(&lt;FONT Color=#a31515&gt;'/'&lt;/FONT&gt;) &amp;gt= 0)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;s = s.Replace(&lt;FONT Color=#a31515&gt;&amp;quot/&amp;quot&lt;/FONT&gt;, &lt;FONT Color=#a31515&gt;@&amp;quot\/&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; s;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsTop&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Entry.Parent.SchemaClassName == &lt;FONT Color=#a31515&gt;&amp;quotdomainDNS&amp;quot&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsEndpoint&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;switch&lt;/FONT&gt; (Class)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.organizationalUnit:&lt;FONT Color=#0000ff&gt;&lt;br&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.container:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;default&lt;/FONT&gt;:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; SchemaClassName&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Entry.SchemaClassName; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt; Class&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;)&lt;FONT Color=#2b91af&gt;Enum&lt;/FONT&gt;.Parse(&lt;FONT Color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;), Entry.SchemaClassName);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.any;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetMemberOf()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt res = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt();&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; EnumerateMemberOf())&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;res.Add(de);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; res;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PropertyValueCollection&lt;/FONT&gt; MemberOf&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Properties[memberof]; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PropertyValueCollection&lt;/FONT&gt; Members&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Properties[members]; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetMembers()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; Members)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetEntry(s);&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;System.Security.Principal.&lt;FONT Color=#2b91af&gt;SecurityIdentifier&lt;/FONT&gt; sid = GetSID();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (sid != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; s = sid.ToString();&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; i = s.LastIndexOf(&lt;FONT Color=#a31515&gt;'-'&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (i != -1)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;s = s.Substring(++i);&lt;FONT Color=#008000&gt;&lt;br&gt;//byte[] b = GetSIDArray();&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/FONT&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:100pt"&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotprimarygroupID&amp;quot&lt;/FONT&gt;, s);&lt;br&gt;filter.ObjectClass = &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.user;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:100pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ad &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; filter.GetEntries())&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//if(IsEqual(b,ad.GetSIDArray(),b.Length-4))&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; ad;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; IsEqual(&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[] b1, &lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[] b2, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; len)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt len; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (b1[i] != b2[i]) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt DeepEnumerateMembers()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.Class == &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.user)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ad &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; GetMembers())&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; m &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; ad.DeepEnumerateMembers())&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; m;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Name&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotcn&amp;quot&lt;/FONT&gt;];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; o.ToString();&lt;br&gt;o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotou&amp;quot&lt;/FONT&gt;];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; o.ToString();&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; Entry.Name;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; System.Security.Principal.&lt;FONT Color=#2b91af&gt;SecurityIdentifier&lt;/FONT&gt; GetSID()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;byte&lt;/FONT&gt;[] b = GetSIDArray();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (b == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetSID(b);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;byte&lt;/FONT&gt;[] GetSIDArray()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = GetValue(&lt;FONT Color=#a31515&gt;&amp;quotobjectSid&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;byte&lt;/FONT&gt;[] b = o &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (b == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (o &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Guid&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;b = ((&lt;FONT Color=#2b91af&gt;Guid&lt;/FONT&gt;)o).ToByteArray();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotCould not parse SID of type &amp;quot&lt;/FONT&gt; + o.GetType().FullName);&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; b;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; PrimaryGroupID&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetValue&amp;lt&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;&amp;gt(&lt;FONT Color=#a31515&gt;&amp;quotprimarygroupID&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetPrimaryGroup()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; pg = PrimaryGroupID;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (pg == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;System.Security.Principal.&lt;FONT Color=#2b91af&gt;SecurityIdentifier&lt;/FONT&gt; sid = GetSID();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (sid == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; s = sid.ToString();&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; i = s.LastIndexOf(&lt;FONT Color=#a31515&gt;'-'&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (i == -1) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetBySID(s.Substring(0, ++i) + pg.ToString());&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; T GetValue&amp;ltT&amp;gt(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[Property];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;default&lt;/FONT&gt;(T);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; (T)o;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; T GetValue&amp;ltT&amp;gt(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property, T Default)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[Property];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Default;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; (T)o;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; GetValue(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[Property];&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; When true, all changes are automatically comitted when a property is changed&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AutoSaveChanges = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PropertyName]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryProperty&lt;/FONT&gt;.GetValue(Properties[PropertyName]);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;PropertyValueCollection&lt;/FONT&gt; pv = Properties[PropertyName];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (pv == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(PropertyName + &lt;FONT Color=#a31515&gt;&amp;quot not found&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#2b91af&gt;&lt;br&gt;ActiveDirectoryProperty&lt;/FONT&gt;.SetValue(pv, &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;if&lt;/FONT&gt; (AutoSaveChanges)&lt;div style="margin-left:20pt"&gt;CommitChanges();&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;PropertyCollection&lt;/FONT&gt; Properties&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Entry.Properties; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; You can get the value directly by using the indexed property (e.g. YourEntry[&amp;quotPropertyName&amp;quot] ), but&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; the &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotActiveDirectoryProperty&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; encapsulates more functionality around the property.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltparam name=&amp;quotPropertyName&amp;quot&amp;gt&amp;lt/param&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&amp;gt&amp;lt/returns&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryProperty&lt;/FONT&gt; GetProperty(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PropertyName)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryProperty&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, PropertyName);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryProperty&lt;/FONT&gt;&amp;gt GetProperties()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;PropertyValueCollection&lt;/FONT&gt; pv &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; Properties)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetProperty(pv.PropertyName);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DirectoryEntries&lt;/FONT&gt; Children&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Entry.Children; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; GetHashCode()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Path.GetHashCode();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; Equals(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; obj)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; obj &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; &amp;amp&amp;amp&lt;div style="margin-left:20pt"&gt;(obj &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;).Path == Path;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Name;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ImplementsClass(&lt;FONT Color=#0000ff&gt;params&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;[] classes)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; Properties[&lt;FONT Color=#a31515&gt;&amp;quotobjectClass&amp;quot&lt;/FONT&gt;].Value &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;[])&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt classes.Length; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (classes[i] == s) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccessType&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;None,&lt;br&gt;Direct,&lt;br&gt;Nested&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryProperty&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; Entry;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PropertyName;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsSID;&lt;FONT Color=#2b91af&gt;&lt;br&gt;PropertyValueCollection&lt;/FONT&gt; pv;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ActiveDirectoryProperty(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; Entry, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PropertyName)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Entry = Entry;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.PropertyName = PropertyName;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pv = Entry.Properties[PropertyName];&lt;br&gt;IsSID = PropertyName == &lt;FONT Color=#a31515&gt;&amp;quotobjectSid&amp;quot&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AutoSaveChanges&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; Entry.AutoSaveChanges; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { Entry.AutoSaveChanges = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; Value&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetValue(pv);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Entry[PropertyName] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; Exists&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; pv != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Capacity&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; pv.Capacity;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HasValue&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; pv != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp pv.Count &amp;gt 0; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;&amp;gt GetValues()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (!HasValue) &lt;FONT Color=#0000ff&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;break&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt pv.Count; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[i];&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Index]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.Convert(pv[Index]);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetValueString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetValueString(&lt;FONT Color=#2b91af&gt;Environment&lt;/FONT&gt;.NewLine);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetValueString(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Seperator)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (!HasValue) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; res = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt pv.Count; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (i &amp;gt 0) res += Seperator;&lt;br&gt;res += GetValueString(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[i]);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; res;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;string&lt;/FONT&gt; GetValueString(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; o)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (o &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[])&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (IsSID) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetSID((&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[])o).ToString();&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.ByteArrayToString((&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[])o);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; o.ToString();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; PropertyName + &lt;FONT Color=#a31515&gt;&amp;quot: &amp;quot&lt;/FONT&gt; + GetValueString(&lt;FONT Color=#a31515&gt;&amp;quot, &amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; GetValue(&lt;FONT Color=#2b91af&gt;PropertyValueCollection&lt;/FONT&gt; pv)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (pv == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; || (o = pv.Value) == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.Convert(o);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetValue(&lt;FONT Color=#2b91af&gt;PropertyValueCollection&lt;/FONT&gt; pv, &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; value)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (pv.Value == value) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (value == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;pv.Remove(pv.Value);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (pv.Value &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IADsLargeInteger&lt;/FONT&gt; &amp;amp&amp;amp value &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//pv.Value = (int)(uint)((DateTime)value).ToFileTime();&lt;/FONT&gt;&lt;FONT Color=#2b91af&gt;&lt;br&gt;ActiveDirectory&lt;/FONT&gt;.SetDateTime(pv, (&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;)value);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;pv.Value = value;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The default 'objectClass' types on which a search can be performed&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;any, group, user, organizationalUnit, computer, container&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Interface type to convert AD date time objects&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ComImport&lt;/FONT&gt;]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Guid&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quot9068270B-0939-11D1-8BE1-00C04FD8D503&amp;quot&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;InterfaceType&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;ComInterfaceType&lt;/FONT&gt;.InterfaceIsDual)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;interface&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IADsLargeInteger&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;[&lt;FONT Color=#2b91af&gt;DispId&lt;/FONT&gt;(0x00000002)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; HighPart { &lt;FONT Color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT Color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DispId&lt;/FONT&gt;(0x00000003)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; LowPart { &lt;FONT Color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT Color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Static functions for querying Active Directory&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;#region&lt;/FONT&gt; Main get entries functions&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEntries(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Filter)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEntries(Filter, (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEntries(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Filter, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; RootFilter)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ActiveDirectoryEntry&lt;/FONT&gt; root = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (RootFilter != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;root = GetFirstEntry(RootFilter);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; GetEntries(Filter, root);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEntries(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Filter, &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; root)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEntries(Filter, root, &lt;FONT Color=#2b91af&gt;SearchScope&lt;/FONT&gt;.Subtree);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEntries(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Filter, &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; Root, &lt;FONT Color=#2b91af&gt;SearchScope&lt;/FONT&gt; Scope)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;AdSearchInfo&lt;/FONT&gt; si = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AdSearchInfo&lt;/FONT&gt;();&lt;br&gt;si.SearchRoot = Root;&lt;br&gt;si.Scope = Scope;&lt;br&gt;si.Filter = Filter;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; si;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEntries(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt; ObjectClass)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEntries(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(ObjectClass));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetFirstEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Filter)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetFirstEntry(Filter, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetFirstEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Filter, &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; root)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetFirstEntry(GetEntries(Filter, root));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetFirstEntry(&lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt ie)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; ie)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; de;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Specific entry searching/ supporting functions&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetFolder(&lt;FONT Color=#0000ff&gt;params&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;[] Path)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ActiveDirectoryEntry&lt;/FONT&gt; de = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; Path)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;de = GetFolder(s, de);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (de == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; de;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetFolder(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; name, &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; parent)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; GetFolders(name, parent))&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; de;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetFolders(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; name, &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; parent)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(name)) name = &lt;FONT Color=#a31515&gt;&amp;quot*&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; GetEntries(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.Format( &lt;FONT Color=#008000&gt;//&amp;quot(|(&amp;amp(cn={0})(objectClass=group))(ou={0}))&amp;quot&lt;/FONT&gt;&lt;FONT Color=#a31515&gt;&lt;div style="margin-left:20pt"&gt;&amp;quot(ou={0})&amp;quot&lt;/FONT&gt;, name), parent, &lt;FONT Color=#2b91af&gt;SearchScope&lt;/FONT&gt;.OneLevel);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetContainers()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetContainers(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetContainers(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; parent)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEntries(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.container));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetSecurityGroup(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; group)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetFirstEntry(GetFilter(group, &lt;FONT Color=#a31515&gt;&amp;quotgroup&amp;quot&lt;/FONT&gt;));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetBySID(System.Security.Principal.&lt;FONT Color=#2b91af&gt;SecurityIdentifier&lt;/FONT&gt; sid)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetBySID(sid.Value);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetBySID(&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[] sid)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;StringBuilder&lt;/FONT&gt; sb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt sid.Length; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (sid[i] &amp;lt 33 || sid[i] &amp;gt 125)&lt;div style="margin-left:20pt"&gt;sb.Append(&lt;FONT Color=#a31515&gt;&amp;quot\\&amp;quot&lt;/FONT&gt;).Append(sid[i].ToString(&lt;FONT Color=#a31515&gt;&amp;quotx2&amp;quot&lt;/FONT&gt;));&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;sb.Append((&lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt;)sid[i]);&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; GetBySID(sb.ToString());&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetBySID(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; sid)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetFirstEntry(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotobjectSid&amp;quot&lt;/FONT&gt;, sid));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; System.Security.Principal.&lt;FONT Color=#2b91af&gt;SecurityIdentifier&lt;/FONT&gt; GetSID(&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[] value)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Security.Principal.&lt;FONT Color=#2b91af&gt;SecurityIdentifier&lt;/FONT&gt;(value, 0);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; cn)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEntry(cn, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; cn, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; objectclass)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetFirstEntry(GetFilter(cn, objectclass));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetEntry(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; cn, &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt; objectclass)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEntry(cn, objectclass.ToString());&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; GetFilter(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; cn, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; objectclass)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;br&gt;filter.objectClass = objectclass;&lt;br&gt;filter[&lt;FONT Color=#a31515&gt;&amp;quotcn&amp;quot&lt;/FONT&gt;] = cn == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; ? &lt;FONT Color=#a31515&gt;&amp;quot*&amp;quot&lt;/FONT&gt; : cn;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; filter;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Other AD related functions&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; SynchronizeDomain(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; TargetServer)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ad.&lt;FONT Color=#2b91af&gt;DirectoryContext&lt;/FONT&gt; context = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; ad.&lt;FONT Color=#2b91af&gt;DirectoryContext&lt;/FONT&gt;(ad.&lt;FONT Color=#2b91af&gt;DirectoryContextType&lt;/FONT&gt;.DirectoryServer, TargetServer);&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; res = 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; (ad.&lt;FONT Color=#2b91af&gt;DomainController&lt;/FONT&gt; dc = ad.&lt;FONT Color=#2b91af&gt;DomainController&lt;/FONT&gt;.GetDomainController(context))&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//dc.SyncReplicaFromAllServers(&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; partition &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; dc.Partitions)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;dc.SyncReplicaFromAllServers(partition, ad.&lt;FONT Color=#2b91af&gt;SyncFromAllServersOptions&lt;/FONT&gt;.AbortIfServerUnavailable);&lt;br&gt;res++;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; res;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;ltad.&lt;FONT Color=#2b91af&gt;DomainController&lt;/FONT&gt;&amp;gt GetDomainControllers()&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;foreach&lt;/FONT&gt; (ad.&lt;FONT Color=#2b91af&gt;DomainController&lt;/FONT&gt; dc &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; ad.&lt;FONT Color=#2b91af&gt;Domain&lt;/FONT&gt;.GetCurrentDomain().DomainControllers)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; dc;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt GetDomainServers()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (ad.&lt;FONT Color=#2b91af&gt;DomainController&lt;/FONT&gt; dc &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; GetDomainControllers())&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; dc.Name;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; DateTime support&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsDateTimeComObject(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; o)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; o &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IADsLargeInteger&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Converts an &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotIADsLargeInteger&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; to a date time&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltparam name=&amp;quotComObject&amp;quot&amp;gt&amp;lt/param&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&amp;gt&amp;lt/returns&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; GetDateTime(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; ComObject)&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:60pt"&gt;IADsLargeInteger&lt;/FONT&gt; li = (&lt;FONT Color=#2b91af&gt;IADsLargeInteger&lt;/FONT&gt;)ComObject;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (li.LowPart == -1) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.MinValue;&lt;FONT Color=#0000ff&gt;&lt;br&gt;long&lt;/FONT&gt; date = (&lt;FONT Color=#0000ff&gt;long&lt;/FONT&gt;)li.HighPart &amp;lt&amp;lt 32 | (&lt;FONT Color=#0000ff&gt;uint&lt;/FONT&gt;)li.LowPart;&lt;FONT Color=#0000ff&gt;&lt;br&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.FromFileTime(date);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;System.Diagnostics.&lt;FONT Color=#2b91af&gt;Debug&lt;/FONT&gt;.WriteLine(ex.Message);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.MinValue;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;long&lt;/FONT&gt; lowmask = 0xFFFFFFFF;&lt;FONT Color=#0000ff&gt;&lt;br&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetDateTime(&lt;FONT Color=#2b91af&gt;PropertyValueCollection&lt;/FONT&gt; pv, &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; value)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;IADsLargeInteger&lt;/FONT&gt; li = (&lt;FONT Color=#2b91af&gt;IADsLargeInteger&lt;/FONT&gt;)pv.Value;&lt;FONT Color=#0000ff&gt;&lt;br&gt;long&lt;/FONT&gt; l = value.ToFileTime();&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;li.HighPart = (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)(l &amp;gt&amp;gt 32);&lt;br&gt;li.LowPart = (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;)(l &amp;amp lowmask);&lt;FONT Color=#008000&gt;&lt;br&gt;//Forces update&lt;/FONT&gt;&lt;br&gt;pv.Value = li;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Formats the DateTime to LDIF&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltparam name=&amp;quotdt&amp;quot&amp;gt&amp;lt/param&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&amp;gt&amp;lt/returns&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; FormatDateTime(&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; dt)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; dt.ToString(&lt;FONT Color=#a31515&gt;@&amp;quotyyMMddHHmmssZ&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; FormatBoolean(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; b)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; b ? &lt;FONT Color=#a31515&gt;&amp;quotTRUE&amp;quot&lt;/FONT&gt; : &lt;FONT Color=#a31515&gt;&amp;quotFALSE&amp;quot&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Conversion&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; Convert(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; o)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (IsDateTimeComObject(o))&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDateTime(o);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (o &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[])&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;byte&lt;/FONT&gt;[] b = (&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[])o;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (b.Length == 16)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Guid&lt;/FONT&gt;(b);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:60pt"&gt;//TODO: other com objects&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; o;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;internal&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ByteArrayToString(&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[] b)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;StringBuilder&lt;/FONT&gt; sb = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;StringBuilder&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quot0x &amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt b.Length; i++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;sb.Append(b[i].ToString(&lt;FONT Color=#a31515&gt;&amp;quotX&amp;quot&lt;/FONT&gt;));&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; sb.ToString();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;br&gt;&lt;br&gt;#if&lt;/FONT&gt; Framework30&lt;br&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;/// &amp;ltsummary&amp;gt&lt;br&gt;/// Used for querying with Linq&lt;br&gt;/// &amp;lt/summary&amp;gt&lt;br&gt;public static ADQuery Entries&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;get&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return new ADQuery();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;public static ADQuery&amp;ltUserInfo&amp;gt Users&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;get&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return new ADQuery&amp;ltUserInfo&amp;gt(UserInfo.GetDefaultUserGroupsFilter());&lt;/div&gt;}&lt;/div&gt;}&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;#endif&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;#region&lt;/FONT&gt; Filter&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;interface&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt;&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt;&amp;gt, &lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; ADFilter()&lt;br&gt;{&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ADFilter(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;[Property] = Value;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ADFilter(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt; ObjectClass)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.ObjectClass = ObjectClass;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt; LogicalOperator;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Count == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Count == 1) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[0].ToString();&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; s = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt; c &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;s += c.ToString();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.Format(&lt;FONT Color=#a31515&gt;&amp;quot({0}{1})&amp;quot&lt;/FONT&gt;, GetOperator(), s);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;string&lt;/FONT&gt; GetOperator()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;switch&lt;/FONT&gt; (LogicalOperator)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt;.AND:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#a31515&gt;&amp;quot&amp;amp&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt;.OR:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#a31515&gt;&amp;quot|&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt;.NOT:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#a31515&gt;&amp;quot!&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;default&lt;/FONT&gt;:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Gets or sets the criterium for the secified property. If a property is set that was set&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; in a previous step, the previous property criterium will be overridden. For adding&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; multiple criteria of the same property, please use &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotAdd&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltparam name=&amp;quotProperty&amp;quot&amp;gt&amp;lt/param&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&amp;gt&amp;lt/returns&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADCriterium&lt;/FONT&gt; c = GetCriterium(Property);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (c == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; c.Value;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADCriterium&lt;/FONT&gt; c = GetCriterium(Property);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (c == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) Add(Property, &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;Remove(c);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;c.Value = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Add(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property, &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; value)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Add(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADCriterium&lt;/FONT&gt;(Property, value));&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; AddSubFilter(&lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt; Operator)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;br&gt;filter.LogicalOperator = Operator;&lt;br&gt;Add(filter);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; filter;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; AddSubFilter(&lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt; Operator,&lt;FONT Color=#0000ff&gt;params&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt;[] criteria)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter = AddSubFilter(Operator);&lt;br&gt;filter.AddRange(criteria);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; filter;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; GetFirstEntry()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetFirstEntry(GetEntries());&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEntries()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AdSearchInfo&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADCriterium&lt;/FONT&gt; GetCriterium(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt; ic &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADCriterium&lt;/FONT&gt; c = ic &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADCriterium&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (c != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.Equals(c.Property, Property, &lt;FONT Color=#2b91af&gt;StringComparison&lt;/FONT&gt;.OrdinalIgnoreCase))&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; c;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[System.ComponentModel.&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; objectClass&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotobjectClass&amp;quot&lt;/FONT&gt;] &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotobjectClass&amp;quot&lt;/FONT&gt;] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[System.ComponentModel.&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;(System.ComponentModel.&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;.Hidden)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt; ObjectClass&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; s = objectClass;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (s == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.any;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;)&lt;FONT Color=#2b91af&gt;Enum&lt;/FONT&gt;.Parse(&lt;FONT Color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;), s);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.any)&lt;div style="margin-left:20pt"&gt;objectClass = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;objectClass = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.ToString();&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; f)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (f == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; f.ToString();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(s)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;ADFilter&lt;/FONT&gt; f = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;br&gt;f.Add(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLiteralCriterium&lt;/FONT&gt;(s));&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; f;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;ADCriterium&lt;/FONT&gt; c)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; f = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;br&gt;f.Add(c);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; f;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;implicit&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;operator&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt; cl)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; f = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;br&gt;f.ObjectClass = cl;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; f;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AdSearchInfo&lt;/FONT&gt;:&lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; SearchRoot;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt PropertiesToLoad;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;SearchScope&lt;/FONT&gt; Scope = &lt;FONT Color=#2b91af&gt;SearchScope&lt;/FONT&gt;.Subtree;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; AdSearchInfo()&lt;br&gt;{&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; AdSearchInfo(&lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; Filter)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.filter = Filter;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; AdSearchInfo(&lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; Filter, &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt PropertiesToLoad):&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;(Filter)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.PropertiesToLoad = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt(PropertiesToLoad);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; Filter&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (filter == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; filter;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;filter = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; AddLoadProperty(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; prop)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (PropertiesToLoad == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;PropertiesToLoad = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;List&lt;/FONT&gt;&amp;lt&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt();&lt;/div&gt;PropertiesToLoad.Add(prop);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; IEnumerable&amp;ltActiveDirectoryEntry&amp;gt Members&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerator&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;&amp;gt GetEnumerator()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DirectoryEntry&lt;/FONT&gt; root = SearchRoot == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; ? &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DirectoryEntry&lt;/FONT&gt;() : SearchRoot.Entry;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;using&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;DirectorySearcher&lt;/FONT&gt; ds = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DirectorySearcher&lt;/FONT&gt;(root, filter,&lt;div style="margin-left:20pt"&gt;PropertiesToLoad==&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; ? &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; : PropertiesToLoad.ToArray()))&lt;/div&gt;{&lt;div style="margin-left:20pt"&gt;ds.SearchScope = Scope;&lt;FONT Color=#2b91af&gt;&lt;br&gt;SearchResultCollection&lt;/FONT&gt; res = ds.FindAll();&lt;FONT Color=#0000ff&gt;&lt;br&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;SearchResult&lt;/FONT&gt; sr &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; res)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DirectoryEntry&lt;/FONT&gt; de = sr.GetDirectoryEntry();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (de.Name != root.Name)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;(de);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;} &lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; IEnumerable Members&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;System.Collections.&lt;FONT Color=#2b91af&gt;IEnumerator&lt;/FONT&gt; System.Collections.&lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;.GetEnumerator()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetEnumerator();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLogicalOperator&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;AND, OR, NOT&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;[&lt;FONT Color=#2b91af&gt;Flags&lt;/FONT&gt;]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Equals = 1,&lt;br&gt;Approxamately = 3,&lt;br&gt;GreaterThan = 4,&lt;br&gt;LessThan = 8&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADCriterium&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property;&lt;br&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Operator, can be combined (eg combine &amp;quot&amp;gt&amp;quot and &amp;quot=&amp;quot to get &amp;quot&amp;gt=&amp;quot )&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt; Operator;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; Value;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ADCriterium(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property, &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; Value)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Property = Property;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Value = Value;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ADCriterium(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property, &lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt; Operator, &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; Value)&lt;div style="margin-left:20pt"&gt;: &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;(Property, Value)&lt;/div&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Operator = Operator;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetFormattedValue()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Value == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Value &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.FormatDateTime((&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;)Value);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (Value &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.FormatBoolean((&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt;)Value);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; Value.ToString();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; Implements(&lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt; o)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; (o &amp;amp &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.Operator) == o;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; GetOperator()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (Operator == 0) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#a31515&gt;&amp;quot=&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; res = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (Implements(&lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt;.Approxamately))&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#a31515&gt;&amp;quot~&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (Implements(&lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt;.LessThan))&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#a31515&gt;&amp;quot&amp;lt&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (Implements(&lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt;.GreaterThan))&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#a31515&gt;&amp;quot&amp;gt&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (Implements(&lt;FONT Color=#2b91af&gt;Operator&lt;/FONT&gt;.Equals))&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#a31515&gt;&amp;quot=&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; res;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.Format(&lt;FONT Color=#a31515&gt;&amp;quot({0}{1}{2})&amp;quot&lt;/FONT&gt;, Property, GetOperator(), GetFormattedValue());&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADLiteralCriterium&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;IADCriterium&lt;/FONT&gt;&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Criterium;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ADLiteralCriterium(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Criterium)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Criterium = Criterium;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Criterium;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;#endregion&lt;/div&gt;&lt;br&gt;#if&lt;/FONT&gt; Framework30&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;public class ADQuery&amp;ltT&amp;gt &lt;br&gt;{&lt;div style="margin-left:20pt"&gt;AdSearchInfo inf;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;public ADQuery() :&lt;div style="margin-left:20pt"&gt;this(null)&lt;/div&gt;{&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;public ADQuery(ADFilter filter)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;this.inf = new AdSearchInfo(filter);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;public ADQuery&amp;ltT&amp;gt Where(Expression&amp;ltFunc&amp;ltT,bool&amp;gt&amp;gt predicate)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Add(predicate,inf.Filter);&lt;br&gt;return this;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;bool Add(Expression e,ADFilter filter)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (e is LambdaExpression)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return Add(((LambdaExpression)e).Body, filter);&lt;/div&gt;}&lt;br&gt;if (e is BinaryExpression)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;var b= e as BinaryExpression;&lt;br&gt;ADLogicalOperator op = filter.LogicalOperator;&lt;br&gt;if (b.NodeType == ExpressionType.NotEqual)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;filter = filter.AddSubFilter(ADLogicalOperator.NOT);&lt;/div&gt;}&lt;br&gt;else if (b.NodeType == ExpressionType.AndAlso)&lt;div style="margin-left:20pt"&gt;return Add(b, filter, ADLogicalOperator.AND);&lt;/div&gt;else if(b.NodeType== ExpressionType.OrElse)&lt;div style="margin-left:20pt"&gt;return Add(b, filter, ADLogicalOperator.OR);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;return Add(b.Left,GetOperator(b.NodeType),b.Right,filter);&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;br&gt;if (e is MethodCallExpression)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;var m = e as MethodCallExpression;&lt;br&gt;var name = m.Method.Name;&lt;br&gt;if (m.Arguments.Count == 1)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (name == &amp;quotEquals&amp;quot)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return Add(m, Operator.Equals, m.Arguments[0], filter);&lt;/div&gt;}&lt;br&gt;if (m.Arguments[0].Type == typeof(string))&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;string val =(string) (m.Arguments[0] as ConstantExpression).Value;&lt;br&gt;if (name == &amp;quotStartsWith&amp;quot)&lt;div style="margin-left:20pt"&gt;val += &amp;quot*&amp;quot;&lt;/div&gt;else if (name == &amp;quotEndsWith&amp;quot)&lt;div style="margin-left:20pt"&gt;val = &amp;quot*&amp;quot + val;&lt;/div&gt;else if (name == &amp;quotContains&amp;quot)&lt;div style="margin-left:20pt"&gt;val = &amp;quot*&amp;quot + val + &amp;quot*&amp;quot;&lt;/div&gt;else&lt;div style="margin-left:20pt"&gt;val = null;&lt;/div&gt;if(val!=null)&lt;div style="margin-left:20pt"&gt;return Add(m, Operator.Equals, val, filter);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;br&gt;throw new NotSupportedException();&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;bool Add(Expression prop, Operator op, object value, ADFilter filter)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;filter.Add(&lt;div style="margin-left:40pt"&gt;new ADCriterium(&lt;div style="margin-left:20pt"&gt;GetProperty(prop), op, GetValue(value)));&lt;/div&gt;&lt;/div&gt;return true;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;bool Add(BinaryExpression b, ADFilter filter, ADLogicalOperator op)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (op != filter.LogicalOperator)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;filter.Add(filter = new ADFilter());&lt;br&gt;filter.LogicalOperator = op;&lt;/div&gt;}&lt;br&gt;return Add(b.Left, filter)&lt;div style="margin-left:20pt"&gt;&amp;amp&amp;amp Add(b.Right, filter);&lt;/div&gt;&lt;/div&gt;}&lt;br&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;string GetProperty(Expression e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (e is MethodCallExpression)&lt;br&gt;{&lt;br&gt;}&lt;br&gt;if (e is LambdaExpression)&lt;div style="margin-left:20pt"&gt;return GetProperty((e as LambdaExpression).Body);&lt;/div&gt;if (e is MemberExpression)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;var mi = (e as MemberExpression).Member;&lt;br&gt;foreach (ActiveDirectoryAliasAttribute alias in&lt;div style="margin-left:20pt"&gt;mi.GetCustomAttributes(typeof(ActiveDirectoryAliasAttribute),true))&lt;/div&gt;{&lt;div style="margin-left:20pt"&gt;return alias.Alias;&lt;/div&gt;}&lt;br&gt;return mi.Name;&lt;/div&gt;}&lt;br&gt;if (e is MethodCallExpression)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return GetProperty((e as MethodCallExpression).Object);&lt;/div&gt;}&lt;br&gt;throw new NotSupportedException();&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;object GetValue(object e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (e is Expression)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (e is ConstantExpression)&lt;div style="margin-left:20pt"&gt;return (e as ConstantExpression).Value;&lt;/div&gt;throw new NotSupportedException();&lt;/div&gt;}&lt;br&gt;return e;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;Operator GetOperator(ExpressionType type)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;if (type == ExpressionType.Equal || type== ExpressionType.NotEqual)&lt;div style="margin-left:20pt"&gt;return Operator.Equals;&lt;/div&gt;if (type == ExpressionType.LessThan)&lt;div style="margin-left:20pt"&gt;return Operator.LessThan;&lt;/div&gt;if (type == ExpressionType.LessThanOrEqual)&lt;div style="margin-left:20pt"&gt;return Operator.LessThan | Operator.Equals;&lt;/div&gt;if (type == ExpressionType.GreaterThan)&lt;div style="margin-left:20pt"&gt;return Operator.GreaterThan;&lt;/div&gt;if (type == ExpressionType.GreaterThanOrEqual)&lt;div style="margin-left:20pt"&gt;return Operator.GreaterThan | Operator.Equals;&lt;/div&gt;throw new NotSupportedException();&lt;/div&gt;}&lt;br&gt;&lt;br&gt;public IEnumerable&amp;ltActiveDirectoryEntry&amp;gt Select(Expression&amp;ltFunc&amp;ltT,ADQuery&amp;ltT&amp;gt&amp;gt&amp;gt selector)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;return inf;&lt;/div&gt;}&lt;br&gt;&lt;br&gt;public IEnumerable&amp;ltS&amp;gt Select&amp;ltS&amp;gt(Expression&amp;ltFunc&amp;ltT, S&amp;gt&amp;gt selector)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;var ne = (selector as LambdaExpression).Body as NewExpression;&lt;br&gt;if (ne != null)&lt;div style="margin-left:20pt"&gt;return Select&amp;ltS&amp;gt(ne);&lt;/div&gt;return Select&amp;ltS&amp;gt(GetProperty(selector));&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;IEnumerable&amp;ltS&amp;gt Select&amp;ltS&amp;gt(string prop)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;inf.AddLoadProperty(prop);&lt;br&gt;foreach (var entry in inf)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;yield return entry.GetValue&amp;ltS&amp;gt(prop);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;IEnumerable&amp;ltS&amp;gt Select&amp;ltS&amp;gt(NewExpression ne)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;string[] props = new string[ne.Arguments.Count];&lt;br&gt;object[] pars = new object[props.Length];&lt;br&gt;int i = 0;&lt;br&gt;foreach (Expression e in ne.Arguments)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;inf.AddLoadProperty( props[i++] = GetProperty(e));&lt;/div&gt;}&lt;br&gt;foreach (var entry in inf)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;for (i = 0; i &amp;lt props.Length; i++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pars[i] = entry[props[i]];&lt;/div&gt;}&lt;br&gt;S res =(S) ne.Constructor.Invoke(pars);&lt;br&gt;yield return res;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;public class ADQuery:ADQuery&amp;ltActiveDirectoryEntry&amp;gt&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;public ADQuery() :&lt;div style="margin-left:20pt"&gt;base()&lt;/div&gt;{&lt;br&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;public ADQuery(ADFilter filter):base(filter)&lt;br&gt;{&lt;br&gt;}&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;#endif&lt;br&gt;&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;[&lt;FONT Color=#2b91af&gt;AttributeUsage&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;AttributeTargets&lt;/FONT&gt;.Field | &lt;FONT Color=#2b91af&gt;AttributeTargets&lt;/FONT&gt;.Property)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryAliasAttribute&lt;/FONT&gt;:&lt;FONT Color=#2b91af&gt;Attribute&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Alias;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; ActiveDirectoryAliasAttribute(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Alias)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Alias = Alias;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;partial&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; UserInfo(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Name)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.name = Name;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The scope of this constructor is not made public because that would force projects&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; referencing the project with this code to have a reference to System.DirectoryServices.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Use GetInfo(ActiveDirectoryEntry) instead&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltparam name=&amp;quotActiveDirectoryEntry&amp;quot&amp;gt&amp;lt/param&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; UserInfo(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ActiveDirectoryEntry)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.ActiveDirectoryEntry = ActiveDirectoryEntry;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; AD&lt;FONT Color=#2b91af&gt;&lt;br&gt;ActiveDirectoryEntry&lt;/FONT&gt; adEntry;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ActiveDirectoryEntry&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;if&lt;/FONT&gt; (!HasActiveDirectoryEntry)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(name + &lt;FONT Color=#a31515&gt;&amp;quot&amp;nbsp&amp;nbspniet gevonden&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;return&lt;/FONT&gt; adEntry;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (adEntry == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;br&gt;adEntry = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;name = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HasActiveDirectoryEntry&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (adEntry == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp !&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(name))&lt;div style="margin-left:20pt"&gt;adEntry = Search(name);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; adEntry != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PropertyName]&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; ActiveDirectoryEntry[PropertyName]; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ActiveDirectoryEntry[PropertyName] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; NameSearchField = &lt;FONT Color=#a31515&gt;&amp;quotsAMAccountName&amp;quot&lt;/FONT&gt;;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; Search(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; name)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;();&lt;br&gt;filter.objectClass = &lt;FONT Color=#a31515&gt;&amp;quotuser&amp;quot&lt;/FONT&gt;;&lt;br&gt;filter[NameSearchField] = name;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetFirstEntry(filter);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;string&lt;/FONT&gt; name;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Name&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (name == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;name = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[NameSearchField].ToString();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; name;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt; GetCurrentUser()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;Environment&lt;/FONT&gt;.UserName);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt; GetInfo(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; ActiveDirectoryEntry)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt;(ActiveDirectoryEntry);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt; GetInfo(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Name)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt;(Name);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; GetDefaultUserGroupsFilter()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotuserPrincipalName&amp;quot&lt;/FONT&gt;, &lt;FONT Color=#a31515&gt;&amp;quot*&amp;quot&lt;/FONT&gt;); &lt;FONT Color=#008000&gt;//userPrincipalName = to prevent computers from being included&lt;/FONT&gt;&lt;br&gt;filter.ObjectClass = &lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.user;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; filter;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;IEnumerable&lt;/FONT&gt;&amp;lt&lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt;&amp;gt GetUsers()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; e &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; GetDefaultUserGroupsFilter().GetEntries())&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetInfo(e);&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Account&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetPassword(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PW)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SetPassword(PW, &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetPassword(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PW, &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; MustChangeAtNextLogin)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;// http://www.awprofessional.com/articles/article.asp?p=474649&amp;ampseqNum=4&amp;amprl=1&lt;/FONT&gt;&lt;br&gt;ActiveDirectoryEntry.Invoke(&lt;FONT Color=#a31515&gt;&amp;quotSetPassword&amp;quot&lt;/FONT&gt;, &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt;[] { PW });&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (MustChangeAtNextLogin)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotpwdLastSet&amp;quot&lt;/FONT&gt;] = 0x0;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;adEntry.CommitChanges();&lt;br&gt;adEntry.RefreshCache();&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AccountLocked&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.ActiveDirectoryEntry.InvokeGet(&lt;FONT Color=#a31515&gt;&amp;quotIsAccountLocked&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt;)o;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; prop_hidefromaddresslists = &lt;FONT Color=#a31515&gt;&amp;quotmsExchHideFromAddressLists&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HideFromAddressLists&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.ActiveDirectoryEntry.GetValue&amp;lt&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt;&amp;gt(prop_hidefromaddresslists);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.ActiveDirectoryEntry[prop_hidefromaddresslists] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt; GetHiddenFromAddressListFilter()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ADFilter&lt;/FONT&gt; filter = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ADFilter&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DefaultClass&lt;/FONT&gt;.user);&lt;br&gt;filter[prop_hidefromaddresslists] = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; filter;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; UnlockAccount()&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:60pt"&gt;//unlock account&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotLockOutTime&amp;quot&lt;/FONT&gt;] = 0x0000;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; property)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; ActiveDirectoryEntry[property] &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; GetDateTime(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Property)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.ActiveDirectoryEntry.GetValue&amp;lt&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;&amp;gt(Property);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Flags for the &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotActiveDirectoryEntry&amp;quot/&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &amp;quotuserAccountControl&amp;quot property flags&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;//http://support.microsoft.com/default.aspx?scid=kb;en-us;305144&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Flags&lt;/FONT&gt;]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccountFlags&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Run_Logon_Script = 0x0001,&lt;br&gt;ACCOUNTDISABLE = 0x0002,&lt;br&gt;HomeDirectory_REQUIRED = 0x0008,&lt;br&gt;LOCKOUT = 0x0010,&lt;br&gt;Password_Not_Required = 0x0020,&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Note You cannot assign this permission by directly modifying the UserAccountControl attribute. For information about how to set the permission programmatically, see the &amp;quotProperty flag descriptions&amp;quot section on http://support.microsoft.com/default.aspx?scid=kb;en-us;305144&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;br&gt;PASSWD_CANT_CHANGE = 0x0040,&lt;br&gt;ENCRYPTED_TEXT_PWD_ALLOWED = 0x0080,&lt;br&gt;TEMP_DUPLICATE_ACCOUNT = 0x0100,&lt;br&gt;NORMAL_ACCOUNT = 0x0200,&lt;br&gt;INTERDOMAIN_TRUST_ACCOUNT = 0x0800,&lt;br&gt;WORKSTATION_TRUST_ACCOUNT = 0x1000,&lt;br&gt;SERVER_TRUST_ACCOUNT = 0x2000,&lt;br&gt;DONT_EXPIRE_PASSWORD = 0x10000,&lt;br&gt;MNS_LOGON_ACCOUNT = 0x20000,&lt;br&gt;SMARTCARD_REQUIRED = 0x40000,&lt;br&gt;TRUSTED_FOR_DELEGATION = 0x80000,&lt;br&gt;NOT_DELEGATED = 0x100000,&lt;br&gt;USE_DES_KEY_ONLY = 0x200000,&lt;br&gt;DONT_REQ_PREAUTH = 0x400000,&lt;br&gt;PASSWORD_EXPIRED = 0x800000,&lt;br&gt;TRUSTED_TO_AUTH_FOR_DELEGATION = 0x1000000,&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AccountEnabled&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;return&lt;/FONT&gt; (AccountStatus &amp;amp &lt;FONT Color=#2b91af&gt;AccountFlags&lt;/FONT&gt;.ACCOUNTDISABLE) == 0;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;AccountFlags&lt;/FONT&gt; AccountStatus&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;AccountFlags&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotuserAccountControl&amp;quot&lt;/FONT&gt;];&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotuserAccountControl&amp;quot&lt;/FONT&gt;] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;br&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Mail&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotmail&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Mail&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotmail&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; altRecipient = &lt;FONT Color=#a31515&gt;&amp;quotaltRecipient&amp;quot&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(altRecipient)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsMailForwarded&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[altRecipient] != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt; CreateUserInstance(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; de)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt;(de);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;UserInfo&lt;/FONT&gt; MailForwardedTo&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; path = GetStringValue(altRecipient);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (path == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;path = ActiveDirectoryEntry.Prefix + path;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!&lt;FONT Color=#2b91af&gt;DirectoryEntry&lt;/FONT&gt;.Exists(path))&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(path + &lt;FONT Color=#a31515&gt;&amp;quot does not exist&amp;quot&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; CreateUserInstance(&lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt;(path));&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;[altRecipient] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; ? &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; : &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.ActiveDirectoryEntry.Path.Replace(&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.ActiveDirectoryEntry.Prefix, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotdeliverAndRedirect&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; DeliverAndRedirect&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotdeliverAndRedirect&amp;quot&lt;/FONT&gt;];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt;)o;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotdeliverAndRedirect&amp;quot&lt;/FONT&gt;] = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;br&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; General properties&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quottelephoneNumber&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Telephone&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quottelephoneNumber&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotmsExchMailboxGuid&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Guid&lt;/FONT&gt; ExchangeMailBoxGuid&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotmsExchMailboxGuid&amp;quot&lt;/FONT&gt;];&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Guid&lt;/FONT&gt;((&lt;FONT Color=#0000ff&gt;byte&lt;/FONT&gt;[])o);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotsn&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; SurName&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotsn&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotgivenName&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; GivenName&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotgivenName&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotcn&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; FullName&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotcn&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotuserPrincipalName&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; PrincipalName&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotuserPrincipalName&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotprofilePath&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ProfilePath&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotprofilePath&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotscriptPath&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; LogonScript&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotscriptPath&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotscriptPath&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ScriptPath&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; GetStringValue(&lt;FONT Color=#a31515&gt;&amp;quotscriptPath&amp;quot&lt;/FONT&gt;); }&lt;/div&gt;}&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotlockoutTime&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; LockoutTime&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDateTime(&lt;FONT Color=#a31515&gt;&amp;quotlockoutTime&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;}&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotpwdLastSet&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; PasswordLastSet&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDateTime(&lt;FONT Color=#a31515&gt;&amp;quotpwdLastSet&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;ActiveDirectoryAlias&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotdisplayName&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; DescriptiveName&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;object&lt;/FONT&gt; o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotdisplayName&amp;quot&lt;/FONT&gt;];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (o == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;o = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;[&lt;FONT Color=#a31515&gt;&amp;quotcn&amp;quot&lt;/FONT&gt;];&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; o.ToString();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Container&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; ActiveDirectoryEntry.Parent.GetValue&amp;lt&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&amp;gt(&lt;FONT Color=#a31515&gt;&amp;quotou&amp;quot&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; Name;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;br&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Group membership&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsMemberOf(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Group)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; ActiveDirectoryEntry.IsMemberOf(Group);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsMemberOf(&lt;FONT Color=#2b91af&gt;ActiveDirectoryEntry&lt;/FONT&gt; group)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; ActiveDirectoryEntry.IsMemberOf(group);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; MakeMemberOf(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Group)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (IsMemberOf(Group)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;ActiveDirectoryEntry&lt;/FONT&gt; de = &lt;FONT Color=#2b91af&gt;ActiveDirectory&lt;/FONT&gt;.GetSecurityGroup(Group);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (de == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotGroup not found&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;de.Invoke(&lt;FONT Color=#a31515&gt;&amp;quotAdd&amp;quot&lt;/FONT&gt;, &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.ActiveDirectoryEntry.Entry.Path);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;br&gt;}&lt;FONT Color=#008000&gt;&lt;br&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV Style=" Display='none'; BackGround-Color=#dcdcdc;" OnDblClick="var o = parentNode.firstChild;o.sel =1;o.click()"&gt;&lt;b&gt; . . .&lt;/b&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/8489.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>Not another date time picker control</title><link>http://blogs.vbcity.com/hotdog/archive/2007/04/04/8219.aspx</link><pubDate>Wed, 04 Apr 2007 03:25:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2007/04/04/8219.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/8219.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2007/04/04/8219.aspx#Feedback</comments><slash:comments>83</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/8219.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/8219.aspx</trackback:ping><description>&lt;P&gt;Another one? Yep, I'm&amp;nbsp;afraid&amp;nbsp;it is just that: another date time picker control. I was using the default datetimepicker provided in the .net framework and liked a lot of its default features, but, like others, came upon some issues that made the dayly use of&amp;nbsp; it unacceptable for the target audience.&amp;nbsp;&lt;BR&gt;&lt;BR&gt;The control itself is very simple, the .net 2.0 maskededitbox does most of the work, but the way the format is handled makes sure the input can take any part entered (eg only month and year, or just a day, or just a time). One of the things I liked about the standard control was the 'block' functionality to quickly switch between day,month, etc, so that feature had to&amp;nbsp;added too. Of course the default calendar dropdown is also&amp;nbsp;included.&lt;/P&gt;
&lt;P&gt;While typing and filling a block (eg, the day), the next block (eg, the month) is selected automatically. Up and down arrows work as in the standard control: increasing or decreasing the selected block, but unlike the standard counterpart, the days are not forced to a value range (in this version, the range isn't forced at all...). Also didn't like to use a checkbox to indicate null as in the standard control, so null now is simply no input. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;


&lt;!-- --Start of code block
--&gt;&lt;DIV Style=" Border='1px #000080 solid'; Margin-Left=10pt; Margin-Right=2pt;" OnKeyDown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;&amp; i&lt;ch.selcount){ch.sel=i;ch.click();}"&gt;&lt;DIV Style=" Font-Size=9pt; Font-Family='Microsoft Sans Serif'; Border-Bottom='1px #000080 solid';" OnClick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'400pt':null;if(i==1&amp;&amp; ch.offsetHeight&gt;h)ch.style.height=h;" sel=1 selold=1 selcount=3&gt;&lt;b&gt;  Code &lt;/b&gt;&lt;a href="javascript:" Style=" Margin-Left=10pt; Margin-Right=10pt;" OnClick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');"&gt;Copy&lt;/a&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=0"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Hide&lt;/SPAN&gt;&lt;SPAN Style=" Font-Weight=bolder; Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=1"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();" Checked=True&gt;Scroll&lt;/SPAN&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=2"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;&lt;DIV Style=" BackGround-Color=#dcdcdc; overflow='auto'; Height=400pt;"&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;namespace&lt;/FONT&gt; DataLayer.Controls&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;using&lt;/FONT&gt; System;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Text;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.ComponentModel;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Windows.Forms;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Drawing;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Globalization;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;[&lt;FONT Color=#2b91af&gt;DefaultBindingProperty&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotBindingValue&amp;quot&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultEvent&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotBindingValueChanged&amp;quot&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;ToolboxBitmap&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;typeof&lt;/FONT&gt;(System.Windows.Forms.&lt;FONT Color=#2b91af&gt;DateTimePicker&lt;/FONT&gt;))]&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;partial&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTimePicker&lt;/FONT&gt;:&lt;FONT Color=#2b91af&gt;UserControl&lt;/FONT&gt;&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; DateTimePicker()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;InitializeComponent();&lt;br&gt;ResetFormat();&lt;/div&gt;}&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;#region&lt;/FONT&gt; Formatting&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; DefaultFormat;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MaskFormatInfo&lt;/FONT&gt;&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Format;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Mask;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ContainsTime;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ContainsDate;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; MaskFormatInfo(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; DateTimeFormat)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;const&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; dtchars = &lt;FONT Color=#a31515&gt;&amp;quotdMyHhms&amp;quot&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;char&lt;/FONT&gt;[] fchars = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt;[DateTimeFormat.Length * 2], mchars = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt;[fchars.Length];&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; j = 0, index;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt DateTimeFormat.Length; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;char&lt;/FONT&gt; c = DateTimeFormat[i];&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (c == &lt;FONT Color=#a31515&gt;'\\'&lt;/FONT&gt; &amp;amp&amp;amp i &amp;lt DateTimeFormat.Length - 1)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;fchars[j] = mchars[j++] = c;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; ((index = dtchars.IndexOf(c)) != -1)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//ensure double entries to enable full user input&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; k = 0; k &amp;lt 2; k++)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;fchars[j] = c;&lt;br&gt;mchars[j++] = &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (i &amp;lt DateTimeFormat.Length - 1 &amp;amp&amp;amp DateTimeFormat[i + 1] == c) i++;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (index &amp;gt 2)&lt;div style="margin-left:20pt"&gt;ContainsTime = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;ContainsDate = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:120pt"&gt;continue&lt;/FONT&gt;;&lt;/div&gt;&lt;div style="margin-left:100pt"&gt;}&lt;br&gt;fchars[j] = mchars[j++] = c;&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Format = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;(fchars, 0, j);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Mask = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;(mchars, 0, j);&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;br&gt;&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; format ;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Format&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; format; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;))&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ResetFormat();&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#2b91af&gt;&lt;br&gt;MaskFormatInfo&lt;/FONT&gt; mf = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MaskFormatInfo&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;);&lt;br&gt;format = mf.Format;&lt;br&gt;msk.Mask = mf.Mask;&lt;br&gt;pnlButton.Visible = showdropdown &amp;amp&amp;amp mf.ContainsDate;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; ShouldSerializeFormat()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; !UsesDefaultFormat;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ResetFormat()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DateTimeFormatInfo&lt;/FONT&gt; formatinfo = &lt;FONT Color=#2b91af&gt;DateTimeFormatInfo&lt;/FONT&gt;.CurrentInfo;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; format = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (showdate)&lt;div style="margin-left:20pt"&gt;format = formatinfo.ShortDatePattern;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (showtime)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (showdate) format += dtseperator;&lt;br&gt;format += formatinfo.ShortTimePattern;&lt;/div&gt;}&lt;br&gt;Format = format;&lt;br&gt;DefaultFormat = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.format;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; UsesDefaultFormat&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; format == DefaultFormat;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; dtseperator=&lt;FONT Color=#a31515&gt;&amp;quot &amp;quot&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quot &amp;quot&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotThis seperator used between date and time if both are shown. If a custom Format is set, this property is ignored&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; SeperatorDateTime&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; dtseperator; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;bool&lt;/FONT&gt; hasdefault = UsesDefaultFormat;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;))&lt;div style="margin-left:20pt"&gt;dtseperator = &lt;FONT Color=#a31515&gt;&amp;quot &amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;dtseperator = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (hasdefault) ResetFormat();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; showdate=&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotGets or sets if the Date part is shown. If a custom Format is set, this property is ignored&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ShowDate&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; showdate; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;bool&lt;/FONT&gt; hasdefault = UsesDefaultFormat;&lt;br&gt;showdate = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; &amp;amp&amp;amp !showtime) showtime = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (hasdefault) ResetFormat();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; showtime = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotGets or sets if the Time part is shown. If a custom Format is set, this property is ignored&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ShowTime&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; showtime; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;bool&lt;/FONT&gt; hasdefault = UsesDefaultFormat;&lt;br&gt;showtime = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; &amp;amp&amp;amp !showdate) showdate= &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (hasdefault) ResetFormat();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;.Hidden)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Browsable&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Text&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; msk.Text;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;msk.Text = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Value&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;? value;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Browsable&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;( &lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;.Hidden)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; Value&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (value == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (IsValid || DesignMode) &lt;FONT Color=#008000&gt;//if IsValid: null allowed, return minvalue to prevent exceptions&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; minvalue;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotNo valid value entered&amp;quot&lt;/FONT&gt;);&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; value.Value;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.value = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Text = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.ToString(format);&lt;br&gt;SetValid();&lt;br&gt;OnValueChanged();&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&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;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt; ValueChanged;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnValueChanged()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;OnBindingValueChanged();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (ValueChanged != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;ValueChanged(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt;.Empty);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:40pt"&gt;//[Browsable(false)]&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;( &lt;FONT Color=#2b91af&gt;DesignerSerializationVisibility&lt;/FONT&gt;.Hidden)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;TypeConverter&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;typeof&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;DateTimePicker&lt;/FONT&gt;.&lt;FONT Color=#2b91af&gt;BindingValueConverter&lt;/FONT&gt;))]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Editor&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotSystem.ComponentModel.Design.DateTimeEditor&amp;quot&lt;/FONT&gt;,&lt;FONT Color=#a31515&gt;&amp;quotSystem.Drawing.Design.UITypeEditor&amp;quot&lt;/FONT&gt;)] &lt;FONT Color=#008000&gt;//,typeof(UITypeEditor))]&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;? BindingValue&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; value;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.value == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;Value = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;.Value;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.value = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;msk.Text = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;SetValid();&lt;br&gt;OnBindingValueChanged();&lt;/div&gt;}&lt;br&gt;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; ShouldSerializeBindingValue()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; value != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ResetBindingValue()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.BindingValue = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt; BindingValueChanged;&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;virtual&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnBindingValueChanged()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (BindingValueChanged != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;BindingValueChanged(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt;.Empty);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; allownull;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; AllowNull&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; allownull;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;allownull = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;SetValid();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsNull&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; value==&lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Designer Generated&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MaskedTextBox&lt;/FONT&gt; msk;&lt;FONT Color=#0000ff&gt;&lt;br&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Panel&lt;/FONT&gt; pnlButton;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; InitializeComponent()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.msk = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Windows.Forms.&lt;FONT Color=#2b91af&gt;MaskedTextBox&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Windows.Forms.&lt;FONT Color=#2b91af&gt;Panel&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.SuspendLayout();&lt;FONT Color=#008000&gt;&lt;br&gt;// &lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;// msk&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;// &lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Dock = &lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Fill;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.BorderStyle = System.Windows.Forms.&lt;FONT Color=#2b91af&gt;BorderStyle&lt;/FONT&gt;.None;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.HidePromptOnLeave = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Location = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Drawing.&lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;(3, 2);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Mask = &lt;FONT Color=#a31515&gt;&amp;quot00/00/0000&amp;nbsp&amp;nbsp&amp;nbsp00:00&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Name = &lt;FONT Color=#a31515&gt;&amp;quotmsk&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.PromptChar = &lt;FONT Color=#a31515&gt;' '&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Size = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Drawing.&lt;FONT Color=#2b91af&gt;Size&lt;/FONT&gt;(104, 13);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.TabIndex = 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.TextAlign = &lt;FONT Color=#2b91af&gt;HorizontalAlignment&lt;/FONT&gt;.Center;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.ValidatingType = &lt;FONT Color=#0000ff&gt;typeof&lt;/FONT&gt;(System.&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Validating += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.ComponentModel.&lt;FONT Color=#2b91af&gt;CancelEventHandler&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.msk_Validating);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.KeyUp += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Windows.Forms.&lt;FONT Color=#2b91af&gt;KeyEventHandler&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.msk_KeyUp);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.msk.Click += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.&lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.msk_Click);&lt;FONT Color=#008000&gt;&lt;br&gt;// &lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;// pnlButton&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;// &lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.BackColor = System.Drawing.&lt;FONT Color=#2b91af&gt;SystemColors&lt;/FONT&gt;.Control;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.Dock = System.Windows.Forms.&lt;FONT Color=#2b91af&gt;DockStyle&lt;/FONT&gt;.Right;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.Location = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Drawing.&lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;(98, 0);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.Name = &lt;FONT Color=#a31515&gt;&amp;quotpnlButton&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.Size = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Drawing.&lt;FONT Color=#2b91af&gt;Size&lt;/FONT&gt;(19, 18);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.TabIndex = 1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.Click += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.&lt;FONT Color=#2b91af&gt;EventHandler&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.pnlButton_Click);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.pnlButton.Paint += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Windows.Forms.&lt;FONT Color=#2b91af&gt;PaintEventHandler&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.pnlButton_Paint);&lt;FONT Color=#008000&gt;&lt;br&gt;// &lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;// DateTimePicker&lt;/FONT&gt;&lt;FONT Color=#008000&gt;&lt;br&gt;// &lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.BackColor = System.Drawing.&lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.White;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.BorderStyle = System.Windows.Forms.&lt;FONT Color=#2b91af&gt;BorderStyle&lt;/FONT&gt;.FixedSingle;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Controls.Add(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.msk);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Controls.Add(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.pnlButton);&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;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Name = &lt;FONT Color=#a31515&gt;&amp;quotDateTimePicker&amp;quot&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Padding = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Windows.Forms.&lt;FONT Color=#2b91af&gt;Padding&lt;/FONT&gt;(3, 0, 0, 0);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Size = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; System.Drawing.&lt;FONT Color=#2b91af&gt;Size&lt;/FONT&gt;(117, 18);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.ResumeLayout(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.PerformLayout();&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Calendar dropdown&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; pnlButton_Paint(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;PaintEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;ControlPaint&lt;/FONT&gt;.DrawComboButton(e.Graphics, pnlButton.ClientRectangle,&lt;div style="margin-left:20pt"&gt; &lt;FONT Color=#2b91af&gt;ButtonState&lt;/FONT&gt;.Normal);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; pnlButton_Click(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ShowCalendar();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; ShowCalendar()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MontViewer&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;).Show(&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; showdropdown=&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotGets or sets if the dropdown button is shown. If the format contains no date part, the button is always hidden&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ShowDropDownButton&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; showdropdown; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (showdropdown == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;br&gt;showdropdown = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;Format = format;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Drop down calendar form for the DateTimePicker&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;lt/summary&amp;gt&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MontViewer&lt;/FONT&gt;:&lt;FONT Color=#2b91af&gt;Form&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTimePicker&lt;/FONT&gt; Owner;&lt;FONT Color=#2b91af&gt;&lt;br&gt;MonthCalendar&lt;/FONT&gt; mc = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;MonthCalendar&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; MontViewer(&lt;FONT Color=#2b91af&gt;DateTimePicker&lt;/FONT&gt; Owner)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Owner = Owner;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.FormBorderStyle = &lt;FONT Color=#2b91af&gt;FormBorderStyle&lt;/FONT&gt;.None;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;this&lt;/FONT&gt;.ShowInTaskbar = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.KeyPreview = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:80pt"&gt;this&lt;/FONT&gt;.Size = mc.Size;&lt;br&gt;Controls.Add(mc);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!Owner.IsNull)&lt;div style="margin-left:20pt"&gt;mc.SelectionStart = mc.SelectionEnd = Owner.Value;&lt;/div&gt;mc.DateSelected += &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateRangeEventHandler&lt;/FONT&gt;(mc_DateSelected);&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:80pt"&gt;Rectangle&lt;/FONT&gt; r = Owner.RectangleToScreen(Owner.ClientRectangle);&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.StartPosition = &lt;FONT Color=#2b91af&gt;FormStartPosition&lt;/FONT&gt;.Manual;&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.Location = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Point&lt;/FONT&gt;(r.Right - Width, r.Bottom);&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnKeyDown(&lt;FONT Color=#2b91af&gt;KeyEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (e.KeyCode == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Escape)&lt;div style="margin-left:20pt"&gt;Close();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (e.KeyCode == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Enter || e.KeyCode == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Space)&lt;div style="margin-left:20pt"&gt;EnterDate();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;base&lt;/FONT&gt;.OnKeyDown(e);&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; EnterDate()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DateTime&lt;/FONT&gt; res = mc.SelectionStart;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!Owner.IsNull)&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//make sure time part is not overwritten&lt;/FONT&gt;&lt;br&gt;res = res.Add(Owner.Value.TimeOfDay);&lt;/div&gt;Owner.Value = res;&lt;br&gt;Close();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;void&lt;/FONT&gt; mc_DateSelected(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;DateRangeEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;EnterDate();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnDeactivate(&lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;base&lt;/FONT&gt;.OnDeactivate(e);&lt;br&gt;Close();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnClosed(&lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Owner.Focus();&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.OnClosed(e);&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Validation&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsValid&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (value != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; InBounds;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (allownull &amp;amp&amp;amp &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(text)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; InBounds&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; value.Value &amp;gt= minvalue &amp;amp&amp;amp value.Value &amp;lt= max;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; SetValid()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (DesignMode) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#2b91af&gt;&lt;br&gt;Color&lt;/FONT&gt; c;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (IsValid)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (IsNull)&lt;div style="margin-left:20pt"&gt;c = &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.AntiqueWhite;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;c = &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.White;&lt;/div&gt;lastException = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (value != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;amp&amp;amp !InBounds)&lt;div style="margin-left:20pt"&gt;c = &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.Orange;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;c = &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.DarkOrange;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;this&lt;/FONT&gt;.BackColor = c;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:40pt"&gt;Exception&lt;/FONT&gt; lastException;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; text;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; msk_Validating(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;CancelEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ValidateInput();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (blockinvalid &amp;amp&amp;amp !IsValid)&lt;div style="margin-left:20pt"&gt;e.Cancel = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; ValidateInput()&lt;br&gt;{&lt;FONT Color=#2b91af&gt;&lt;div style="margin-left:20pt"&gt;DateTime&lt;/FONT&gt;? value = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;text = msk.Text;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(text))&lt;br&gt;{&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;br&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;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; format = &lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.format;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!msk.MaskFull)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;char&lt;/FONT&gt;[] textchars = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt;[format.Length],&lt;div style="margin-left:20pt"&gt;formatchars = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt;[textchars.Length];&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:120pt"&gt;int&lt;/FONT&gt; ci = 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 0; i &amp;lt text.Length; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt;.IsDigit(text[i]))&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;textchars[ci] = text[i];&lt;br&gt;formatchars[ci++] = format[i];&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:120pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:120pt"&gt;if&lt;/FONT&gt; (ci &amp;gt 0)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//check for single input chars&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; samecount = 1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 1; i &amp;lt= ci; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (formatchars[i] != formatchars[i - 1])&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (samecount == 1)&lt;br&gt;{&lt;FONT Color=#008000&gt;&lt;div style="margin-left:20pt"&gt;//insert extra&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; j = ci++; j &amp;gt= i; j--)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;formatchars[j] = formatchars[j - 1];&lt;br&gt;textchars[j] = textchars[j - 1];&lt;/div&gt;}&lt;br&gt;textchars[i - 1] = &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:200pt"&gt;i++;&lt;/div&gt;&lt;div style="margin-left:180pt"&gt;}&lt;br&gt;samecount = 1;&lt;/div&gt;&lt;div style="margin-left:160pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;samecount++;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:140pt"&gt;}&lt;/div&gt;&lt;div style="margin-left:140pt"&gt;text = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;(textchars, 0, ci);&lt;br&gt;format = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;(formatchars, 0, ci);&lt;/div&gt;&lt;div style="margin-left:120pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;div style="margin-left:20pt"&gt;text = format = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-left:100pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (text != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;value = &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.ParseExact(text, format, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (usecurrentmonth &amp;amp&amp;amp format.IndexOf(&lt;FONT Color=#a31515&gt;'M'&lt;/FONT&gt;) == -1)&lt;div style="margin-left:20pt"&gt;value = value.Value.AddMonths(&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.Today.Month - 1);&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:80pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt;(&lt;FONT Color=#2b91af&gt;Exception&lt;/FONT&gt; ex)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;lastException = ex;&lt;br&gt;value = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (value != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Value = value.Value;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;this&lt;/FONT&gt;.value != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.value = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;br&gt;OnValueChanged();&lt;/div&gt;}&lt;br&gt;SetValid();&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; blockinvalid = &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotNormally invalid input is allowed but indicated as invalid. If this property is set to true, focus is held until the user enters a valid date&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; BlockInvalidInput&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; blockinvalid; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { blockinvalid = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; DefaultMin = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;(1950, 1, 1);&lt;FONT Color=#0000ff&gt;&lt;br&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; minvalue = DefaultMin;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; MinDate&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; minvalue; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;minvalue = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;SetValid();&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; ShouldSerializeMinDate()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; minvalue != DefaultMin;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; ResetMinDate()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;MinDate= DefaultMin;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;static&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; DefaultMax = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;(2500, 12, 31);&lt;FONT Color=#0000ff&gt;&lt;br&gt;private&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; max = DefaultMax;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt; MaxDate&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; max; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;max = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;SetValid();&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; ShouldSerializeMaxDate()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; max != DefaultMax;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;void&lt;/FONT&gt; ResetMaxDate()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;MaxDate = DefaultMax;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; date block handling&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; SelectBlock(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Offset)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; pos = msk.SelectionStart;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; mask = msk.Mask;&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;int&lt;/FONT&gt; len = 1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;while&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (pos &amp;gt= mask.Length)&lt;div style="margin-left:20pt"&gt;pos = mask.Length - 1;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;while&lt;/FONT&gt; (pos &amp;gt 0 &amp;amp&amp;amp mask[pos - 1] == &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;--pos;&lt;/div&gt;len = 1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;while&lt;/FONT&gt; (len + pos &amp;lt mask.Length &amp;amp&amp;amp mask[len + pos] == &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;len++;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (Offset &amp;gt 0)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pos += len + 1;&lt;FONT Color=#0000ff&gt;&lt;br&gt;while&lt;/FONT&gt; (pos &amp;lt mask.Length &amp;amp&amp;amp mask[pos] != &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;)&lt;div style="margin-left:20pt"&gt;pos++;&lt;/div&gt;Offset--;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (Offset &amp;lt 0)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;while&lt;/FONT&gt; (--pos &amp;gt= 0 &amp;amp&amp;amp mask[pos] != &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;) { }&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (pos &amp;lt= 0)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;pos = 0;&lt;FONT Color=#0000ff&gt;&lt;br&gt;break&lt;/FONT&gt;;&lt;/div&gt;}&lt;br&gt;Offset++;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;break&lt;/FONT&gt;;&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;div style="margin-left:60pt"&gt;msk.Select(pos, len);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; IncCurrent(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; diff)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SelectBlock();&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; text = msk.SelectedText.Trim();&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;int&lt;/FONT&gt; cur = text.Length == 0 ? 0 : &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt;.Parse(text);&lt;br&gt;cur += diff;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (cur &amp;lt 0)&lt;div style="margin-left:20pt"&gt;cur = 0;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;int&lt;/FONT&gt; start = msk.SelectionStart, len = msk.SelectionLength;&lt;br&gt;msk.SelectedText = cur.ToString(&lt;FONT Color=#a31515&gt;&amp;quotd&amp;quot&lt;/FONT&gt; + len);&lt;br&gt;msk.Select(start, len);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; ui events&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; ProcessCmdKey(&lt;FONT Color=#0000ff&gt;ref&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Message&lt;/FONT&gt; msg, &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt; keyData)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (HandleKey(keyData)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;.ProcessCmdKey(&lt;FONT Color=#0000ff&gt;ref&lt;/FONT&gt; msg, keyData);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IsInputKey(&lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt; keyData)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (keyData == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Left || keyData == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Right)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (useupdown &amp;amp&amp;amp (keyData == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Up || keyData == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Down))&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;.IsInputKey(keyData);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; HandleKey(&lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt; k)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.F3 || k == (&lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Control | &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Down))&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ShowCalendar();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (useupdown &amp;amp&amp;amp (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Up || k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Down))&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;IncCurrent(k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Up ? 1 : -1);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Add)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;IncCurrent(1);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Subtract)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;IncCurrent(-1);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Left || k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Right)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SelectBlock(k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Right ? 1 : -1);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (IsDigit(k) &amp;amp&amp;amp msk.SelectionLength &amp;gt 1)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;clearblock();&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Delete || k==&lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Back)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;clearblock();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == (&lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.T | &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Control))&lt;div style="margin-left:20pt"&gt;SetToday();&lt;FONT Color=#0000ff&gt;&lt;/div&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Enter)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Validate();&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.End)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;msk.SelectionStart = format.Length - 1;&lt;br&gt;SelectBlock();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;if&lt;/FONT&gt; (k == &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.Home)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;msk.SelectionStart = 0;&lt;br&gt;SelectBlock();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; clearblock()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; i = msk.SelectionStart;&lt;br&gt;msk.SelectedText = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;' '&lt;/FONT&gt;, msk.SelectionLength);&lt;br&gt;msk.SelectionStart = i;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetToday()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Value = &lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;.Today;&lt;br&gt;msk.SelectionStart = 0;&lt;br&gt;SelectBlock();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; msk_Click(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SelectBlock();&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; msk_KeyUp(&lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; sender, &lt;FONT Color=#2b91af&gt;KeyEventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (msk.SelectionLength == 0 &amp;amp&amp;amp IsDigit(e.KeyCode))&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; i = msk.SelectionStart;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (i &amp;lt msk.Mask.Length &amp;amp&amp;amp msk.Mask[i] != &lt;FONT Color=#a31515&gt;'0'&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SelectBlock(1);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;bool&lt;/FONT&gt; IsDigit(&lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt; k)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (k &amp;gt= &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.D0 &amp;amp&amp;amp k &amp;lt= &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.D9)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; k &amp;gt= &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.NumPad0 &amp;amp&amp;amp k &amp;lt= &lt;FONT Color=#2b91af&gt;Keys&lt;/FONT&gt;.NumPad9;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;void&lt;/FONT&gt; SelectBlock()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SelectBlock(0);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; useupdown=&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotWhen this value is set to true, the up and down arrows are used to increment or decrement the selected value&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HandleUpDown&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; useupdown; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { useupdown = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; usecurrentmonth = &lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;;&lt;br&gt;[&lt;FONT Color=#2b91af&gt;DefaultValue&lt;/FONT&gt;(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;)]&lt;br&gt;[&lt;FONT Color=#2b91af&gt;Description&lt;/FONT&gt;(&lt;FONT Color=#a31515&gt;&amp;quotSpecifies that the current month should be used if no month was supplied.&amp;quot&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; UseCurrentMonth&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; usecurrentmonth; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt; { usecurrentmonth = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;protected&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; OnEnter(&lt;FONT Color=#2b91af&gt;EventArgs&lt;/FONT&gt; e)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;msk.Select();&lt;br&gt;msk.SelectionStart = 1;&lt;br&gt;SelectBlock();&lt;FONT Color=#0000ff&gt;&lt;br&gt;base&lt;/FONT&gt;.OnEnter(e);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt; BackColor&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;.BackColor;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;base&lt;/FONT&gt;.BackColor = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;br&gt;msk.BackColor = &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/div&gt;}&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;bool&lt;/FONT&gt; ShouldSerializeBackColor()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; BackColor != &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.White;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; ResetBackColor()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.BackColor = &lt;FONT Color=#2b91af&gt;Color&lt;/FONT&gt;.White;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Designer&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;class&lt;/FONT&gt; &lt;FONT Color=#2b91af&gt;BindingValueConverter&lt;/FONT&gt; : &lt;FONT Color=#2b91af&gt;DateTimeConverter&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; ConvertFrom(&lt;FONT Color=#2b91af&gt;ITypeDescriptorContext&lt;/FONT&gt; context, &lt;FONT Color=#2b91af&gt;CultureInfo&lt;/FONT&gt; culture, &lt;FONT Color=#0000ff&gt;object&lt;/FONT&gt; value)&lt;br&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;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (value &lt;FONT Color=#0000ff&gt;is&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; s = value &lt;FONT Color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(s)) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; (&lt;FONT Color=#2b91af&gt;DateTime&lt;/FONT&gt;?)&lt;FONT Color=#0000ff&gt;null&lt;/FONT&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;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;base&lt;/FONT&gt;.ConvertFrom(context, culture, value);&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;}&lt;br&gt;&lt;/DIV&gt;&lt;DIV Style=" Display='none'; BackGround-Color=#dcdcdc;" OnDblClick="var o = parentNode.firstChild;o.sel =1;o.click()"&gt;&lt;b&gt; . . .&lt;/b&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;

&lt;P&gt;PS. the main reasons the default didn't work for our scenario: &lt;/P&gt;
&lt;P&gt;- The day's maximum was forced by the chosen month. Now for the default American notation where the month is entered before the day, this doesn't pose a problem. But since our regional settings fill the day first, the number entered was dependant on the month set in a previous step. For example: if the date was set to the fourth of april and the user starts typing a new date over it, the day cannot go beyond 30. Now to enter may 31st, the user would have to change the month field first and then go back to the day, which is not acceptable for quick data entry. Worse than that: the day would be set to 30 and the user might not even notice. &lt;/P&gt;
&lt;P&gt;-The block did not switch to the next part when entering. When entering part of the date (eg. the day), the cursor would not jump to the next part (eg, the month) when filled. The user would have to press cursor keys first to switch. Again not acceptable for quick data entry. Now this is perhaps something that is solvable within the standard control, but didn't look into it that far, since the decision to create a new one had already been taken by that time ;-) &lt;/P&gt;
&lt;P&gt;-No null binding property. This is of course a very simple one to overcome since it could be added to an inherited version, but to mention it none the less: a nullable field should be bindable directly to a property. If that field can be null, the property would have to be able to take null. Since .net 2.0 has that great new nullable syntax (DateTime?), that was easily enough done :D &lt;/P&gt;
&lt;P&gt;-No Checkbox for null: this might be just personal preference, but for me null is nothing in the control and not changing a checkbox first. Besides that I had the feeling it would be confusing to use. Users might think that the date value was stored, but just not active or something of the kind. &lt;/P&gt;
&lt;P&gt;-Take strange dates. Since the source can be unknown data, the control would have to be able take faulty text or strange input. The control would of course have to indicate that it is wrong, but the user shouldn't be stuck until he chooses. As long as he chooses before the data is stored to the database. &lt;/P&gt;
&lt;P&gt;
&lt;HR id=null&gt;
--------update 20-7-7---------&lt;BR&gt;Some minor changes:&lt;BR&gt;-Culture dependant formatting. The default format is now set to whatever the culture's default setting is.&lt;BR&gt;-ShowTime and ShowDate properties. Using the default formatting, the date or time part can be hidden with these properties without fixing the format.&lt;BR&gt;-Made the bindingvalue editable in designer instead of value, so the start value can be reset to null&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/8219.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>FoxPro connection</title><link>http://blogs.vbcity.com/hotdog/archive/2007/02/08/8187.aspx</link><pubDate>Thu, 08 Feb 2007 14:43:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2007/02/08/8187.aspx</guid><wfw:comment>http://blogs.vbcity.com/hotdog/comments/8187.aspx</wfw:comment><comments>http://blogs.vbcity.com/hotdog/archive/2007/02/08/8187.aspx#Feedback</comments><slash:comments>79</slash:comments><wfw:commentRss>http://blogs.vbcity.com/hotdog/comments/commentRss/8187.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/hotdog/services/trackbacks/8187.aspx</trackback:ping><description>&lt;P&gt;This class is a wrapper round an oledb connection to FoxPro. Don't know if there's much need for one, but I've had need for it on several occasions allready ;-)&lt;BR&gt;FoxPro needs a set of specific tweaks to make it work with the default bindings and especially if you want to update, simply using the default data adapter won't work out of the box.&lt;BR&gt;The class uses the default .net OleDB providers, but the machine the code is used on will need to have the FoxPro provider installed. The VFPOLEDB can be downloaded from &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E1A87D8F-2D58-491F-A0FA-95A3289C5FD4&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=E1A87D8F-2D58-491F-A0FA-95A3289C5FD4&amp;amp;displaylang=en&lt;/A&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;
&lt;HR id=null&gt;
&lt;EM&gt;The code of the connection class: &lt;/EM&gt;&lt;A href="http://blogs.vbcity.com/upload/hotdog/FoxProConnection.htm"&gt;&lt;EM&gt;Source Code&lt;/EM&gt;&lt;/A&gt; 
&lt;HR id=null&gt;
&lt;/STRONG&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Usage is straight forward, create a connection. For example to connect to a folder:&lt;BR&gt;&lt;STRONG&gt;FoxProConnection conn = new FoxProConnection(&amp;#8221;c:\yourdatabasefolder&amp;#8221;);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Of course instead of the folder, you can also use a dbc file. To get data out of an sql string, you can simply use the GetData commands. These will return a QueryResult object rather than the table directly. The advantage of this, is that you can use that object to update later on. If you don't need it, simply read out the &lt;EM&gt;Table&lt;/EM&gt; property to get the table. Example:&lt;BR&gt;&lt;STRONG&gt;conn.GetData(&amp;#8221;select * from DbfName&amp;#8221;);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;To update, you have the choice to use the &lt;EM&gt;UpdateData &lt;/EM&gt;method of the connection object, or to use the returned QueryResult object to update. An example of the latter:&lt;BR&gt;&lt;STRONG&gt;QueryResult data = conn.GetData(&amp;#8221;select * from table1&amp;#8221;); &lt;BR&gt;&lt;/STRONG&gt;//you could also .net binding, for example: DataGridView1.DataSource =data;&lt;BR&gt;//...some edits to the data.Table&amp;nbsp;here&lt;BR&gt;&lt;STRONG&gt;data.Update();&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The above will work fine if the table has got a primary key set. In case it has not, you'll have to indicate which field(s) is the primary. This can also be doen with the queryresult object. &lt;BR&gt;For example, using the data object from above and table1 having a field named &amp;#8220;table1_key&amp;#8221;, &lt;EM&gt;before&lt;/EM&gt; the first update, set the keyfield:&lt;BR&gt;&lt;STRONG&gt;data.SetKeyField(&amp;#8221;table1_key&amp;#8221;);&lt;/STRONG&gt;&lt;/P&gt;&lt;/A&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/8187.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>Continuous Control</title><link>http://blogs.vbcity.com/hotdog/archive/2006/10/26/6568.aspx</link><pubDate>Thu, 26 Oct 2006 08:48:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2006/10/26/6568.aspx</guid><description>&lt;P&gt;In short: the continuous control is&amp;nbsp;a control that in the designer can take any control (or multiple controls) and when bound to a bindingsource shows it as list of that entity of controls. Those having used access know the concept as a subform.&lt;/P&gt;
&lt;P&gt;
&lt;HR id=null&gt;
&lt;STRONG&gt;Click here for the source code: &lt;A href="http://blogs.vbcity.com/hotdog/archive/2006/10/26/6567.aspx"&gt;http://blogs.vbcity.com/hotdog/archive/2006/10/26/6567.aspx&lt;/A&gt; &lt;/STRONG&gt;(last update 6/12/06) 
&lt;HR id=null&gt;

&lt;P&gt;For a Step by step quick example guide, &lt;A href="http://blogs.vbcity.com/upload/hotdog/continuouscontrol/QuickStartExample.html"&gt;click here&lt;/A&gt;&lt;BR&gt;&lt;FONT size=1&gt;(The quick quickversion: add this control to a form, add a bindingsource, set the bindingsource property of the control to that bindingsource, drop some controls onto the continuous control (make sure they have databindings to the same source if they need to updated per record) and you're set to go.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;If, by any chance you want to know about how the control came to be, (or if you're simply&amp;nbsp;have absolutely nothing interesting to do&amp;nbsp;;-) &amp;nbsp;), visit this link: &lt;A href="http://blogs.vbcity.com/hotdog/archive/2006/10/26/6571.aspx"&gt;http://blogs.vbcity.com/hotdog/archive/2006/10/26/6571.aspx&lt;/A&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;Sample code will follow later&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;
&lt;HR id=null&gt;
Screenshots:&lt;BR&gt;&lt;BR&gt;Designer view with some controls dropped onto it&lt;BR&gt;&lt;IMG src="/upload/hotdog/continuouscontrol/images/PanelSelected.jpg"&gt; &lt;BR&gt;Simple runtime: &lt;BR&gt;&lt;IMG src="/upload/hotdog/continuouscontrol/images/Runtime.jpg"&gt; 
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;runtime with some options enabled: &lt;BR&gt;&lt;IMG src="/upload/hotdog/continuouscontrol/images/RuntimeExtended.jpg"&gt; &lt;/P&gt;
&lt;P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Addition history&lt;BR&gt;1/12/06:&lt;BR&gt;* HeaderPanel option&lt;BR&gt;* LeftToRight option&lt;BR&gt;* fixed a small design time deviation when ShowSelectButtons was enabled&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=1&gt;5/12/06:&lt;BR&gt;* Insertbuttons (ability to show insert buttons between each item)&lt;BR&gt;6/12/06:&lt;BR&gt;* DragDrop (autodrag to always allow drag and AllowReorder to automatically drag items to other positions)&lt;/FONT&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/6568.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>add/change/remove network mapping</title><link>http://blogs.vbcity.com/hotdog/archive/2006/09/27/6325.aspx</link><pubDate>Wed, 27 Sep 2006 03:30:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2006/09/27/6325.aspx</guid><description>&lt;P&gt;The title was what this class was mainly created for. It's a small wrapper that extends the System.IO.DriveInfo, mainly with the purpose of setting the drive mappings.&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;!-- --Start of code block
--&gt;&lt;DIV Style=" Border='1px #000080 solid'; Margin-Left=10pt; Margin-Right=2pt;" OnKeyDown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;&amp; i&lt;ch.selcount){ch.sel=i;ch.click();}"&gt;&lt;DIV Style=" Font-Size=9pt; Font-Family='Microsoft Sans Serif'; Border-Bottom='1px #000080 solid';" OnClick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'300pt':null;if(i==1&amp;&amp; ch.offsetHeight&gt;h)ch.style.height=h;" sel=1 selold=1 selcount=3&gt;&lt;b&gt;  Code &lt;/b&gt;&lt;a href="javascript:" Style=" Margin-Left=10pt; Margin-Right=10pt;" OnClick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');"&gt;Copy&lt;/a&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=0"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Hide&lt;/SPAN&gt;&lt;SPAN Style=" Font-Weight=bolder; Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=1"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();" Checked=True&gt;Scroll&lt;/SPAN&gt;&lt;SPAN Style=" Margin-Left=5pt; Margin-Right=5pt; Cursor='hand';" OnClick="parentNode.sel=2"&gt;&lt;Input Type="Radio" Style="" OnClick="this.blur();"&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;&lt;DIV Style=" BackGround-Color=#dcdcdc; overflow='auto'; Height=300pt;"&gt;&lt;FONT Color=#0000ff&gt;namespace&lt;/FONT&gt; Subro.IO&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;using&lt;/FONT&gt; System;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Text;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; io = System.IO;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Runtime.InteropServices;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Diagnostics;&lt;FONT Color=#0000ff&gt;&lt;br&gt;using&lt;/FONT&gt; System.Drawing;&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Information on a drive. The 'default' information of &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotSystem.IO.DriveInfo"/&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; can be obtained with the &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsee cref=&amp;quotInfo"/&gt;&lt;/FONT&gt;&lt;FONT Color=#008000&gt; property.&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Further added functionality includes: mappings to network locations, obtaining drive images&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt;&lt;br&gt;{&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Name;&lt;br&gt;io.&lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt; info;&lt;FONT Color=#0000ff&gt;&lt;br&gt;string&lt;/FONT&gt; apidrive;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; DriveInfo(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Drive)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;this&lt;/FONT&gt;.Name = Drive;&lt;br&gt;apidrive = Drive.Trim();&lt;/div&gt;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (!apidrive.EndsWith(&lt;FONT Color=#800000&gt;":"&lt;/FONT&gt;)) apidrive += &lt;FONT Color=#800000&gt;":"&lt;/FONT&gt;;&lt;br&gt;Refresh();&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Get info&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; Refresh()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;unc = GetUNC();&lt;FONT Color=#0000ff&gt;&lt;br&gt;try&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;info = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; io.&lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt;(Name);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;catch&lt;/FONT&gt; { info = &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;; }&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (info != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) type = info.DriveType;&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;string&lt;/FONT&gt; GetUNC()&lt;br&gt;{&lt;FONT Color=#008080&gt;&lt;div style="margin-left:20pt"&gt;StringBuilder&lt;/FONT&gt; remotename = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#008080&gt;StringBuilder&lt;/FONT&gt;();&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; bufferlen = 255;&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; res = WNetGetConnection(apidrive, remotename, &lt;FONT Color=#0000ff&gt;ref&lt;/FONT&gt; bufferlen);&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;if&lt;/FONT&gt; (CheckAPIRes(res) == &lt;FONT Color=#008080&gt;API_Result&lt;/FONT&gt;.NO_ERROR)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; remotename.ToString();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:60pt"&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#008080&gt;&lt;div style="margin-left:40pt"&gt;API_Result&lt;/FONT&gt; CheckAPIRes(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; res)&lt;br&gt;{&lt;FONT Color=#008080&gt;&lt;div style="margin-left:20pt"&gt;API_Result&lt;/FONT&gt; ares = (&lt;FONT Color=#008080&gt;API_Result&lt;/FONT&gt;)res;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (res &gt; 0)&lt;FONT Color=#008080&gt;&lt;div style="margin-left:20pt"&gt;Debug&lt;/FONT&gt;.WriteLine(&lt;FONT Color=#800000&gt;&amp;quotError: "&lt;/FONT&gt; + ares.ToString());&lt;FONT Color=#0000ff&gt;&lt;/div&gt;return&lt;/FONT&gt; ares;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; static&lt;FONT Color=#0000ff&gt;&lt;br&gt;#region&lt;/FONT&gt; API definitions&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;enum&lt;/FONT&gt; &lt;FONT Color=#008080&gt;API_Result&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;ERROR_BAD_DEVICE = 1200,&lt;br&gt;ERROR_CONNECTION_UNAVAIL = 1201,&lt;br&gt;ERROR_EXTENDED_ERROR = 1208,&lt;br&gt;ERROR_MORE_DATA = 234,&lt;br&gt;ERROR_NOT_SUPPORTED = 50,&lt;br&gt;ERROR_NO_NET_OR_BAD_PATH = 1203,&lt;br&gt;ERROR_NO_NETWORK = 1222,&lt;br&gt;ERROR_NOT_CONNECTED = 2250,&lt;br&gt;NO_ERROR = 0&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#008080&gt;DllImport&lt;/FONT&gt;(&lt;FONT Color=#800000&gt;&amp;quotmpr.dll"&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;extern&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; WNetGetConnection(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; LocalName, &lt;FONT Color=#008080&gt;StringBuilder&lt;/FONT&gt; RemoteName, &lt;FONT Color=#0000ff&gt;ref&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; BufferSize);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#008080&gt;DllImport&lt;/FONT&gt;(&lt;FONT Color=#800000&gt;&amp;quotshell32.dll"&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;extern&lt;/FONT&gt; &lt;FONT Color=#008080&gt;IntPtr&lt;/FONT&gt; ExtractIcon(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; hInst, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; lpszExeFileName, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; nIconIndex);&lt;/div&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:40pt"&gt;//http://www.allapi.net/apilist/WNetAddConnection2.shtml&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#008080&gt;DllImport&lt;/FONT&gt;(&lt;FONT Color=#800000&gt;&amp;quotmpr.dll"&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;extern&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; WNetAddConnection2A(&lt;FONT Color=#0000ff&gt;ref&lt;/FONT&gt; &lt;FONT Color=#008080&gt;NetResource&lt;/FONT&gt; ConnectionInfo, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; pw, &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; user, &lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt; Flags);&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;[&lt;FONT Color=#008080&gt;StructLayout&lt;/FONT&gt;(&lt;FONT Color=#008080&gt;LayoutKind&lt;/FONT&gt;.Sequential)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;struct&lt;/FONT&gt; &lt;FONT Color=#008080&gt;NetResource&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#808080&gt;&lt;div style="margin-left:20pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#008000&gt;ignored&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Scope;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#008080&gt;ResourceType&lt;/FONT&gt; Type;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#008000&gt;ignored&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; DisplayType;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#008000&gt;ignored&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Usage;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Drive Name&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; LocalName;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; The unc&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; RemoteName;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#008000&gt;ignored&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Comment;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Provider&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Provider;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;CurrentSessionOnly = 0,&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; the change also counts when rebooted&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;br&gt;Update_Profile = 1&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;enum&lt;/FONT&gt; &lt;FONT Color=#008080&gt;ResourceType&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;Disk = 1,&lt;br&gt;Printer = 2&lt;/div&gt;}&lt;/div&gt;&lt;br&gt;&lt;FONT Color=#008000&gt;&lt;div style="margin-left:40pt"&gt;//http://www.allapi.net/apilist/WNetCancelConnection2.shtml&lt;/FONT&gt;&lt;br&gt;[&lt;FONT Color=#008080&gt;DllImport&lt;/FONT&gt;(&lt;FONT Color=#800000&gt;&amp;quotmpr.dll"&lt;/FONT&gt;)]&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;extern&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; WNetCancelConnection2A(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Drive, &lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt; Flags, &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; Force);&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#008080&gt;IEnumerable&lt;/FONT&gt;&lt;&lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt;&gt; GetDrives()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; GetDrives(&lt;FONT Color=#0000ff&gt;false&lt;/FONT&gt;);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#008080&gt;IEnumerable&lt;/FONT&gt;&lt;&lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt;&gt; GetMappings()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt; inf &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; GetDrives(&lt;FONT Color=#0000ff&gt;true&lt;/FONT&gt;))&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (inf.HasMapping) &lt;FONT Color=#0000ff&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; inf;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;static&lt;/FONT&gt; &lt;FONT Color=#008080&gt;IEnumerable&lt;/FONT&gt;&lt;&lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt;&gt; GetDrives(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IncludeMappings)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;foreach&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; s &lt;FONT Color=#0000ff&gt;in&lt;/FONT&gt; GetDriveNames(IncludeMappings))&lt;br&gt;{&lt;FONT Color=#008080&gt;&lt;div style="margin-left:20pt"&gt;DriveInfo&lt;/FONT&gt; inf = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#008080&gt;DriveInfo&lt;/FONT&gt;(s);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (inf.Exists || (IncludeMappings &amp;&amp; inf.HasMapping)) &lt;FONT Color=#0000ff&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; inf;&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Returns an enumeration of all POSSIBLE drive/mapping names&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltparam name=&amp;quotIncludeMappings"&gt;&lt;/param&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&gt;&lt;/returns&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT Color=#008080&gt;IEnumerable&lt;/FONT&gt;&lt;&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt;&gt; GetDriveNames(&lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; IncludeMappings)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;char&lt;/FONT&gt; c = &lt;FONT Color=#800000&gt;'A'&lt;/FONT&gt;; c &lt;= &lt;FONT Color=#800000&gt;'Z'&lt;/FONT&gt;; c++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; c.ToString();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (IncludeMappings)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;for&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; i = 1; i &lt; 4; i++)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;yield&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#800000&gt;&amp;quotLPT"&lt;/FONT&gt; + i;&lt;/div&gt;}&lt;/div&gt;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; props&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; mapping&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; HasMapping&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; unc != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;string&lt;/FONT&gt; unc;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; Mapping&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; unc;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;set&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (unc == &lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt; == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;RemoveMapping();&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SetMapping(&lt;FONT Color=#0000ff&gt;value&lt;/FONT&gt;, &lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt;.Update_Profile);&lt;/div&gt;}&lt;br&gt;Refresh();&lt;/div&gt;}&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; RemoveMapping()&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;RemoveMapping(&lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt;.Update_Profile);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; RemoveMapping(&lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt; Persistance)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; res = WNetCancelConnection2A(apidrive, Persistance, 1);&lt;br&gt;CheckAPIRes(res);&lt;br&gt;Refresh();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetMapping(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; UNC, &lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt; ConnectionType)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;SetMapping(UNC, ConnectionType, &lt;FONT Color=#008080&gt;ResourceType&lt;/FONT&gt;.Disk);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;void&lt;/FONT&gt; SetMapping(&lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; UNC, &lt;FONT Color=#008080&gt;ConnectionType&lt;/FONT&gt; ConnectionType, &lt;FONT Color=#008080&gt;ResourceType&lt;/FONT&gt; ResourceType)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt; (UNC == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;throw&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#008080&gt;ArgumentNullException&lt;/FONT&gt;(&lt;FONT Color=#800000&gt;&amp;quotUNC"&lt;/FONT&gt;);&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (unc != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;&amp; unc.ToLower() == UNC.Trim().ToLower()) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt;;&lt;br&gt;RemoveMapping(ConnectionType);&lt;FONT Color=#008080&gt;&lt;br&gt;NetResource&lt;/FONT&gt; nr = &lt;FONT Color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT Color=#008080&gt;NetResource&lt;/FONT&gt;();&lt;br&gt;nr.LocalName = apidrive;&lt;br&gt;nr.RemoteName = UNC;&lt;br&gt;nr.Type = ResourceType;&lt;FONT Color=#0000ff&gt;&lt;br&gt;int&lt;/FONT&gt; res = WNetAddConnection2A(&lt;FONT Color=#0000ff&gt;ref&lt;/FONT&gt; nr, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;, &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;, ConnectionType);&lt;br&gt;CheckAPIRes(res);&lt;br&gt;Refresh();&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Indicates if the drive is known on the current system&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;bool&lt;/FONT&gt; Exists&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; info != &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt; &amp;&amp; info.DriveType != System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.NoRootDirectory; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;private&lt;/FONT&gt; io.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt; type;&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; io.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt; DriveType&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;get&lt;/FONT&gt; { &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; type; }&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;string&lt;/FONT&gt; res = apidrive;&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (!Exists &amp;&amp; !HasMapping)&lt;br&gt;{&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#800000&gt;" [Does not exist]"&lt;/FONT&gt;;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;else&lt;/FONT&gt;&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;if&lt;/FONT&gt;(Exists)&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#800000&gt;" ["&lt;/FONT&gt; + type + &lt;FONT Color=#800000&gt;" drive]"&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;if&lt;/FONT&gt; (HasMapping)&lt;div style="margin-left:20pt"&gt;res += &lt;FONT Color=#800000&gt;" --&gt; "&lt;/FONT&gt; + unc;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;div style="margin-left:60pt"&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; res;&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/div&gt;&lt;div style="margin-left:40pt"&gt;#region&lt;/FONT&gt; Graphical&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;static&lt;/FONT&gt; &lt;FONT Color=#008080&gt;Icon&lt;/FONT&gt; GetIcon(&lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; index)&lt;br&gt;{&lt;FONT Color=#008080&gt;&lt;div style="margin-left:20pt"&gt;IntPtr&lt;/FONT&gt; handle = ExtractIcon(0, &lt;FONT Color=#800000&gt;&amp;quotshell32.dll"&lt;/FONT&gt;, index);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; &lt;FONT Color=#008080&gt;Icon&lt;/FONT&gt;.FromHandle(handle);&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;static&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;int&lt;/FONT&gt; GetIndex(io.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt; type)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;switch&lt;/FONT&gt; (type)&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;case&lt;/FONT&gt; System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.CDRom:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; 11;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.Fixed:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; 8;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.Network:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; 9;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.Ram:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; 12;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.Removable:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; 6;&lt;FONT Color=#0000ff&gt;&lt;/div&gt;case&lt;/FONT&gt; System.IO.&lt;FONT Color=#008080&gt;DriveType&lt;/FONT&gt;.Unknown:&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;return&lt;/FONT&gt; 7;&lt;/div&gt;&lt;/div&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; -1;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#808080&gt;&lt;div style="margin-left:40pt"&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltsummary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; Gets the icon normally associated with the drive&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;/summary&gt;&lt;/FONT&gt;&lt;FONT Color=#808080&gt;&lt;br&gt;///&lt;/FONT&gt;&lt;FONT Color=#008000&gt; &lt;/FONT&gt;&lt;FONT Color=#808080&gt;&amp;ltreturns&gt;&lt;/returns&gt;&lt;/FONT&gt;&lt;FONT Color=#0000ff&gt;&lt;br&gt;public&lt;/FONT&gt; &lt;FONT Color=#008080&gt;Icon&lt;/FONT&gt; GetIcon()&lt;br&gt;{&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:20pt"&gt;int&lt;/FONT&gt; index = GetIndex(type);&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (index == -1) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; GetIcon(index);&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;public&lt;/FONT&gt; &lt;FONT Color=#008080&gt;Image&lt;/FONT&gt; GetImage()&lt;br&gt;{&lt;FONT Color=#008080&gt;&lt;div style="margin-left:20pt"&gt;Icon&lt;/FONT&gt; ic = GetIcon();&lt;FONT Color=#0000ff&gt;&lt;br&gt;if&lt;/FONT&gt; (ic == &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;) &lt;FONT Color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT Color=#0000ff&gt;null&lt;/FONT&gt;;&lt;FONT Color=#008080&gt;&lt;br&gt;Bitmap&lt;/FONT&gt; res = &lt;FONT Color=#008080&gt;Bitmap&lt;/FONT&gt;.FromHicon(ic.Handle);&lt;FONT Color=#0000ff&gt;&lt;br&gt;return&lt;/FONT&gt; res;&lt;/div&gt;}&lt;/div&gt;&lt;FONT Color=#0000ff&gt;&lt;div style="margin-left:40pt"&gt;#endregion&lt;/FONT&gt;&lt;/div&gt;&lt;div style="margin-left:20pt"&gt;}&lt;/div&gt;&lt;br&gt;}&lt;FONT Color=#0000ff&gt;&lt;br&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV Style=" Display='none'; BackGround-Color=#dcdcdc;" OnDblClick="var o = parentNode.firstChild;o.sel =1;o.click()"&gt;&lt;b&gt; . . .&lt;/b&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/6325.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Robert Verpalen</dc:creator><title>Redirect console output</title><link>http://blogs.vbcity.com/hotdog/archive/2006/07/10/6089.aspx</link><pubDate>Mon, 10 Jul 2006 06:31:00 GMT</pubDate><guid>http://blogs.vbcity.com/hotdog/archive/2006/07/10/6089.aspx</guid><description>&lt;P&gt;Another small class with nothing fancy or advanced, but that could spare time in not having to do it yourself ;-)&lt;/P&gt;
&lt;P&gt;.net has a lot of nifty debugging features. For Runtime support a lot of&amp;nbsp; convenient code exists in the System.Diagnostics namespace.&lt;BR&gt;But.. if you're anything like me, you use the Console.Write and WriteLine functions when developing. (when sometimes I really should use the Debug.Write... functions, but find it too convenient to use Console)&lt;/P&gt;
&lt;P&gt;Or.. other times when written for a console app, but now you want the same code to run in a windows app and still see the output.&lt;/P&gt;
&lt;P&gt;In any case, .net has made&amp;nbsp; it incredibly easy to redirect the standard output. No tutorial here on that subject, but still, had made a default output several times and decided that I could do with something generic. &lt;BR&gt;Well, here it is. It's very simple code which does nothing more than redirect the Console output to a listbox. It runs asynchronously with the calling code, so it won't hold it up that much, but the code might be ahead of the output in fast output generating output files.&lt;/P&gt;
&lt;P&gt;To start using, simply set:&lt;BR&gt;&lt;SPAN style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"&gt;&lt;FONT size=4&gt;Subro.&lt;FONT color=#008080&gt;ConsoleOutput&lt;/FONT&gt;.Redirect = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;To stop, surprise surprise, set Redirect to false. By default the maximum number of lines kept (and&amp;nbsp;displayed)&amp;nbsp;is 250, but this can be changed by setting the ConsoleOutput.&lt;STRONG&gt;MaxLines&lt;/STRONG&gt; property&lt;FONT size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;!-- --Start of code block
--&gt;
&lt;DIV onkeydown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;amp;&amp;amp; i&lt;ch.selcount){ch.sel=i;ch.click();}" style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BORDER-BOTTOM: #000080 1px solid; FONT-FAMILY: 'Microsoft Sans Serif'" onclick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'125pt':null;if(i==1&amp;amp;&amp;amp; ch.offsetHeight&gt;h)ch.style.height=h;" selcount="3" selold="1" sel="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=0&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Hide&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bolder; MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=1&gt;&lt;INPUT onclick=this.blur(); type=radio CHECKED&gt;Scroll&lt;/SPAN&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=2&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 125pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;namespace&lt;/FONT&gt; Subro&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;using&lt;/FONT&gt; System.Threading;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.IO;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Windows.Forms;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Drawing;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.Text;&lt;FONT color=#0000ff&gt;&lt;BR&gt;using&lt;/FONT&gt; System.ComponentModel;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleOutput&lt;/FONT&gt; : &lt;FONT color=#008080&gt;Form&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;volatile&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleOutput&lt;/FONT&gt; instance;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Starts or stops the redirection of the console output to a ConsoleOutput form window&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; Redirect&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; instance != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (Redirect == &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;;&lt;BR&gt;WaitLock();&lt;FONT color=#008000&gt;&lt;BR&gt;//instanceLock.AcquireReaderLock(timeout);&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (Redirect != &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;locked = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;)&lt;BR&gt;{&lt;FONT color=#008080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Thread&lt;/FONT&gt; t = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;Thread&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;ThreadStart&lt;/FONT&gt;(show));&lt;BR&gt;t.Start();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;instance.Invoke(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;ThreadStart&lt;/FONT&gt;(instance.Close));&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;BR&gt;WaitLock();&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;const&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; timeout = 5000;&lt;FONT color=#0000ff&gt;&lt;BR&gt;volatile&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; locked;&lt;FONT color=#008000&gt;&lt;BR&gt;//static ReaderWriterLock instanceLock = new ReaderWriterLock();&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; Thread start to start showing the output form in its own thread&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; show()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleOutput&lt;/FONT&gt;().ShowDialog();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; WaitLock()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;while&lt;/FONT&gt; (locked) { }&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;volatile&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; max = 250;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; MaxLines&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; max; }&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;max = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (instance != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;instance.Invoke(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;ThreadStart&lt;/FONT&gt;(instance.CheckMax));&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; ShowTime = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; ShowEntryTimes&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; ShowTime; }&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ShowTime = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (instance != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;instance.Invalidate();&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#808080&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; The original output of the console window&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;///&lt;/FONT&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;/SUMMARY&gt;&lt;/FONT&gt;&lt;FONT color=#008080&gt;&lt;BR&gt;TextWriter&lt;/FONT&gt; orgoutput;&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; OnClosing(&lt;FONT color=#008080&gt;CancelEventArgs&lt;/FONT&gt; e)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (orgoutput != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;FONT color=#008080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Console&lt;/FONT&gt;.SetOut(orgoutput);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (stream != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;stream.Dispose();&lt;/DIV&gt;instance = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;BR&gt;locked = &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;base&lt;/FONT&gt;.OnClosing(e);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; OnShown(&lt;FONT color=#008080&gt;EventArgs&lt;/FONT&gt; e)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;base&lt;/FONT&gt;.OnShown(e);&lt;BR&gt;instance = &lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;;&lt;BR&gt;stream = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;CStream&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;);&lt;BR&gt;orgoutput = &lt;FONT color=#008080&gt;Console&lt;/FONT&gt;.Out;&lt;FONT color=#008080&gt;&lt;BR&gt;Console&lt;/FONT&gt;.SetOut(stream);&lt;BR&gt;locked = &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#008080&gt;Size&lt;/FONT&gt; DefaultSize&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;Size&lt;/FONT&gt;(500, 300);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; OnKeyDown(&lt;FONT color=#008080&gt;KeyEventArgs&lt;/FONT&gt; e)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (e.KeyCode == &lt;FONT color=#008080&gt;Keys&lt;/FONT&gt;.Escape) Close();&lt;FONT color=#0000ff&gt;&lt;BR&gt;base&lt;/FONT&gt;.OnKeyDown(e);&lt;/DIV&gt;}&lt;FONT color=#008080&gt;&lt;BR&gt;CStream&lt;/FONT&gt; stream;&lt;FONT color=#008080&gt;&lt;BR&gt;ConsoleBox&lt;/FONT&gt; lb = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleBox&lt;/FONT&gt;();&lt;BR&gt;ConsoleOutput()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;lb.Dock = &lt;FONT color=#008080&gt;DockStyle&lt;/FONT&gt;.Fill;&lt;BR&gt;Controls.Add(lb);&lt;BR&gt;Text = &lt;FONT color=#800000&gt;"Console output"&lt;/FONT&gt;;&lt;BR&gt;KeyPreview = &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;class&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleBox&lt;/FONT&gt; : &lt;FONT color=#008080&gt;ListBox&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; ConsoleBox()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;BackColor = &lt;FONT color=#008080&gt;Color&lt;/FONT&gt;.Black;&lt;BR&gt;ForeColor = &lt;FONT color=#008080&gt;Color&lt;/FONT&gt;.White;&lt;BR&gt;brush = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;SolidBrush&lt;/FONT&gt;(ForeColor);&lt;BR&gt;DrawMode = &lt;FONT color=#008080&gt;DrawMode&lt;/FONT&gt;.OwnerDrawVariable;&lt;/DIV&gt;}&lt;FONT color=#008080&gt;&lt;BR&gt;SolidBrush&lt;/FONT&gt; brush;&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#008080&gt;SolidBrush&lt;/FONT&gt; timeBrush = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;SolidBrush&lt;/FONT&gt;(&lt;FONT color=#008080&gt;Color&lt;/FONT&gt;.Yellow);&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#008080&gt;Font&lt;/FONT&gt; timefont = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;Font&lt;/FONT&gt;(&lt;FONT color=#008080&gt;FontFamily&lt;/FONT&gt;.GenericSansSerif, 7);&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; timeHeight;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; OnDrawItem(&lt;FONT color=#008080&gt;DrawItemEventArgs&lt;/FONT&gt; e)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (e.Index == -1) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT color=#008080&gt;&lt;BR&gt;Graphics&lt;/FONT&gt; g = e.Graphics;&lt;BR&gt;e.DrawBackground();&lt;FONT color=#008080&gt;&lt;BR&gt;ConsoleEntry&lt;/FONT&gt; ce = Items[e.Index] &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleEntry&lt;/FONT&gt;;&lt;FONT color=#008080&gt;&lt;BR&gt;Rectangle&lt;/FONT&gt; rect = e.Bounds;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ShowTime)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;g.DrawString(ce.GetCreationTime(), timefont, timeBrush, rect);&lt;BR&gt;rect.Offset(0, timeHeight);&lt;/DIV&gt;}&lt;BR&gt;g.DrawString(ce.Value, e.Font, brush,rect);&lt;/DIV&gt;}&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; OnMeasureItem(&lt;FONT color=#008080&gt;MeasureItemEventArgs&lt;/FONT&gt; e)&lt;BR&gt;{&lt;FONT color=#008080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ConsoleEntry&lt;/FONT&gt; ce = Items[e.Index] &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleEntry&lt;/FONT&gt;;&lt;FONT color=#008080&gt;&lt;BR&gt;SizeF&lt;/FONT&gt; size= e.Graphics.MeasureString(ce.Value, Font);&lt;BR&gt;e.ItemHeight = (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;)size.Height;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ShowTime)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (timeHeight == 0)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;timeHeight = (&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;e.Graphics.MeasureString(ce.GetCreationTime(), timefont).Height;&lt;/DIV&gt;&lt;/DIV&gt;e.ItemHeight += timeHeight;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;void&lt;/FONT&gt; CheckMax()&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;stream.CheckMax();&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;class&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleEntry&lt;/FONT&gt; : &lt;FONT color=#008080&gt;INotifyPropertyChanged&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;readonly&lt;/FONT&gt; &lt;FONT color=#008080&gt;DateTime&lt;/FONT&gt; CreationTime = &lt;FONT color=#008080&gt;DateTime&lt;/FONT&gt;.Now;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Value&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; value; }&lt;FONT color=#0000ff&gt;&lt;BR&gt;set&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.value = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (ValueChanged != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ValueChanged(&lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;, &lt;FONT color=#008080&gt;EventArgs&lt;/FONT&gt;.Empty);&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;if&lt;/FONT&gt; (PropertyChanged != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;PropertyChanged(&lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;, pe);&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT color=#008080&gt;EventHandler&lt;/FONT&gt; ValueChanged;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;event&lt;/FONT&gt; &lt;FONT color=#008080&gt;PropertyChangedEventHandler&lt;/FONT&gt; PropertyChanged;&lt;FONT color=#0000ff&gt;&lt;BR&gt;static&lt;/FONT&gt; &lt;FONT color=#008080&gt;PropertyChangedEventArgs&lt;/FONT&gt; pe = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;PropertyChangedEventArgs&lt;/FONT&gt;(&lt;FONT color=#800000&gt;"Value"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;string&lt;/FONT&gt; value;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; ConsoleEntry(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Value)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.value = Value;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; ToString()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; value;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; GetCreationTime()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; CreationTime.ToString(&lt;FONT color=#800000&gt;"hh:mm:ss.ffff"&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;class&lt;/FONT&gt; &lt;FONT color=#008080&gt;CStream&lt;/FONT&gt; : &lt;FONT color=#008080&gt;TextWriter&lt;/FONT&gt;&lt;BR&gt;{&lt;FONT color=#008080&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;ConsoleOutput&lt;/FONT&gt; owner;&lt;FONT color=#008080&gt;&lt;BR&gt;ListBox&lt;/FONT&gt; lb;&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; CStream(&lt;FONT color=#008080&gt;ConsoleOutput&lt;/FONT&gt; owner)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;this&lt;/FONT&gt;.owner = owner;&lt;BR&gt;lb = owner.lb;&lt;BR&gt;lb.DataSource = list;&lt;BR&gt;lb.DisplayMember = &lt;FONT color=#800000&gt;"Value"&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; Write(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; value)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Write(value, &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;base&lt;/FONT&gt;.Write(value);&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; WriteLine(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; value)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Write(value, &lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;base&lt;/FONT&gt;.WriteLine(value);&lt;/DIV&gt;}&lt;FONT color=#008080&gt;&lt;BR&gt;ConsoleEntry&lt;/FONT&gt; last;&lt;FONT color=#008080&gt;&lt;BR&gt;BindingList&lt;/FONT&gt;&amp;lt;&lt;FONT color=#008080&gt;ConsoleEntry&lt;/FONT&gt;&amp;gt; list = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;BindingList&lt;/FONT&gt;&amp;lt;&lt;FONT color=#008080&gt;ConsoleEntry&lt;/FONT&gt;&amp;gt;();&lt;FONT color=#0000ff&gt;&lt;BR&gt;delegate&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; &lt;FONT color=#008080&gt;addDelegate&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; value, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; end);&lt;FONT color=#0000ff&gt;&lt;BR&gt;void&lt;/FONT&gt; Write(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; value, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; end)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (locked) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;try&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;lb.BeginInvoke(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;addDelegate&lt;/FONT&gt;(write), &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;object&lt;/FONT&gt;[] { value, end });&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#008080&gt;ObjectDisposedException&lt;/FONT&gt;)&lt;BR&gt;{&lt;BR&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;catch&lt;/FONT&gt; (&lt;FONT color=#008080&gt;InvalidOperationException&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;lb.CreateControl();&lt;BR&gt;Write(value, end);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;int&lt;/FONT&gt; index;&lt;FONT color=#0000ff&gt;&lt;BR&gt;void&lt;/FONT&gt; write(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; value, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; end)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;lock&lt;/FONT&gt; (list)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (last == &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;last = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;ConsoleEntry&lt;/FONT&gt;(value);&lt;BR&gt;list.Add(last);&lt;BR&gt;index = list.Count - 1;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;else&lt;/FONT&gt;&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;last.Value += value;&lt;/DIV&gt;}&lt;BR&gt;lb.SelectedIndex = index;&lt;BR&gt;CheckMax();&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt; (end)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;last = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;;&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; CheckMax()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt; (list.Count &amp;lt;= max) &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;lock&lt;/FONT&gt; (list)&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;while&lt;/FONT&gt; (list.Count &amp;gt; max)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;list.RemoveAt(0);&lt;BR&gt;index--;&lt;/DIV&gt;}&lt;FONT color=#008000&gt;&lt;/DIV&gt;//list.RemoveRange(0, list.Count - max);&lt;/FONT&gt;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;override&lt;/FONT&gt; &lt;FONT color=#008080&gt;Encoding&lt;/FONT&gt; Encoding&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#008080&gt;Encoding&lt;/FONT&gt;.Unicode; }&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV ondblclick="var o = parentNode.firstChild;o.sel =1;o.click()" style="DISPLAY: none; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;26-6-6&lt;BR&gt;Understandably, comments have arisen and might still arise about the very ugly thread locking procedure. Well, let's just keep it at that it got it reasons and that it is hardly used when running. Please see the comments below for further explanation : &lt;/FONT&gt;&lt;A href="http://blogs.vbcity.com/hotdog/archive/2006/07/10/6089.aspx#6120"&gt;&lt;FONT size=2&gt;http://blogs.vbcity.com/hotdog/archive/2006/07/10/6089.aspx#6120&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;But... please feel free to experiment for other small impact solutions, but when testing elaborately I hope you agree that the normal locking mechanisms don't do the job in this case. To be honest, I didn't really look any further because the lock is needed only when starting (or stopping) the redirect, which takes a few milliseconds and will not be noticed. So experimenting on a large scale could ultimately be a waste of your time :p ;-)&lt;/FONT&gt;&lt;BR&gt;&lt;/P&gt;&lt;!-- 
End of code block----&gt;&lt;img src ="http://blogs.vbcity.com/hotdog/aggbug/6089.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>