<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" 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/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 - Discussions by hack2roothotmai</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 - Discussions by hack2roothotmai</title>
		<link>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions</link>
	<language>en</language>
	<pubDate>Sat, 25 May 2013 16:25:07 GMT</pubDate>
	<lastBuildDate>Sat, 25 May 2013 16:25:07 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>0</c9:totalResults>
	<c9:pageCount>0</c9:pageCount>
	<c9:pageSize>0</c9:pageSize>
	<item>
		<title>Coffeehouse - Hexadecimal Viewer Control in C#</title>
		<description><![CDATA[<p>Leave your feedback and your opinion&nbsp;<a title="Simple HexView Control" href="http://simplehexviewcontrol.codeplex.com/project/edit">here</a></p><p>&nbsp;</p><h1>Project Description</h1><p><span>Simple HexControl (HexView) is a classic Windows Forms control. It implements a hexadecimal view of bytes with grouping. It's blazing fast, renders only visible frame of a window and support of painting the individual groups of bytes without the total window redraw.</span><br><br><img title="hexcontrol01.PNG" src="http://i3.codeplex.com/Download?ProjectName=simplehexviewcontrol&amp;DownloadId=373158" alt="hexcontrol01.PNG"><span>&nbsp;</span><img title="hexcontrol02.PNG" src="http://i3.codeplex.com/Download?ProjectName=simplehexviewcontrol&amp;DownloadId=373159" alt="hexcontrol02.PNG"></p><h1>Links</h1><p><a href="https://sourceforge.net/projects/hexviewcontrol/">https://sourceforge.net/projects/hexviewcontrol/</a></p><h1>Features</h1><p><span>- Supports vertical and horizontal scrolling</span><br><span>- Supports auto-scroll / auto hide scroll bars</span><br><span>- Renders only visible window frame</span><br><span>- Can update individual byte change</span><br><span>- Supports any type of fonts</span><br><span>- Less intense calculations due to bytes block measurement / rendering</span></p><h1>Documentation</h1><p><span>HexControl is scrollable composite Windows Forms control. Control logic is divided into presentation logic, model, and some simple code to reflect model changes to presentation control (M-V pattern), skipping controller logic totally, because controller part (events, subscriptions, updates) will be taken totally by the .NET Framework.</span></p><h1>Usage scenarios</h1><p><span>You can change grouping of the bytes by setting&nbsp;</span><strong>HexControl</strong><span>&nbsp;properties in&nbsp;</span><strong>Appearance</strong><span>&nbsp;section:</span><br><br><span>- BytesPerColumn</span><br><span>- ColumnPerRow</span></p><h1>Screenshots</h1><p><img title="hexview-tiny.PNG" src="http://i3.codeplex.com/Download?ProjectName=simplehexviewcontrol&amp;DownloadId=373161" alt="hexview-tiny.PNG">&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hexadecimal-Viewer-Control-in-C/d79fd2aab4de44b1bf52a04300e2c83f#d79fd2aab4de44b1bf52a04300e2c83f</link>
		<pubDate>Mon, 30 Apr 2012 13:45:41 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hexadecimal-Viewer-Control-in-C/d79fd2aab4de44b1bf52a04300e2c83f#d79fd2aab4de44b1bf52a04300e2c83f</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>1</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Playing with Expressions.Compiler demos</title>
		<description><![CDATA[<p></p><p>Hi! Anyone want to have fun with cool math calculator demo at &nbsp;<strong>Expressions.Compiler</strong><a href="http://expressionscompiler.codeplex.com/">home page</a> [http://expressionscompiler.codeplex.com/]?</p><p>&nbsp;</p><p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Playing-with-ExpressionsCompiler-demos/7c52f102f6284aaf87249e37000919e2#7c52f102f6284aaf87249e37000919e2</link>
		<pubDate>Tue, 23 Nov 2010 00:33:08 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Playing-with-ExpressionsCompiler-demos/7c52f102f6284aaf87249e37000919e2#7c52f102f6284aaf87249e37000919e2</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>1</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New project created at CodePlex: Expressions.Compiler [http://expressionscompiler.codeplex.com/]</title>
		<description><![CDATA[<p><strong>Project Description</strong></p><p>Expressions.Compiler is a lightweight expression compiler and generic parser framework. It is designed to support out-of-the-box propotyping, expressions evaluation &amp; code generation.</p><p><strong>Summary</strong></p><p>This is a lightweight (~ 20 KB) easy to use framework library. for prototyping of the LL(1) (top-down left-most derivation) parser and PEG parser invented by Bryan Ford in 2004.<br>This framework can be easily switched between table-based and recursive descent parser implementation. Also it can be used to generate adaptive grammar parser, as it's shown in provided example in the project source tree.<br>Version history<br>v1.0.3.0<br><br>Added generic classes. All of new generic classes exists in simple form for all public classes and interfaces, which is actually an algorithmic form of conversion function for char as input and double as evaluation of AST as output.</p><p>Added brand functionality: a universal generalized parser of stream of type T, returning an AST tree of type U, which can be evaluated to anything special. Tests have been updated to reflect code changes, have been found several hidden errors in tests. At the moment, valid grammar on null input set cannot produce positive parsing results even on any grammar rules set.</p><p>All non-generic code not changed for the compatibility with older code. Finally switched code and tests to trace build, debug build and release build. Release build does not have extra code evaluation due to classes-to-string conversion to readable format. All test results produce classes-to-string self descripting readable output only on trace build project configuration.</p><p>Math sample updated for the new generic classes.</p><p><strong>Version history</strong></p><p><strong>v1.0.3.0</strong></p><p>Added generic classes. All of new generic classes exists in simple form for all public classes and interfaces, which is actually an algorithmic form of conversion function for char as input and double as evaluation of AST as output.</p><p>Added brand functionality: a universal generalized parser of stream of type T, returning an AST tree of type U, which can be evaluated to anything special. Tests have been updated to reflect code changes, have been found several hidden errors in tests. At the moment, valid grammar on null input set cannot produce positive parsing results even on any grammar rules set.</p><p>All non-generic code not changed for the compatibility with older code. Finally switched code and tests to trace build, debug build and release build. Release build does not have extra code evaluation due to classes-to-string conversion to readable format. All test results produce classes-to-string self descripting readable output only on trace build project configuration.</p><p>Math sample updated for the new generic classes.</p><p><strong>v1.0.2.1</strong></p><p>Removed depedencies on generic type wrapper for T, core library simplifications, weakened interface dependencies on base classes.</p><p>Removed interfaces:&nbsp;<br>- IExpression&lt;T&gt;,&nbsp;<br>- IExpression,&nbsp;<br>- IExpressionTreeInternal.</p><p>Expression&lt;T&gt; now supports generic type. Samples &amp; sources can be downloadede through changesets or from download page.</p><p>Please, visit &nbsp;<strong>Expressions.Compiler</strong> <a href="http://expressionscompiler.codeplex.com/">home page</a> at&nbsp;http://expressionscompiler.codeplex.com/</p><p>&nbsp;</p><p>&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-project-created-at-CodePlex-ExpressionsCompiler-httpexpressionscompilercodeplexcom/31c2f7d1cefb427c87159e3700085bcc#31c2f7d1cefb427c87159e3700085bcc</link>
		<pubDate>Tue, 23 Nov 2010 00:30:25 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-project-created-at-CodePlex-ExpressionsCompiler-httpexpressionscompilercodeplexcom/31c2f7d1cefb427c87159e3700085bcc#31c2f7d1cefb427c87159e3700085bcc</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>1</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - MS puts C# and CLI ECMA specs under Community Promise</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Ubuntu said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">fknight said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p><em>Microsoft could GPL every bit of code they've ever written and renounce all patents and people would still say not to use it because &quot;they still might sue you&quot; or claim it's some kind of trick.</em></p>
<p>M$ has the opportunity to settle this issue once and for all by sending their .net patents to /dev/null but they CHOOSE not to - instead they give a promise not to sue you similar to the promise not to sue you for using the ribbon in your apps. Now why do
 they do that? To keep their options open. Patents are the reason why a horizontal ribbon shouldn't be ever implemented in OpenOffice and why
<strong>this is a serious danger, and only fools would ignore it until the day it actually happens</strong>. Of course M$ apologists like you defend these M$ 'good will' promises the following argument: since M$ couldn't satisfy everybody no matter what it
 did then it can just as well screw everybody which is what it has always done.</p>
</div></blockquote>
<p>You can use this oppotuniky just like Microsoft - do not stuck with license agreements. Do better than Microsoft does ... (insert anything you want from list below) !</p>
<p>-parallel extensions</p>
<p>-serialization</p>
<p>-plugins</p>
<p>-user experience</p>
<p>As an&nbsp;example, you can write your own, better Ribbon (by the way ,who said that Ribbon's usablility is not&nbsp;just a marketing trick from the same sucky Microsoft guys but the really useful thing? No one, I repeat, no one who saw and use it for a day or two
 in offices around said that Ribbon is NOT a suxx, because you even need to remember MORE combinations than ever, since EVERY user can CUSTOMIZE it, so, just&nbsp;for example, if it is was hard to find some functionality in old versions of office it will be almost
 impossible to struggle it aganst in new, &quot;ribonned&quot; version. Search the web, I'm not the only bird on a sky. I think it will be the hell for a tech support (-&quot;...you need go to bookmarked toolbar, and press&nbsp;umibigous number of ungrouped controls in different
 tabs to enable single user feature you desired&quot;, -&quot;sorry, i have no visible toolbars ever...&quot;)</p>
<p>&nbsp;I'm trying to create framework to achieve this goals. See it on my web</p>
<p><a href="http://plugins.codeplex.com">http://plugins.codeplex.com</a></p>
<p>&nbsp;</p>
<p>And i have plans to port it to Mono</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/477127-MS-puts-C-and-CLI-ECMA-specs-under-Community-Promise/1a81f9f277c34f9f84ac9deb00e5c0cd#1a81f9f277c34f9f84ac9deb00e5c0cd</link>
		<pubDate>Tue, 07 Jul 2009 19:31:11 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/477127-MS-puts-C-and-CLI-ECMA-specs-under-Community-Promise/1a81f9f277c34f9f84ac9deb00e5c0cd#1a81f9f277c34f9f84ac9deb00e5c0cd</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>26</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">stevo_ said:</div><div class="quoteText">
<p>The challenge is to make a powerful abstraction thats simple.. (balanced)&nbsp;its easy to make a simple abstraction thats simple.. you should try and find something more unique (and perhaps more simple (simple != useless) because MEF and concurrency / threading
 are big tasks to take on).</p>
<p>I've found naturally the things I've ended up building are things that have caused me the biggest development friction (this is natural), and I'm certainly not having friction points with ioc/di frameworks.. or at least if I want more from them, would require
 a sizable dev effort.</p>
</div></blockquote>
<p>Actually, yes</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/2ec01fbbb5f446d4ae469deb00e349b5#2ec01fbbb5f446d4ae469deb00e349b5</link>
		<pubDate>Tue, 07 Jul 2009 16:55:04 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/2ec01fbbb5f446d4ae469deb00e349b5#2ec01fbbb5f446d4ae469deb00e349b5</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">PaoloM said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">hack2roothotmai said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>Proper spelling would be a wonderful starting point.</p>
</div></blockquote>
<p>If you are thinking you are smart enouth, please help me spell&nbsp;anything you found&nbsp;incorrect. Show me you point, exactly.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/94951061e37341e1b5979deb00e3494d#94951061e37341e1b5979deb00e3494d</link>
		<pubDate>Tue, 07 Jul 2009 16:46:47 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/94951061e37341e1b5979deb00e3494d#94951061e37341e1b5979deb00e3494d</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Bass said:</div><div class="quoteText">
<p>I use Mono.Addins <img src="http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif" alt="Smiley"></p>
<p>&nbsp;</p>
</div></blockquote>
<p>Well, I'm happy to read it. Actually, I'm planning to make my&nbsp;project to be Mono compatible, AND use Mono.Addins for&nbsp;Unix&nbsp;and AppDomain itself for Windows.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/c03c79e6afb44f8082349deb00e348e6#c03c79e6afb44f8082349deb00e348e6</link>
		<pubDate>Tue, 07 Jul 2009 16:44:27 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/c03c79e6afb44f8082349deb00e348e6#c03c79e6afb44f8082349deb00e348e6</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">joechung said:</div><div class="quoteText">
<p>Could you state clearly why you are writing alternatives to MEF, ParallelFx, and XML serialization?&nbsp; Not that it matters for you, since self-edification is a worthwhile goal, but for others to be interested, you need incentive.</p>
</div></blockquote>
<p>Ok, i'm willing to be sequential.</p>
<p>1st point: Full source code access.</p>
<p>2st point: Framework size.</p>
<p>3st point: It challenging to do the better product as do the guys at Microsoft.</p>
<p>In your opinion,&nbsp;why Linus Torvalds&nbsp;stated his&nbsp;own project formerly known as Linux Project, even he knows that Unix/Windows/QNX etc.&nbsp;OS-es already exists?</p>
<p>If you are asking me, why I'n doing so. I have the answer.</p>
<p>I'm tired, because nobody hires me, nobody supports me, nobody follows me. Do you really think that big fat cats in Microsoft will ever give me a chance to do the best i can do? No. Misrosoft is a suxx as&nbsp;a work place, because&nbsp;people like me are eaten for
 the breakfast by the corporate approach, so I'm smart enouth mice to understand it.&nbsp;Too many guys tries to be a one-man-at-the-top. Probably, I'm going to&nbsp;continue to develop software&nbsp;while working as system administrator in no-one-knows-it-company for the
 end of my life. On the other hand I can do better than Microsoft Teams and I will.</p>
<p>So, if you can't challenge the best of Microsoft teams for your own, give me chance to do this for you.</p>
<p>If you are from one ot the teams you mention it earlier (ParallelFx, MEF, etc), just be ready to know what i'm thinking about you.</p>
<p>I'm trying to prove that you can create by YOUR own code which can do the parallelization in several&nbsp;assemblies with 4-8K size, and it will work BETTER that in .NET FW 4.0 or ParallelFx. YOU can do better. YOU can make use of it. YOU. Just learn what is
 incapsulation, interfaces, inheritance, factory pattern, etc, exploring my code. It is a prove that YOU can do better.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/0c229229a724493180359deb00e34816#0c229229a724493180359deb00e34816</link>
		<pubDate>Tue, 07 Jul 2009 16:38:31 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/0c229229a724493180359deb00e34816#0c229229a724493180359deb00e34816</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Site Feedback - I CANNOT ENTER MY OWN PROFILE!</title>
		<description><![CDATA[<p>Why I cant login NOT USING Windows LIVE ID if I have ONE?</p>
<p>Wht I cant GOTO TO OROFILE PAGE, Bacuse of error: Server error ./ is not a valid path name?</p>
<p>Why it is so stupid that 12-yrs experienced .NET can do NOTHING about it?</p>
<p>Why I'm stuck with this LOGIN problems?</p>
<p>Why I CANT CHANGE MY LOGIN, if it is errornnous, AT LEAST?</p>
<p>P.S.</p>
<p>If you think i have not tried, Saferi, WinXPSP2, coffehouse, Even IPhone, you are wrong, I TRIED ALL THE STUFF....</p>
<p>Why&nbsp;channel9 sucks? I do not want it to be so user UNFRIENDLY!!!!</p>
<p><span>&nbsp; </p>
<h1>Server Error in '/' Application.
<hr size="1">
</h1>
<h2><em>The resource cannot be found.</em></h2>
</span><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><strong>Description:
</strong>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
<br /><br /><strong>Requested URL: </strong>/Niners/hack2roothotmai./<br /><br /></font>
<p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Feedback/476761-I-CANNOT-ENTER-MY-OWN-PROFILE/476761#476761</link>
		<pubDate>Fri, 03 Jul 2009 06:15:12 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Feedback/476761-I-CANNOT-ENTER-MY-OWN-PROFILE/476761#476761</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Plugins Extensibility Framework</title>
		<description><![CDATA[<p>I have added some new samples to my library. Enjoy!&nbsp;PAEF is located&nbsp;here:&nbsp;<a href="http://plugins.codeplex.com/">http://plugins.codeplex.com/</a></p>
<p>Screenshots:</p>
<p><strong>Object-Oriented State Machine</strong>&nbsp;sample. It show how to use <strong>
Abstract State Machine</strong> idiom to safely enumerate throught file &amp; direcory states.</p>
<p><a rel="lightbox" href="http://www.freeimagehosting.net/uploads/b10aab245e.jpg"><img src="http://www.freeimagehosting.net/uploads/b10aab245e.jpg" alt="Object-Oriented State Machine"></a></p>
<p><strong>Pi.Window&nbsp;</strong>sample. It show how easily to imlement the <strong>
window state manegement</strong> solution. As well as how to store and load windows between application UI sessions.</p>
<p><a rel="lightbox" href="http://www.freeimagehosting.net/uploads/4cd9aac3c1.jpg"><img src="http://www.freeimagehosting.net/uploads/4cd9aac3c1.jpg" alt="Pi.Window"></a></p>
<p><strong>Pi.UI</strong> sample. It shows how to create&nbsp;<strong>multi-threaded</strong> parallel work items, how to sync it with UI, how to use
<strong>parallelism in applications</strong> using framework library approach.</p>
<p><a rel="lightbox" href="http://www.freeimagehosting.net/uploads/f036ed520a.jpg"><img src="http://www.freeimagehosting.net/uploads/f036ed520a.jpg" alt="Pi.UI"></a></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/476758-Plugins-Extensibility-Framework/476758#476758</link>
		<pubDate>Fri, 03 Jul 2009 06:08:05 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/476758-Plugins-Extensibility-Framework/476758#476758</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>2</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Plugins Extensibility Framework</title>
		<description><![CDATA[<p>I have added some new samples to my library. Enjoy!&nbsp;PAEF is located&nbsp;here:&nbsp;<a href="http://plugins.codeplex.com/">http://plugins.codeplex.com/</a></p>
<p>Screenshots:</p>
<p><strong>Object-Oriented State Machine</strong>&nbsp;sample. It show how to use <strong>
Abstract State Machine</strong> idiom to safely enumerate throught file &amp; direcory states.</p>
<p><a rel="lightbox" href="http://www.freeimagehosting.net/uploads/b10aab245e.jpg"><img src="http://www.freeimagehosting.net/uploads/b10aab245e.jpg" alt="Object-Oriented State Machine"></a></p>
<p><strong>Pi.Window&nbsp;</strong>sample. It show how easily to imlement the <strong>
window state manegement</strong> solution. As well as how to store and load windows between application UI sessions.</p>
<p><a rel="lightbox" href="http://www.freeimagehosting.net/uploads/4cd9aac3c1.jpg"><img src="http://www.freeimagehosting.net/uploads/4cd9aac3c1.jpg" alt="Pi.Window"></a></p>
<p><strong>Pi.UI</strong> sample. It shows how to create&nbsp;<strong>multi-threaded</strong> parallel work items, how to sync it with UI, how to use
<strong>parallelism in applications</strong> using framework library approach.</p>
<p><a rel="lightbox" href="http://www.freeimagehosting.net/uploads/f036ed520a.jpg"><img src="http://www.freeimagehosting.net/uploads/f036ed520a.jpg" alt="Pi.UI"></a></p>
<p><a href="http://www.freeimagehosting.net/uploads/4cd9aac3c1.jpg"></a></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/476755-Plugins-Extensibility-Framework/476755#476755</link>
		<pubDate>Fri, 03 Jul 2009 06:04:57 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/476755-Plugins-Extensibility-Framework/476755#476755</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>1</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">littleguru said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">hack2roothotmai said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>Sure, but you could write a thin wrapper or a wrapper that adds a lot of logic. Your's is more like a thin wrapper (that does not add much on their own) and theirs is a wrapper that adds a lot of logic and algorithms.</p>
</div></blockquote>
<p>You are right! i prefer Keep It Stupid Simple. Frameworkers goes far from this idiom nowadays, that means, that i nedd to spend time trying to deal with comlicated APIs, more time when things are not going the right way you want it to, more time waiting
 for a next .NET version (just because nobody understands it better) tips and tricks, and so on.</p>
<p>In m opinion, if i can do complicated thing using things as simple as pissible, i.e. thin&nbsp;wrappers - this is a best, just because you can understang what beneath API&nbsp;is going on&nbsp;by simply lookin under the hood <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif' alt='Wink' />.</p>
<p>KISS <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif' alt='Wink' /></p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/032778b9566c456ca8199deb00e34614#032778b9566c456ca8199deb00e34614</link>
		<pubDate>Tue, 23 Jun 2009 20:56:33 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/032778b9566c456ca8199deb00e34614#032778b9566c456ca8199deb00e34614</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">littleguru said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">hack2roothotmai said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>Keep up the work! <img src="http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif" alt="Smiley"> Try to evaluate on each piece of code that it really adds more than just a wrapper. Your multithreading stuff is a nice idea but the Parallel
 FX adds a lot more than just a wrapper around the ThreadPool!</p>
<p>I don't know if you have seen these two videos. They explain some of the ideas that have been implemented in the Parallel FX:</p>
<p><a href="http://channel9.msdn.com/shows/Going&#43;Deep/Inside-Parallel-Extensions-for-NET-2008-CTP-Part-1/">http://channel9.msdn.com/shows/Going&#43;Deep/Inside-Parallel-Extensions-for-NET-2008-CTP-Part-1/</a><br>
<a href="http://channel9.msdn.com/shows/Going&#43;Deep/Inside-Parallel-Extensions-for-NET-2008-CTP-Part-2/">http://channel9.msdn.com/shows/Going&#43;Deep/Inside-Parallel-Extensions-for-NET-2008-CTP-Part-2/</a></p>
</div></blockquote>
<p>Phankx, but, you know, all we (me, alone, and aall boys and girls form Parallel extensions) are doing well -</p>
<p>is just to write simple wrappers on wrappers&nbsp;for Win32 threads!!!</p>
<p>At least we are all frameworkers <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif' alt='Wink' /></p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/382acafb90d542e4b7119deb00e34541#382acafb90d542e4b7119deb00e34541</link>
		<pubDate>Tue, 23 Jun 2009 20:41:44 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/382acafb90d542e4b7119deb00e34541#382acafb90d542e4b7119deb00e34541</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">blowdart said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">hack2roothotmai said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>So what you've go is a wrapper around the thread pool. And this replaces MEF how exactly?</p>
</div></blockquote>
<p>Does anybody can look into my profile?</p>
<p>I've go these:</p>
<p><span class="HTML_TXT"><span class="HTML_TAG">&lt;<span class="HTML_ELM">html</span>&gt;</span></span></p>
<div class="SYN_TXT"><span class="HTML_TXT"></span><span class="HTML_TXT">&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">
&lt;<span class="HTML_ELM">head</span>&gt;</span></span></div>
<div class="SYN_ROW">
<div id="syn_row3" class="SYN_TXT"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">
&lt;<span class="HTML_ELM">title</span>&gt;</span>The resource cannot be found.<span class="HTML_TAG">&lt;/<span class="HTML_ELM">title</span>&gt;</span></span></div>
<div class="SYN_TXT"><span class="HTML_TXT"></span><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="HTML_TAG">&lt;<span class="HTML_ELM">style</span>&gt;</span></span></div>
<div class="SYN_TXT"><span class="HTML_TXT"></span><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">body </span>{<span class="CSS_PRO">font-family</span>:<span class="CSS_VAL">&quot;Verdana&quot;</span>;<span class="CSS_PRO">font-weight</span>:<span class="CSS_VAL">normal</span>;<span class="CSS_PRO">font-size</span>:
<span class="CSS_VAL">.7em</span>;<span class="CSS_PRO">color</span>:<span class="CSS_VAL">black</span>;}
</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row6" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">p </span>{<span class="CSS_PRO">font-family</span>:<span class="CSS_VAL">&quot;Verdana&quot;</span>;<span class="CSS_PRO">font-weight</span>:<span class="CSS_VAL">normal</span>;<span class="CSS_PRO">color</span>:<span class="CSS_VAL">black</span>;<span class="CSS_PRO">margin-top</span>:
<span class="CSS_VAL">-5px</span>}</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row7" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">b </span>{<span class="CSS_PRO">font-family</span>:<span class="CSS_VAL">&quot;Verdana&quot;</span>;<span class="CSS_PRO">font-weight</span>:<span class="CSS_VAL">bold</span>;<span class="CSS_PRO">color</span>:<span class="CSS_VAL">black</span>;<span class="CSS_PRO">margin-top</span>:
<span class="CSS_VAL">-5px</span>}</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row8" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">H1 </span>{ <span class="CSS_PRO">font-family</span>:<span class="CSS_VAL">&quot;Verdana&quot;</span>;<span class="CSS_PRO">font-weight</span>:<span class="CSS_VAL">normal</span>;<span class="CSS_PRO">font-size</span>:<span class="CSS_VAL">18pt</span>;<span class="CSS_PRO">color</span>:<span class="CSS_VAL">red
</span>}</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row9" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">H2 </span>{ <span class="CSS_PRO">font-family</span>:<span class="CSS_VAL">&quot;Verdana&quot;</span>;<span class="CSS_PRO">font-weight</span>:<span class="CSS_VAL">normal</span>;<span class="CSS_PRO">font-size</span>:<span class="CSS_VAL">14pt</span>;<span class="CSS_PRO">color</span>:<span class="CSS_VAL">maroon
</span>}</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row10" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">pre </span>{<span class="CSS_PRO">font-family</span>:<span class="CSS_VAL">&quot;Lucida Console&quot;</span>;<span class="CSS_PRO">font-size</span>:
<span class="CSS_VAL">.9em</span>}</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row11" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">.marker </span>{<span class="CSS_PRO">font-weight</span>: <span class="CSS_VAL">
bold</span>; <span class="CSS_PRO">color</span>: <span class="CSS_VAL">black</span>;<span class="CSS_PRO">text-decoration</span>:
<span class="CSS_VAL">none</span>;}</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row12" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">.version </span>{<span class="CSS_PRO">color</span>: <span class="CSS_VAL">
gray</span>;}</span></span></div>
<div class="SYN_TXT"><span class="HTML_TXT"></span><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">.error </span>{<span class="CSS_PRO">margin-bottom</span>: <span class="CSS_VAL">
10px</span>;}</span></span></div>
<div class="SYN_TXT"><span class="HTML_TXT"></span><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="CSS_SEL">.expandable </span>{ <span class="CSS_PRO">text-decoration</span>:<span class="CSS_VAL">underline</span>;
<span class="CSS_PRO">font-weight</span>:<span class="CSS_VAL">bold</span>; <span class="CSS_PRO">
color</span>:<span class="CSS_VAL">navy</span>; <span class="CSS_PRO">cursor</span>:<span class="CSS_VAL">hand</span>; }</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row15" class="SYN_TXT"><span class="HTML_TXT"><span class="CSS_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span class="HTML_TAG">&lt;/<span class="HTML_ELM">style</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row16" class="SYN_TXT"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">
&lt;/<span class="HTML_ELM">head</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row18" class="SYN_TXT"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">
&lt;<span class="HTML_ELM">body</span> <span class="HTML_ATR">bgcolor</span>=<span class="HTML_VAL">&quot;white&quot;</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div class="SYN_LNB"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">&lt;<span class="HTML_ELM">span</span>&gt;</span><span class="HTML_TAG">&lt;<span class="HTML_ELM">H1</span>&gt;</span>Server Error in '/' Application.<span class="HTML_TAG">&lt;<span class="HTML_ELM">hr</span>
<span class="HTML_ATR">width</span>=<span class="HTML_VAL">100%</span> <span class="HTML_ATR">
size</span>=<span class="HTML_VAL">1</span> <span class="HTML_ATR">color</span>=<span class="HTML_VAL">silver</span>&gt;</span><span class="HTML_TAG">&lt;/<span class="HTML_ELM">H1</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div class="SYN_LNB"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">&lt;<span class="HTML_ELM">h2</span>&gt;</span>
<span class="HTML_TAG">&lt;<span class="HTML_ELM">i</span>&gt;</span>The resource cannot be found.<span class="HTML_TAG">&lt;/<span class="HTML_ELM">i</span>&gt;</span>
<span class="HTML_TAG">&lt;/<span class="HTML_ELM">h2</span>&gt;</span><span class="HTML_TAG">&lt;/<span class="HTML_ELM">span</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div class="SYN_LNB"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">&lt;<span class="HTML_ELM">font</span>
<span class="HTML_ATR">face</span>=<span class="HTML_VAL">&quot;Arial, Helvetica, Geneva, SunSans-Regular, sans-serif &quot;</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div class="SYN_LNB"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">&lt;<span class="HTML_ELM">b</span>&gt;</span> Description:
<span class="HTML_TAG">&lt;/<span class="HTML_ELM">b</span>&gt;</span>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.
<span class="HTML_CHA">&amp;nbsp;</span>Please review the following URL and make sure that it is spelled correctly.</span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row27" class="SYN_TXT"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">
&lt;<span class="HTML_ELM">br</span>&gt;</span><span class="HTML_TAG">&lt;<span class="HTML_ELM">br</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div class="SYN_LNB"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">&lt;<span class="HTML_ELM">b</span>&gt;</span> Requested URL:
<span class="HTML_TAG">&lt;/<span class="HTML_ELM">b</span>&gt;</span>/Niners/hack2roothotmai./<span class="HTML_TAG">&lt;<span class="HTML_ELM">br</span>&gt;</span><span class="HTML_TAG">&lt;<span class="HTML_ELM">br</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div class="SYN_LNB"><span class="HTML_TXT">&nbsp;&nbsp;&nbsp; <span class="HTML_TAG">&lt;/<span class="HTML_ELM">body</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW">
<div id="syn_row32" class="SYN_TXT"><span class="HTML_TXT"><span class="HTML_TAG">&lt;/<span class="HTML_ELM">html</span>&gt;</span></span></div>
</div>
<div class="SYN_ROW"></div></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/2a857943ecd047c0a58c9deb00e3444a#2a857943ecd047c0a58c9deb00e3444a</link>
		<pubDate>Tue, 23 Jun 2009 20:37:41 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/2a857943ecd047c0a58c9deb00e3444a#2a857943ecd047c0a58c9deb00e3444a</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">blowdart said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">hack2roothotmai said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>So what you've go is a wrapper around the thread pool. And this replaces MEF how exactly?</p>
</div></blockquote>
<p>Due to the luck of free scree space i can not post whole sources from <a href="http://plugins.codeplex.com">
http://plugins.codeplex.com</a></p>
<p>Other stuff like dynamic&nbsp;domain loading / unloading, calling code form another domain etc. there.</p>
<p>I'm working on examples <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif' alt='Wink' /></p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/a54a2978a073417b870a9deb00e3434b#a54a2978a073417b870a9deb00e3434b</link>
		<pubDate>Tue, 23 Jun 2009 20:34:26 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/a54a2978a073417b870a9deb00e3434b#a54a2978a073417b870a9deb00e3434b</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">stevo_ said:</div><div class="quoteText">
<p>YAY! just what I wanted.. <img src="http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-8.gif" alt="Expressionless"></p>
</div></blockquote>
<p>I;m preparing samples (just like futures .NET 4.0)</p>
<p>I can nave you a boost //So i'm currently working on a Pi calculation example.</p>
<p>In a lighting&nbsp;sample,&nbsp;you can take use of parallelism in programs like below (working&nbsp;sudoku generator):</p>
<p>&nbsp;</p>
<pre><div><div><p>&nbsp;&nbsp;&nbsp; public abstract class PluginBaseWorkItem&lt;T&gt;</p><p>&nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private static object _sync = new object();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private T _item;</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public T Item { get { return _item; } }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public void Run()</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; List&lt;WaitHandle&gt; _waitHandles = new List&lt;WaitHandle&gt;();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; TaskCount; i&#43;&#43;)</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _waitHandles.Add(new AutoResetEvent(false));</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; TaskCount; i&#43;&#43;)</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessHandle), _waitHandles[i]);</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; WaitHandle.WaitAll(_waitHandles.ToArray());</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; protected abstract void ProcessItem();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; protected void SetValue(T item)</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _item = item;</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; protected T GetValue()</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return _item;</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; protected virtual int TaskCount { get { return Environment.ProcessorCount; } }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private void Process()</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ProcessItem();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private void ProcessHandle(object sync)</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AutoResetEvent waitHandle = (AutoResetEvent)sync;</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Process();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; waitHandle.Set();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; }</p></div></div><pre>&nbsp;</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private class WorkItem : PluginBaseWorkItem&lt;Puzzle&gt;</p>
<pre><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; protected override void ProcessItem()</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DlxEngine engine = new DlxEngine();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Puzzle value = engine.Generate(20);</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lock (this)</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Puzzle item = GetValue();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (item == null || value.Rating &gt; item.Rating)</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SetValue(value);</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public static IPuzzle Create()</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; WorkItem workItem = new WorkItem();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; workItem.Run();</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; IPuzzle puzzle = workItem.Item;</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return Create(puzzle.Text, puzzle.Seed);</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p></pre>
</pre></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/4b053e6398f34197a2f49deb00e342af#4b053e6398f34197a2f49deb00e342af</link>
		<pubDate>Tue, 23 Jun 2009 20:15:29 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/4b053e6398f34197a2f49deb00e342af#4b053e6398f34197a2f49deb00e342af</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - http://plugins.codeplex.com</title>
		<description><![CDATA[<p><font size="1"><font size="1">Everyone welcome to see my code for Parallel alternative, XML serializationalternative and MEF alternative at</font></font></p>
<p><font size="1"><font size="1"><a href="<a href="http://plugins.codeplex.com">http&#58;&#47;&#47;plugins.codeplex.com</a>/"><a href="http://plugins.codeplex.com">http&#58;&#47;&#47;plugins.codeplex.com</a></a></font></font></p>
<p></p>
<div class="cf">
<pre class="cl">&nbsp; &nbsp; <span class="cb1">public</span> <span class="cb1">class</span> <span class="cb2">PluginWorkItem</span>&lt;T&gt; : <span class="cb2">IPluginWorkItem</span></pre>
<pre class="cl">&nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb1">volatile</span> <span class="cb1">bool</span> _isRunning;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb2">List</span>&lt;<span class="cb2">PluginThreadSafeStack</span>&lt;T&gt;&gt; _data;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb1">volatile</span> <span class="cb1">int</span> _dataCount = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb2">BackgroundWorker</span> _mainThread;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">void</span> PushData(T item, <span class="cb1">int</span> threadID)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_dataCount &gt; 0)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataCount--;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _data[threadID].Push(item);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> T PopData(<span class="cb1">int</span> threadID)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> _data[threadID].Pop();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">void</span> PushData(T item)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_dataCount &gt; 0)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataCount--;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _data[GetMinIndex(GetThreadCount())].Push(item);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">int</span> GetDataCount()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> _dataCount;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> T PopData()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> _data[GetMaxIndex(GetThreadCount())].Pop();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb1">int</span> GetThreadCount()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (ThreadCount &gt; 0 &amp;&amp; ThreadCount &lt; 64)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> threadCount = ThreadCount &gt; <span class="cb2">Environment</span>.ProcessorCount ? <span class="cb2">Environment</span>.ProcessorCount : ThreadCount;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> threadCount;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> 1;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">int</span> ThreadCount { <span class="cb1">get</span> { <span class="cb1">return</span> <span class="cb2">Environment</span>.ProcessorCount; } }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">int</span> DataCount { <span class="cb1">get</span> { <span class="cb1">return</span> 0; } }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">void</span> ProcessItem(<span class="cb1">int</span> threadID)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> threadCount = GetThreadCount();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">bool</span> useDataCount = DataCount &gt; 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; T item;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">do</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (!IsRunning) <span class="cb1">return</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item = PopData();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (item != <span class="cb1">null</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (!IsRunning) <span class="cb1">return</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProcessData(item<span class="cb3">/*, threadID*/</span>);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <span class="cb1">while</span> (!<span class="cb1">object</span>.Equals(item, <span class="cb1">default</span>(T)));</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">void</span> ProcessData(T item<span class="cb3">/*, int threadID*/</span>) { }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">void</span> InitializeData() { }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">void</span> InitializeThreadPoolData()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> threadCount = GetThreadCount();</pre>
<pre class="cl">&nbsp;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">this</span>._waitHandles = <span class="cb1">new</span> <span class="cb2">WaitHandle</span>[threadCount];</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; i &lt; threadCount; i&#43;&#43;)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _waitHandles[i] = <span class="cb1">new</span> <span class="cb2">AutoResetEvent</span>(<span class="cb1">false</span>);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">this</span>._data = <span class="cb1">new</span> <span class="cb2">List</span>&lt;<span class="cb2">PluginThreadSafeStack</span>&lt;T&gt;&gt;(threadCount);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; i &lt; threadCount; i&#43;&#43;)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _data.Add(<span class="cb1">new</span> <span class="cb2">PluginThreadSafeStack</span>&lt;T&gt;());</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataCount = DataCount;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeData();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; T item = <span class="cb1">default</span>(T); <span class="cb3">//PopData();</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb3">//if (item != null)</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb3">//{</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb3">//&nbsp; &nbsp; ProcessData(item/*, 0*/);</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb3">//}</span></pre>
<pre class="cl">&nbsp;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (threadCount &gt; 1)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> count = threadCount;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> loop = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (; loop &lt; count; )</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">while</span> (_data[loop].Count == 0 &amp;&amp; count &gt; 1)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count--;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loop&#43;&#43;;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (count &lt; threadCount)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item = PopData(0);</pre>
<pre class="cl">&nbsp;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; (i &#43; 1) &lt; threadCount &amp;&amp; !<span class="cb1">object</span>.Equals(item, <span class="cb1">default</span>(T)); )</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> offset = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">do</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProcessData(item<span class="cb3">/*, i &#43; offset &#43; 1*/</span>);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item = PopData(GetMaxIndex(i &#43; offset &#43; 2));</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; offset&#43;&#43;;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">while</span> ((i &#43; offset &#43; 1) &lt; threadCount &amp;&amp; !<span class="cb1">object</span>.Equals(item, <span class="cb1">default</span>(T)));</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count = i &#43; offset &#43; 1;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loop = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (; loop &lt; count; )</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">while</span> (_data[loop].Count == 0 &amp;&amp; count &gt; 1)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _data.RemoveAt(loop);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _data.Add(<span class="cb1">new</span> <span class="cb2">PluginThreadSafeStack</span>&lt;T&gt;());</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count--;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loop&#43;&#43;;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (count == threadCount)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">break</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item = PopData(GetMaxIndex(loop));</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = count - 1;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; i &lt; threadCount - 1; i&#43;&#43;)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_data[i &#43; 1].Count &gt; 0 &amp;&amp; _data[i].Count == 0)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">throw</span> <span class="cb1">new</span> <span class="cb2">InvalidProgramException</span>();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">void</span> Run()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> threadCount = GetThreadCount();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; i &lt; threadCount; i&#43;&#43;)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb2">ThreadPool</span>.QueueUserWorkItem(<span class="cb1">new</span> <span class="cb2">WaitCallback</span>(ProcessHandle), i);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb1">int</span> GetMaxIndex(<span class="cb1">int</span> index)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> max = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> maxIndex = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; i &lt; index; i&#43;&#43;)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_data[i].Count &gt; max)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; max = _data[i].Count;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxIndex = i;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> maxIndex;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb1">int</span> GetMinIndex(<span class="cb1">int</span> index)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> min = <span class="cb1">int</span>.MaxValue;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> minIndex = 0;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">for</span> (<span class="cb1">int</span> i = 0; i &lt; index; i&#43;&#43;)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_data[i].Count &lt; min)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min = _data[i].Count;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minIndex = i;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> minIndex;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb1">void</span> ProcessHandle(<span class="cb1">object</span> sync)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">int</span> threadID = (<span class="cb1">int</span>)sync;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb2">AutoResetEvent</span> waitHandle = (<span class="cb2">AutoResetEvent</span>)_waitHandles[threadID];</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (IsRunning)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProcessItem(threadID);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; waitHandle.Set();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb3">//MessageBox.Show(DateTime.Now.ToString());</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">bool</span> IsRunning</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">get</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> _isRunning;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl"><span class="cb1">&nbsp; &nbsp; &nbsp; &nbsp; #region</span> IWorkItem Members</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">private</span> <span class="cb2">WaitHandle</span>[] _waitHandles;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">void</span> Initialize()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">protected</span> <span class="cb1">virtual</span> <span class="cb1">void</span> Terminate()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">void</span> <span class="cb2">IPluginWorkItem</span>.Run()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_mainThread == <span class="cb1">null</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _isRunning = <span class="cb1">true</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread = <span class="cb1">new</span> <span class="cb2">BackgroundWorker</span>();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread.DoWork &#43;= (<span class="cb1">object</span> sender, <span class="cb2">DoWorkEventArgs</span> e) =&gt;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Initialize();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeThreadPoolData();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Run();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb2">WaitHandle</span>.WaitAll(_waitHandles);</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Terminate();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_mainThread != <span class="cb1">null</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread = <span class="cb1">null</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _isRunning = <span class="cb1">false</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread.WorkerSupportsCancellation = <span class="cb1">true</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread.RunWorkerAsync();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">bool</span> <span class="cb2">IPluginWorkItem</span>.IsRunning</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">get</span></pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">return</span> _isRunning;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">void</span> <span class="cb2">IPluginWorkItem</span>.Terminate()</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">lock</span> (<span class="cb1">this</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Terminate();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cb1">if</span> (_mainThread != <span class="cb1">null</span>)</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread.CancelAsync();</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _mainThread = <span class="cb1">null</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _isRunning = <span class="cb1">false</span>;</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl">&nbsp; &nbsp; &nbsp; &nbsp; }</pre>
<pre class="cl"><span class="cb1">&nbsp; &nbsp; &nbsp; &nbsp; #endregion</span></pre>
<pre class="cl">&nbsp; &nbsp; }</pre>
</div>
<p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/475211#475211</link>
		<pubDate>Tue, 23 Jun 2009 19:45:06 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/475211-httppluginscodeplexcom/475211#475211</guid>
		<dc:creator>Artur Mustafin</dc:creator>
		<slash:comments>32</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/hack2roothotmai/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>