<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" 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:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Keith Rull</title>
    <link>http://www.keithrull.com/</link>
    <description>Blog of a Filipino Developer about C#, VB.NET, ASP.NET, Java, PHP, SQL Server, MySql and Oracle</description>
    <language>en-us</language>
    <copyright>Keith Rull</copyright>
    <lastBuildDate>Thu, 03 Dec 2009 23:51:10 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>keith.rull@gmail.com</managingEditor>
    <webMaster>keith.rull@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=214df45a-cac2-4d6c-a490-cccc3c2ffcd9</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,214df45a-cac2-4d6c-a490-cccc3c2ffcd9.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,214df45a-cac2-4d6c-a490-cccc3c2ffcd9.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=214df45a-cac2-4d6c-a490-cccc3c2ffcd9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I just saw this posting from sandiego.craigslist.com
and it really made me laugh. LOL.<br /><br /><a href="http://sandiego.craigslist.org/csd/sys/1493519713.html"><i>http://sandiego.craigslist.org/csd/sys/1493519713.html</i></a><br /><br /><img src="http://www.keithrull.com/content/binary/freelaptopbag.GIF" border="0" /><br /><br />
Heheh. Funny.<br /><img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=214df45a-cac2-4d6c-a490-cccc3c2ffcd9" /></body>
      <title>Free Laptop Bag? LOL</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,214df45a-cac2-4d6c-a490-cccc3c2ffcd9.aspx</guid>
      <link>http://www.keithrull.com/2009/12/03/FreeLaptopBagLOL.aspx</link>
      <pubDate>Thu, 03 Dec 2009 23:51:10 GMT</pubDate>
      <description>I just saw this posting from sandiego.craigslist.com and it really made me laugh. LOL.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://sandiego.craigslist.org/csd/sys/1493519713.html"&gt;&lt;i&gt;http://sandiego.craigslist.org/csd/sys/1493519713.html&lt;/i&gt;&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.keithrull.com/content/binary/freelaptopbag.GIF" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
Heheh. Funny.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=214df45a-cac2-4d6c-a490-cccc3c2ffcd9" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,214df45a-cac2-4d6c-a490-cccc3c2ffcd9.aspx</comments>
      <category>Fun Stuff</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=cc81ec72-11ba-46e9-a8b0-b751f2347366</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,cc81ec72-11ba-46e9-a8b0-b751f2347366.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,cc81ec72-11ba-46e9-a8b0-b751f2347366.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cc81ec72-11ba-46e9-a8b0-b751f2347366</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Ayayay! More than half a year of inactivity
:(<br /><br />
But now i'm back! Watchout for updated post on my recent adventures. Stay tuned friends
;)<br /><p></p><img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=cc81ec72-11ba-46e9-a8b0-b751f2347366" /></body>
      <title>Finally Back!</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,cc81ec72-11ba-46e9-a8b0-b751f2347366.aspx</guid>
      <link>http://www.keithrull.com/2009/11/22/FinallyBack.aspx</link>
      <pubDate>Sun, 22 Nov 2009 18:01:35 GMT</pubDate>
      <description>Ayayay! More than half a year of inactivity :(&lt;br&gt;
&lt;br&gt;
But now i'm back! Watchout for updated post on my recent adventures. Stay tuned friends
;)&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=cc81ec72-11ba-46e9-a8b0-b751f2347366" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,cc81ec72-11ba-46e9-a8b0-b751f2347366.aspx</comments>
      <category>Life</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=c8525bdd-7948-4f82-8e3e-a5d783df7363</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,c8525bdd-7948-4f82-8e3e-a5d783df7363.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,c8525bdd-7948-4f82-8e3e-a5d783df7363.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c8525bdd-7948-4f82-8e3e-a5d783df7363</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>
            <a href="http://www.codeplex.com/dasBlog/Release/ProjectReleases.aspx">dasBlog
2.3</a>
          </strong> was released last Monday March 16, 2009. It's a minor release that
fixes a few bugs in the code base. Congrats dasBlog team for this release.
</p>
        <p>
Below is the list of changes for this release:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
New version of dotNetOpenId<br />
Small bug fixes<br />
Several small JavaScript errors<br />
Captcha now works more reliably<br />
Better Time handling in timeline 
<br />
New 32/64 bit version of the Basic DatePicker<br />
Centralized handling of binary files to a BinaryDataService
</p>
        </blockquote>
        <p>
On a side note, I've been thinking for the past few months now about updating my site
theme. I think I've been using this theme for the past 2 years and it's starting to
look bland. I think this new release of dasBlog will give me the chance to upgrade
my site theme. I don't know how  it's gonna look yet but i'm sure its going to
be better than what it is today (Hopefully!). ;)
</p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=c8525bdd-7948-4f82-8e3e-a5d783df7363" />
      </body>
      <title>dasblog 2.3 released and my urge to make a new theme</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,c8525bdd-7948-4f82-8e3e-a5d783df7363.aspx</guid>
      <link>http://www.keithrull.com/2009/03/18/dasblog23ReleasedAndMyUrgeToMakeANewTheme.aspx</link>
      <pubDate>Wed, 18 Mar 2009 15:19:11 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;&lt;a href="http://www.codeplex.com/dasBlog/Release/ProjectReleases.aspx"&gt;dasBlog
2.3&lt;/a&gt;&lt;/strong&gt; was released last Monday March 16, 2009. It's a minor release that
fixes a few bugs in the code base. Congrats dasBlog team for this release.
&lt;/p&gt;
&lt;p&gt;
Below is the list of changes for this release:
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p&gt;
New version of dotNetOpenId&lt;br&gt;
Small bug fixes&lt;br&gt;
Several small JavaScript errors&lt;br&gt;
Captcha now works more reliably&lt;br&gt;
Better Time handling in timeline 
&lt;br&gt;
New 32/64 bit version of the Basic DatePicker&lt;br&gt;
Centralized handling of binary files to a BinaryDataService
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
On a side note, I've been thinking for the past few months now about updating my site
theme. I think I've been using this theme for the past 2 years and it's starting to
look bland. I think this new release of dasBlog will give me the chance to upgrade
my site theme. I don't know how&amp;nbsp; it's gonna look yet but i'm sure its going to
be better than what it is today (Hopefully!). ;)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=c8525bdd-7948-4f82-8e3e-a5d783df7363" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,c8525bdd-7948-4f82-8e3e-a5d783df7363.aspx</comments>
      <category>Release</category>
      <category>Tech News and Issues</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=63a8cb0c-0bee-4690-9b57-ad30bf8bf685</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,63a8cb0c-0bee-4690-9b57-ad30bf8bf685.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,63a8cb0c-0bee-4690-9b57-ad30bf8bf685.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=63a8cb0c-0bee-4690-9b57-ad30bf8bf685</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I saw <strong><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&amp;displaylang=en">this</a></strong> on
the <strong><a href="http://www.asp.net/mvc">ASP.NET MVC</a></strong> download page
and it seems like it was released yesterday.
</p>
        <p>
          <img src="http://www.keithrull.com/content/binary/aspnetmvcrtm.JPG" border="0" />
        </p>
        <p>
I haven't seen any official announcement anywhere yet but I expect to hear something
coming out of the MIX09 event regarding ASP.NET MVC 1.0 RTM. I was able to confirm
with <strong><a href="http://flux88.com/">Ben Scheirman</a></strong> via <strong><a href="http://twitter.com/subdigital/status/1348558685">twitter</a></strong> that
it's RTMed. I don't know where he got the news but judging by the screenshot above
it looks like its true.
</p>
        <p>
In case you are interested in learning about <strong><a href="http://www.asp.net/mvc">ASP.NET
MVC</a></strong>, Microsoft has released an application called <strong><a href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx">NerdDinner.com</a></strong> which
is a event management website that enables users to register for "geek dinners". I
believe that application was built using ASP.NET MVC 1.0 RC2 but it should be compatible
with the RTM version (I haven't compiled it with the latest version yet). It's a really
nice sample application that shows you how to build an application using <strong><a href="http://www.asp.net/mvc">ASP.NET
MVC</a></strong>. Whats neat about <strong><a href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx">NerdDinner.com</a></strong> is
that it part of the book that <strong><a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;tag=diabeticbooks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0470384611">Scott,
Scott, Phil  &amp; Rob</a></strong> are writing and they have been kind enough
to let as peek at their <strong><a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;tag=diabeticbooks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0470384611">upcoming
book</a></strong> by giving a <strong><a href="http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf">free
chapter</a></strong> that details how they built the <strong><a href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx">NerdDinner.com</a></strong> website
step-by-step using ASP.NET MVC.
</p>
        <p>
Wow, I'm really stoked! This is going to be a fun day! Thanks MS!
</p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=63a8cb0c-0bee-4690-9b57-ad30bf8bf685" />
      </body>
      <title>ASP.NET MVC 1.0 RTMed</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,63a8cb0c-0bee-4690-9b57-ad30bf8bf685.aspx</guid>
      <link>http://www.keithrull.com/2009/03/18/ASPNETMVC10RTMed.aspx</link>
      <pubDate>Wed, 18 Mar 2009 14:33:48 GMT</pubDate>
      <description>&lt;p&gt;
I saw &lt;strong&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&amp;amp;displaylang=en"&gt;this&lt;/a&gt;&lt;/strong&gt; on
the &lt;strong&gt;&lt;a href="http://www.asp.net/mvc"&gt;ASP.NET MVC&lt;/a&gt;&lt;/strong&gt; download page
and it seems like it was released yesterday.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.keithrull.com/content/binary/aspnetmvcrtm.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
I haven't seen any official announcement anywhere yet but I expect to hear something
coming out of the MIX09 event regarding ASP.NET MVC 1.0 RTM.&amp;nbsp;I was able to confirm
with &lt;strong&gt;&lt;a href="http://flux88.com/"&gt;Ben Scheirman&lt;/a&gt;&lt;/strong&gt; via &lt;strong&gt;&lt;a href="http://twitter.com/subdigital/status/1348558685"&gt;twitter&lt;/a&gt;&lt;/strong&gt; that
it's RTMed. I don't know where he got the news but judging by the screenshot above
it looks like its true.
&lt;/p&gt;
&lt;p&gt;
In case you are interested in learning about &lt;strong&gt;&lt;a href="http://www.asp.net/mvc"&gt;ASP.NET
MVC&lt;/a&gt;&lt;/strong&gt;, Microsoft has released an application called &lt;strong&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx"&gt;NerdDinner.com&lt;/a&gt;&lt;/strong&gt; which
is a event management website that enables users to register for "geek dinners". I
believe that application was built using ASP.NET MVC 1.0 RC2 but it should be compatible
with the RTM version (I haven't compiled it with the latest version yet). It's a really
nice&amp;nbsp;sample application&amp;nbsp;that shows you how&amp;nbsp;to build an application&amp;nbsp;using &lt;strong&gt;&lt;a href="http://www.asp.net/mvc"&gt;ASP.NET
MVC&lt;/a&gt;&lt;/strong&gt;. Whats neat about &lt;strong&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx"&gt;NerdDinner.com&lt;/a&gt;&lt;/strong&gt; is
that it part of&amp;nbsp;the book that &lt;strong&gt;&lt;a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;amp;tag=diabeticbooks&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0470384611"&gt;Scott,
Scott, Phil&amp;nbsp; &amp;amp; Rob&lt;/a&gt;&lt;/strong&gt; are writing and they have been kind enough
to let as peek at their &lt;strong&gt;&lt;a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;amp;tag=diabeticbooks&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0470384611"&gt;upcoming
book&lt;/a&gt;&lt;/strong&gt; by giving a &lt;strong&gt;&lt;a href="http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf"&gt;free
chapter&lt;/a&gt;&lt;/strong&gt; that details how they built the &lt;strong&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx"&gt;NerdDinner.com&lt;/a&gt;&lt;/strong&gt; website
step-by-step using ASP.NET MVC.
&lt;/p&gt;
&lt;p&gt;
Wow, I'm really stoked! This is going to be a fun day! Thanks MS!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=63a8cb0c-0bee-4690-9b57-ad30bf8bf685" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,63a8cb0c-0bee-4690-9b57-ad30bf8bf685.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
      <category>Tech News and Issues</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=db2c29aa-7a06-47b4-84e1-fdfe59aa4f39</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,db2c29aa-7a06-47b4-84e1-fdfe59aa4f39.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,db2c29aa-7a06-47b4-84e1-fdfe59aa4f39.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=db2c29aa-7a06-47b4-84e1-fdfe59aa4f39</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Tooltips are great additions to any interface and in this article I'm going to show
you how to attach a tooltip to control in Silverlight 2.
</p>
        <p>
To start, let's assume that we have a button that we want to add a tooltip to:
</p>
        <p>
          <strong>[XAML]</strong>
        </p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#ff0000">&lt;UserControl
x:Class=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"KeithRull.Silverlight.CreatingTooltips.Page"</span> xmlns=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span> xmlns:x=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/winfx/2006/xaml"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"400"</span> Height=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"300"</span>&gt;
&lt;Grid x:Name=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"LayoutRoot"</span> Background=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"#FF1E238E"</span>&gt;
&lt;Button Content=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Hover
over me!"</span> Height=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"20"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"100"</span> Margin=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"30
40"</span> VerticalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Top"</span> HorizontalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Left"</span>&gt;
&lt;/Button&gt; &lt;/Grid&gt; &lt;/UserControl&gt;</font>
          </span>
        </pre>
        <p>
          <strong>[Rendered UI]</strong>
        </p>
        <p>
          <img src="http://www.keithrull.com/content/binary/sltooltips01.JPG" border="0" />
        </p>
        <p>
In order or us to attach a tooltip to our button we need to create a reference to
the TooltipService.Tooltip inside the our button's XAML declaration. We also need
to setup the Tooltip.Content to tell the compiler what to show when the user hover's
to our button.
</p>
        <p>
          <strong>[XAML]</strong>
        </p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#ff0000">&lt;UserControl
x:Class=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"KeithRull.Silverlight.CreatingTooltips.Page"</span> xmlns=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span> xmlns:x=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/winfx/2006/xaml"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"400"</span> Height=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"300"</span>&gt;
&lt;Grid x:Name=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"LayoutRoot"</span> Background=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"#FF1E238E"</span>&gt;
&lt;Button Content=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Hover
over me!"</span> Height=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"20"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"100"</span> Margin=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"30
40"</span> VerticalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Top"</span> HorizontalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Left"</span>&gt;
&lt;ToolTipService.ToolTip&gt; &lt;ToolTip&gt; &lt;ToolTip.Content&gt; &lt;TextBlock
TextWrapping=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Wrap"</span>&gt;
Hooray! I'm alive!. &lt;/TextBlock&gt; &lt;/ToolTip.Content&gt; &lt;/ToolTip&gt; &lt;/ToolTipService.ToolTip&gt;
&lt;/Button&gt; &lt;/Grid&gt; &lt;/UserControl&gt;</font>
          </span>
        </pre>
        <p>
          <strong>[Rendered UI (at runtime)]</strong>
        </p>
        <p>
          <img src="http://www.keithrull.com/content/binary/sltooltips02.JPG" border="0" />
        </p>
        <p>
The message "Hooray! I'm alive!" appeared when the user hovers over our button. We
can also cutomize how our tooltip appears by adding more XAML elements in the Tooltip.Content
property.
</p>
        <p>
          <strong>[XAML]</strong>
        </p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#ff0000">&lt;UserControl
x:Class=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"KeithRull.Silverlight.CreatingTooltips.Page"</span> xmlns=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span> xmlns:x=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/winfx/2006/xaml"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"400"</span> Height=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"300"</span>&gt;
&lt;Grid x:Name=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"LayoutRoot"</span> Background=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"#FF1E238E"</span>&gt;
&lt;Button Content=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Hover
over me!"</span> Height=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"20"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"100"</span> Margin=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"30
40"</span> VerticalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Top"</span> HorizontalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Left"</span>&gt;
&lt;ToolTipService.ToolTip&gt; &lt;ToolTip Background=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"#FFFFFF"</span> Width=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"150"</span>&gt;
&lt;ToolTip.Content&gt; &lt;StackPanel&gt; &lt;Image Source=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"images/silverlight.png"</span> /&gt;
&lt;TextBlock HorizontalAlignment=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Right"</span>&gt;
It rocks like a champ! &lt;/TextBlock&gt; &lt;/StackPanel&gt; &lt;/ToolTip.Content&gt;
&lt;/ToolTip&gt; &lt;/ToolTipService.ToolTip&gt; &lt;/Button&gt; &lt;/Grid&gt; &lt;/UserControl&gt;</font>
          </span>
        </pre>
        <p>
          <strong>[Rendered UI (at runtime)]</strong>
        </p>
        <p>
          <img src="http://www.keithrull.com/content/binary/sltooltips03.JPG" border="0" />
        </p>
        <p>
Another customization that you might want to do is specifying the HorizontalOffset
and the VerticalOffset. This allows you to specify where the tooltip will appear in
reference to your target control.
</p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=db2c29aa-7a06-47b4-84e1-fdfe59aa4f39" />
      </body>
      <title>How To: Creating Tooltips in Silverlight 2</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,db2c29aa-7a06-47b4-84e1-fdfe59aa4f39.aspx</guid>
      <link>http://www.keithrull.com/2009/03/09/HowToCreatingTooltipsInSilverlight2.aspx</link>
      <pubDate>Mon, 09 Mar 2009 22:49:38 GMT</pubDate>
      <description>&lt;p&gt;
Tooltips are great additions to any interface and in this article I'm going to show
you how to attach a tooltip to control in Silverlight 2.
&lt;/p&gt;
&lt;p&gt;
To start, let's assume that we have a button that we want to add a tooltip to:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;[XAML]&lt;/strong&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#ff0000&gt;&amp;lt;UserControl
x:Class=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"KeithRull.Silverlight.CreatingTooltips.Page"&lt;/span&gt; xmlns=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt; xmlns:x=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"400"&lt;/span&gt; Height=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"300"&lt;/span&gt;&amp;gt;
&amp;lt;Grid x:Name=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"LayoutRoot"&lt;/span&gt; Background=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"#FF1E238E"&lt;/span&gt;&amp;gt;
&amp;lt;Button Content=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Hover
over me!"&lt;/span&gt; Height=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"20"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"100"&lt;/span&gt; Margin=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"30
40"&lt;/span&gt; VerticalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Top"&lt;/span&gt; HorizontalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Left"&lt;/span&gt;&amp;gt;
&amp;lt;/Button&amp;gt; &amp;lt;/Grid&amp;gt; &amp;lt;/UserControl&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;[Rendered UI]&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.keithrull.com/content/binary/sltooltips01.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
In order or us to attach a tooltip to our button we need to create a reference to
the TooltipService.Tooltip inside the our button's XAML declaration. We also need
to setup the Tooltip.Content to tell the compiler what to show when the user hover's
to our button.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;[XAML]&lt;/strong&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#ff0000&gt;&amp;lt;UserControl
x:Class=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"KeithRull.Silverlight.CreatingTooltips.Page"&lt;/span&gt; xmlns=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt; xmlns:x=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"400"&lt;/span&gt; Height=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"300"&lt;/span&gt;&amp;gt;
&amp;lt;Grid x:Name=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"LayoutRoot"&lt;/span&gt; Background=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"#FF1E238E"&lt;/span&gt;&amp;gt;
&amp;lt;Button Content=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Hover
over me!"&lt;/span&gt; Height=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"20"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"100"&lt;/span&gt; Margin=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"30
40"&lt;/span&gt; VerticalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Top"&lt;/span&gt; HorizontalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Left"&lt;/span&gt;&amp;gt;
&amp;lt;ToolTipService.ToolTip&amp;gt; &amp;lt;ToolTip&amp;gt; &amp;lt;ToolTip.Content&amp;gt; &amp;lt;TextBlock
TextWrapping=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Wrap"&lt;/span&gt;&amp;gt;
Hooray! I'm alive!. &amp;lt;/TextBlock&amp;gt; &amp;lt;/ToolTip.Content&amp;gt; &amp;lt;/ToolTip&amp;gt; &amp;lt;/ToolTipService.ToolTip&amp;gt;
&amp;lt;/Button&amp;gt; &amp;lt;/Grid&amp;gt; &amp;lt;/UserControl&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;[Rendered UI (at runtime)]&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.keithrull.com/content/binary/sltooltips02.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
The message "Hooray! I'm alive!" appeared when the user hovers over our button. We
can also cutomize how our tooltip appears by adding more XAML elements in the Tooltip.Content
property.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;[XAML]&lt;/strong&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#ff0000&gt;&amp;lt;UserControl
x:Class=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"KeithRull.Silverlight.CreatingTooltips.Page"&lt;/span&gt; xmlns=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt; xmlns:x=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"400"&lt;/span&gt; Height=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"300"&lt;/span&gt;&amp;gt;
&amp;lt;Grid x:Name=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"LayoutRoot"&lt;/span&gt; Background=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"#FF1E238E"&lt;/span&gt;&amp;gt;
&amp;lt;Button Content=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Hover
over me!"&lt;/span&gt; Height=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"20"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"100"&lt;/span&gt; Margin=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"30
40"&lt;/span&gt; VerticalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Top"&lt;/span&gt; HorizontalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Left"&lt;/span&gt;&amp;gt;
&amp;lt;ToolTipService.ToolTip&amp;gt; &amp;lt;ToolTip Background=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"#FFFFFF"&lt;/span&gt; Width=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"150"&lt;/span&gt;&amp;gt;
&amp;lt;ToolTip.Content&amp;gt; &amp;lt;StackPanel&amp;gt; &amp;lt;Image Source=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"images/silverlight.png"&lt;/span&gt; /&amp;gt;
&amp;lt;TextBlock HorizontalAlignment=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Right"&lt;/span&gt;&amp;gt;
It rocks like a champ! &amp;lt;/TextBlock&amp;gt; &amp;lt;/StackPanel&amp;gt; &amp;lt;/ToolTip.Content&amp;gt;
&amp;lt;/ToolTip&amp;gt; &amp;lt;/ToolTipService.ToolTip&amp;gt; &amp;lt;/Button&amp;gt; &amp;lt;/Grid&amp;gt; &amp;lt;/UserControl&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;[Rendered UI (at runtime)]&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.keithrull.com/content/binary/sltooltips03.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Another customization that you might want to do is specifying the HorizontalOffset
and the VerticalOffset. This allows you to specify where the tooltip will appear in
reference to your target control.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=db2c29aa-7a06-47b4-84e1-fdfe59aa4f39" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,db2c29aa-7a06-47b4-84e1-fdfe59aa4f39.aspx</comments>
      <category>.NET</category>
      <category>Silverlight</category>
      <category>Tutorial</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=abd7b862-cbf0-4381-8c68-4be0e45fcbe4</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,abd7b862-cbf0-4381-8c68-4be0e45fcbe4.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,abd7b862-cbf0-4381-8c68-4be0e45fcbe4.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=abd7b862-cbf0-4381-8c68-4be0e45fcbe4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
I just saw this twitter...
</p>
        <p>
          <img src="http://www.keithrull.com/content/binary/timetoaspnetmvc.JPG" border="0" />
        </p>
        <p>
Sweeeeet! 
</p>
        <p>
Time to start polishing my ASP.NET MVC skills. I've played with ASP.NET MVC before
but never had the chance to use it other than building small samples. I might
be rusty but I know I'll have a great companion book in learning ASP.NET
MVC 1.0 once <strong><a href="http://blog.wekeroad.com/">Rob</a></strong>, <strong><a href="http://www.hanselman.com/">Scott</a></strong>, <strong><a href="http://weblogs.asp.net/Scottgu/">Scott</a></strong> and <strong><a href="http://haacked.com/">Phil</a></strong>'s <a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;tag=diabeticbooks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0470384611"><strong>upcoming
book</strong></a> comes out.
</p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=abd7b862-cbf0-4381-8c68-4be0e45fcbe4" />
      </body>
      <title>ASP.NET MVC RC 2 Source code and Futures are now available on CodePlex</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,abd7b862-cbf0-4381-8c68-4be0e45fcbe4.aspx</guid>
      <link>http://www.keithrull.com/2009/03/04/ASPNETMVCRC2SourceCodeAndFuturesAreNowAvailableOnCodePlex.aspx</link>
      <pubDate>Wed, 04 Mar 2009 01:00:26 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
I just saw this twitter...
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.keithrull.com/content/binary/timetoaspnetmvc.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Sweeeeet! 
&lt;/p&gt;
&lt;p&gt;
Time to start polishing my ASP.NET MVC skills. I've played with ASP.NET MVC before
but never had the chance to use it&amp;nbsp;other than building small samples. I might
be rusty but I know I'll have a&amp;nbsp;great companion book&amp;nbsp;in learning ASP.NET
MVC 1.0&amp;nbsp;once &lt;strong&gt;&lt;a href="http://blog.wekeroad.com/"&gt;Rob&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a href="http://www.hanselman.com/"&gt;Scott&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a href="http://weblogs.asp.net/Scottgu/"&gt;Scott&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="http://haacked.com/"&gt;Phil&lt;/a&gt;&lt;/strong&gt;'s &lt;a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;amp;tag=diabeticbooks&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0470384611"&gt;&lt;strong&gt;upcoming
book&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;comes out.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=abd7b862-cbf0-4381-8c68-4be0e45fcbe4" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,abd7b862-cbf0-4381-8c68-4be0e45fcbe4.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>Tech News and Issues</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=52ef1f42-cb62-4527-860c-61b12e6452d3</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,52ef1f42-cb62-4527-860c-61b12e6452d3.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,52ef1f42-cb62-4527-860c-61b12e6452d3.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=52ef1f42-cb62-4527-860c-61b12e6452d3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A user a devpinoy.org <a href="http://devpinoy.org/forums/p/4648/34458.aspx"><strong>posted
a question on the forum</strong></a> section asking if there's a way to restrict files
from being saved in a directory. I know you can do this via the <strong><a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx">FileSystemWatcher</a></strong> class
so I quickly whipped my Visual Studio 2008 IDE and started building a prototype application
to demonstrate the solution.
</p>
        <p>
The first thing that you need to do is to set-up some key details on what we want
to watch/monitor
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> ALLOWED_FILE_EXTENSION <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">".doc"</span>; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> DEFAULT_WATCH_FOLDER <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">@"E:\Test
Folder\"</span>;</span>
        </pre>
        <p>
Next, the FileSystemWatcher specify what directory you want to monitor.
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">FileSystemWatcher
watcher <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> FileSystemWatcher(DEFAULT_WATCH_FOLDER);</span>
        </pre>
        <p>
After that you need to setup the notification filters on what type of filesystem changes
you want to watch;
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">watcher.NotifyFilter <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> NotifyFilters.LastAccess <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.LastWrite <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.FileName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.DirectoryName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.CreationTime;</span>
        </pre>
        <p>
And finally, we need to set-up the FileSystem events you want our FileSystem.
In this case, we only want to monitor Created and Renamed events.
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">watcher.Created
+= <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> FileSystemEventHandler(watcher_Created);
watcher.Renamed += <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> RenamedEventHandler(watcher_Renamed);</span>
        </pre>
        <p>
Now, let's start coding our event handlers.
</p>
        <p>
For our event handler, I decided to use one method that would handle both the Created
and Rename event. Ideally you want to seperate this to into two different methods
because you might want to handle the tow events differently but since all I want to
do is to block files\folders that doesn't match my criteria i decided to handle them
both using a single method called FileSystemHandler.
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> watcher_Renamed(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
RenamedEventArgs e) { FileSystemHandler(e.Name, e.FullPath); } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> watcher_Created(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
FileSystemEventArgs e) { FileSystemHandler(e.Name, e.FullPath); }</span>
        </pre>
        <p>
Below is the implementation detail for our FileSystemHandler method.
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> FileSystemHandler(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> name, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> fullpath)
{ <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">try</span> { <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//read
the contents of our directory</span> DirectoryInfo di <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> DirectoryInfo(DEFAULT_WATCH_FOLDER); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//get
the filesysteminfo[] objects</span> FileSystemInfo[] fileSystemInfoArray <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> di.GetFileSystemInfos(); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//there's
always going to be one object matching this criteria all the time</span> FileSystemInfo
found <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> fileSystemInfoArray.Single(f
=&gt; f.FullName.Equals(fullpath)); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//if
it finds something</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (found
!<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)
{ <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//cast
the found object to directoryinfo</span> DirectoryInfo d <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> found <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> DirectoryInfo; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//if
it's null it means it's a FileInfo object</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (d
== <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)
{ <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//cast
found to a fileinfo object</span> FileInfo f <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> found <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> FileInfo; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//delete
the file if the extension doesn't match our desired/allowed extension</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (!f.Extension.Equals(ALLOWED_FILE_EXTENSION))
{ f.Delete(); } } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span> { <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//directories
are not allowed on this folder too!</span> d.Delete(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);
} } } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">catch</span> { <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//let
it sleep for 30 seconds</span> Thread.Sleep(30000); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//it
failed so we need to try again recussively</span><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/*
note: it's a good idea to set a retry limit here because if we don't then the app
will retry to infinity but i'll leave that up to you. */</span> FileSystemHandler(name,
fullpath); } }</span>
        </pre>
        <p>
What the function above is doing is that it checks to see if the filesystem object
that was created on the directory is either a file or a directory. If it is a directory,
automatically delete it since we dont want any directory to be saved on our folder.
If it is a file we need to check if it's extension matches the allowed file extension.
If it matches the allowed extension we let it thru. If it doesn't we call the the
Delete method on the FileInfo object to delete the file.
</p>
        <p>
All we need to do now is to tell the watcher to start monitor our folder
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">watcher.EnableRaisingEvents <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>;</span>
        </pre>
        <p>
Setting EnableRaisingEvents to true triggers our watcher to start monitoring
the folder. Setting it to false will stop the watcher.
</p>
        <p>
And we are done! Now we have an application that blocks saving or renaming of files
in a folder that doesn't match the allowed file extension.
</p>
        <p>
Below is the full listing of the code for the demo project I built for this article:
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Linq; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Windows.Forms; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.IO; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Threading; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">namespace</span> KeithRull.FolderSpy
{ <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span> partial <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> MainForm
: Form { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bool</span> IsCurrentlyWatching <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> ALLOWED_FILE_EXTENSION <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">".doc"</span>; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> DEFAULT_WATCH_FOLDER <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">@"E:\Test
Folder\"</span>; FileSystemWatcher watcher; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span> MainForm()
{ InitializeComponent(); } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> MainForm_Load(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e) { SetUpWatcher(); } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> watchButton_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e) { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (!IsCurrentlyWatching)
{ watchButton.Text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Stop
watching"</span>; IsCurrentlyWatching <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//start
the watcher</span> watcher.EnableRaisingEvents <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>;
} <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span> {
watchButton.Text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Start
watching"</span>; IsCurrentlyWatching <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//stop
the watcher</span> watcher.EnableRaisingEvents <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>;
} } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> watcher_Renamed(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
RenamedEventArgs e) { FileSystemHandler(e.Name, e.FullPath); } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> watcher_Created(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
FileSystemEventArgs e) { FileSystemHandler(e.Name, e.FullPath); } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> FileSystemHandler(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> name, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> fullpath)
{ <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">try</span> { <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//read
the contents of our directory</span> DirectoryInfo di <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> DirectoryInfo(DEFAULT_WATCH_FOLDER); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//get
the filesysteminfo[] objects</span> FileSystemInfo[] fileSystemInfoArray <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> di.GetFileSystemInfos(); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//there's
always going to be one object matching this criteria all the time</span> FileSystemInfo
found <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> fileSystemInfoArray.Single(f
=&gt; f.FullName.Equals(fullpath)); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//if
it finds something</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (found
!<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)
{ <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//cast
the found object to directoryinfo</span> DirectoryInfo d <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> found <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> DirectoryInfo; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//if
it's null it means it's a FileInfo object</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (d
== <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)
{ <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//cast
found to a fileinfo object</span> FileInfo f <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> found <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> FileInfo; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//delete
the file if the extension doesn't match our desired/allowed extension</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (!f.Extension.Equals(ALLOWED_FILE_EXTENSION))
{ f.Delete(); } } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span> { <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//directories
are not allowed on this folder too!</span> d.Delete(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);
} } } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">catch</span> { <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//let
it sleep for 30 seconds</span> Thread.Sleep(30000); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//it
failed so we need to try again recussively</span><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/*
note: it's a good idea to set a retry limit here because if we don't then the app
will retry to infinity but i'll leave that up to you. */</span> FileSystemHandler(name,
fullpath); } } <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> SetUpWatcher()
{ watcher <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> FileSystemWatcher(DEFAULT_WATCH_FOLDER);
watcher.NotifyFilter <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> NotifyFilters.LastAccess <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.LastWrite <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.FileName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.DirectoryName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">|</span> NotifyFilters.CreationTime;
watcher.Created += <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> FileSystemEventHandler(watcher_Created);
watcher.Renamed += <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> RenamedEventHandler(watcher_Renamed);
} } }</span>
        </pre>
        <p>
As always, you can download the code for the complete project here: <a href="http://www.keithrull.com/content/binary/KeithRull.FolderSpy.zip"><strong>KeithRull.FolderSpy.zip
(40.38 KB)</strong></a></p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=52ef1f42-cb62-4527-860c-61b12e6452d3" />
      </body>
      <title>How To: Blocking\Restricting certain file types from being saved to a directory using FileSystemWatcher</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,52ef1f42-cb62-4527-860c-61b12e6452d3.aspx</guid>
      <link>http://www.keithrull.com/2009/02/25/HowToBlockingRestrictingCertainFileTypesFromBeingSavedToADirectoryUsingFileSystemWatcher.aspx</link>
      <pubDate>Wed, 25 Feb 2009 19:48:40 GMT</pubDate>
      <description>&lt;p&gt;
A user a devpinoy.org &lt;a href="http://devpinoy.org/forums/p/4648/34458.aspx"&gt;&lt;strong&gt;posted
a question on the forum&lt;/strong&gt;&lt;/a&gt; section asking if there's a way to restrict files
from being saved in a directory. I know you can do this via the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx"&gt;FileSystemWatcher&lt;/a&gt;&lt;/strong&gt; class
so I quickly whipped my Visual Studio 2008 IDE and started building a prototype application
to demonstrate the solution.
&lt;/p&gt;
&lt;p&gt;
The first thing that you need to do is to set-up some key details on what we want
to watch/monitor
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; ALLOWED_FILE_EXTENSION &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;".doc"&lt;/span&gt;; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; DEFAULT_WATCH_FOLDER &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;@"E:\Test
Folder\"&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Next, the FileSystemWatcher&amp;nbsp;specify what directory you want to monitor.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;FileSystemWatcher
watcher &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; FileSystemWatcher(DEFAULT_WATCH_FOLDER);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
After that you need to setup the notification filters on what type of filesystem changes
you want to watch;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;watcher.NotifyFilter &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; NotifyFilters.LastAccess &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.LastWrite &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.FileName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.DirectoryName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.CreationTime;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
And finally,&amp;nbsp;we need to set-up the FileSystem events you want our FileSystem.
In this case, we only want to monitor Created and Renamed events.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;watcher.Created
+= &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; FileSystemEventHandler(watcher_Created);
watcher.Renamed += &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; RenamedEventHandler(watcher_Renamed);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Now, let's start coding our event handlers.
&lt;/p&gt;
&lt;p&gt;
For our event handler, I decided to use one method that would handle both the Created
and Rename event. Ideally you want to seperate this to into two different methods
because you might want to handle the tow events differently but since all I want to
do is to block files\folders that doesn't match my criteria i decided to handle them
both using a single method called FileSystemHandler.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; watcher_Renamed(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
RenamedEventArgs e) { FileSystemHandler(e.Name, e.FullPath); } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; watcher_Created(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
FileSystemEventArgs e) { FileSystemHandler(e.Name, e.FullPath); }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Below is the implementation detail for our FileSystemHandler method.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; FileSystemHandler(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; name, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; fullpath)
{ &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;try&lt;/span&gt; { &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//read
the contents of our directory&lt;/span&gt; DirectoryInfo di &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; DirectoryInfo(DEFAULT_WATCH_FOLDER); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//get
the filesysteminfo[] objects&lt;/span&gt; FileSystemInfo[] fileSystemInfoArray &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; di.GetFileSystemInfos(); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//there's
always going to be one object matching this criteria all the time&lt;/span&gt; FileSystemInfo
found &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; fileSystemInfoArray.Single(f
=&amp;gt; f.FullName.Equals(fullpath)); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//if
it finds something&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (found
!&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)
{ &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//cast
the found object to directoryinfo&lt;/span&gt; DirectoryInfo d &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; found &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; DirectoryInfo; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//if
it's null it means it's a FileInfo object&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (d
== &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)
{ &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//cast
found to a fileinfo object&lt;/span&gt; FileInfo f &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; found &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; FileInfo; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//delete
the file if the extension doesn't match our desired/allowed extension&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (!f.Extension.Equals(ALLOWED_FILE_EXTENSION))
{ f.Delete(); } } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt; { &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//directories
are not allowed on this folder too!&lt;/span&gt; d.Delete(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;);
} } } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;catch&lt;/span&gt; { &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//let
it sleep for 30 seconds&lt;/span&gt; Thread.Sleep(30000); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//it
failed so we need to try again recussively&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/*
note: it's a good idea to set a retry limit here because if we don't then the app
will retry to infinity but i'll leave that up to you. */&lt;/span&gt; FileSystemHandler(name,
fullpath); } }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
What the function above is doing is that it checks to see if the filesystem object
that was created on the directory is either a file or a directory. If it is a directory,
automatically delete it since we dont want any directory to be saved on our folder.
If it is a file we need to check if it's extension matches the allowed file extension.
If it matches the allowed extension we let it thru. If it doesn't we call the the
Delete method on the FileInfo object to delete the file.
&lt;/p&gt;
&lt;p&gt;
All we need to do now is to tell the watcher to start monitor our folder
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;watcher.EnableRaisingEvents &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Setting EnableRaisingEvents to true&amp;nbsp;triggers our watcher to start monitoring
the folder. Setting it to false will stop the watcher.
&lt;/p&gt;
&lt;p&gt;
And we are done! Now we have an application that blocks saving or renaming of files
in a folder that doesn't match the allowed file extension.
&lt;/p&gt;
&lt;p&gt;
Below is the full listing of the code for the&amp;nbsp;demo project I built for this article:
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Linq; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Windows.Forms; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.IO; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Threading; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;namespace&lt;/span&gt; KeithRull.FolderSpy
{ &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; partial &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; MainForm
: Form { &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;bool&lt;/span&gt; IsCurrentlyWatching &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; ALLOWED_FILE_EXTENSION &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;".doc"&lt;/span&gt;; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; DEFAULT_WATCH_FOLDER &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;@"E:\Test
Folder\"&lt;/span&gt;; FileSystemWatcher watcher; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; MainForm()
{ InitializeComponent(); } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; MainForm_Load(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e) { SetUpWatcher(); } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; watchButton_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e) { &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (!IsCurrentlyWatching)
{ watchButton.Text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Stop
watching"&lt;/span&gt;; IsCurrentlyWatching &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//start
the watcher&lt;/span&gt; watcher.EnableRaisingEvents &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;;
} &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt; {
watchButton.Text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Start
watching"&lt;/span&gt;; IsCurrentlyWatching &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//stop
the watcher&lt;/span&gt; watcher.EnableRaisingEvents &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;;
} } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; watcher_Renamed(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
RenamedEventArgs e) { FileSystemHandler(e.Name, e.FullPath); } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; watcher_Created(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
FileSystemEventArgs e) { FileSystemHandler(e.Name, e.FullPath); } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; FileSystemHandler(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; name, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; fullpath)
{ &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;try&lt;/span&gt; { &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//read
the contents of our directory&lt;/span&gt; DirectoryInfo di &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; DirectoryInfo(DEFAULT_WATCH_FOLDER); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//get
the filesysteminfo[] objects&lt;/span&gt; FileSystemInfo[] fileSystemInfoArray &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; di.GetFileSystemInfos(); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//there's
always going to be one object matching this criteria all the time&lt;/span&gt; FileSystemInfo
found &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; fileSystemInfoArray.Single(f
=&amp;gt; f.FullName.Equals(fullpath)); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//if
it finds something&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (found
!&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)
{ &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//cast
the found object to directoryinfo&lt;/span&gt; DirectoryInfo d &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; found &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; DirectoryInfo; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//if
it's null it means it's a FileInfo object&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (d
== &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)
{ &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//cast
found to a fileinfo object&lt;/span&gt; FileInfo f &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; found &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; FileInfo; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//delete
the file if the extension doesn't match our desired/allowed extension&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (!f.Extension.Equals(ALLOWED_FILE_EXTENSION))
{ f.Delete(); } } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt; { &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//directories
are not allowed on this folder too!&lt;/span&gt; d.Delete(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;);
} } } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;catch&lt;/span&gt; { &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//let
it sleep for 30 seconds&lt;/span&gt; Thread.Sleep(30000); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//it
failed so we need to try again recussively&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/*
note: it's a good idea to set a retry limit here because if we don't then the app
will retry to infinity but i'll leave that up to you. */&lt;/span&gt; FileSystemHandler(name,
fullpath); } } &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; SetUpWatcher()
{ watcher &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; FileSystemWatcher(DEFAULT_WATCH_FOLDER);
watcher.NotifyFilter &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; NotifyFilters.LastAccess &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.LastWrite &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.FileName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.DirectoryName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;|&lt;/span&gt; NotifyFilters.CreationTime;
watcher.Created += &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; FileSystemEventHandler(watcher_Created);
watcher.Renamed += &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; RenamedEventHandler(watcher_Renamed);
} } }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
As always, you can download the code for the complete project&amp;nbsp;here: &lt;a href="http://www.keithrull.com/content/binary/KeithRull.FolderSpy.zip"&gt;&lt;strong&gt;KeithRull.FolderSpy.zip
(40.38 KB)&lt;/strong&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=52ef1f42-cb62-4527-860c-61b12e6452d3" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,52ef1f42-cb62-4527-860c-61b12e6452d3.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=31d51c15-7770-4913-8c32-8417fa62f27a</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,31d51c15-7770-4913-8c32-8417fa62f27a.aspx</pingback:target>
      <dc:creator>Keith Rull</dc:creator>
      <wfw:comment>http://www.keithrull.com/CommentView,guid,31d51c15-7770-4913-8c32-8417fa62f27a.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=31d51c15-7770-4913-8c32-8417fa62f27a</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p align="center">
          <img src="http://www.keithrull.com/content/binary/birth-announcement31.jpg" border="0" />
        </p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=31d51c15-7770-4913-8c32-8417fa62f27a" />
      </body>
      <title>With great joy we introduce...</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,31d51c15-7770-4913-8c32-8417fa62f27a.aspx</guid>
      <link>http://www.keithrull.com/2009/02/24/WithGreatJoyWeIntroduce.aspx</link>
      <pubDate>Tue, 24 Feb 2009 17:44:09 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p align=center&gt;
&lt;img src="http://www.keithrull.com/content/binary/birth-announcement31.jpg" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=31d51c15-7770-4913-8c32-8417fa62f27a" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,31d51c15-7770-4913-8c32-8417fa62f27a.aspx</comments>
      <category>Family</category>
      <category>Life</category>
      <category>Pregnancy</category>
    </item>
    <item>
      <trackback:ping>http://www.keithrull.com/Trackback.aspx?guid=a9197992-e3fb-41ea-beda-38b5fd3588d1</trackback:ping>
      <pingback:server>http://www.keithrull.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.keithrull.com/PermaLink,guid,a9197992-e3fb-41ea-beda-38b5fd3588d1.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.keithrull.com/CommentView,guid,a9197992-e3fb-41ea-beda-38b5fd3588d1.aspx</wfw:comment>
      <wfw:commentRss>http://www.keithrull.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a9197992-e3fb-41ea-beda-38b5fd3588d1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I had some free time during the holidays and saw at the <a href="http://2009.visitmix.com/"><strong>MIX09</strong></a> website
that they have a contest entitled <strong><a href="http://2009.visitmix.com/MIXtify/TenKGallery.aspx">MIX09
10K Challenge</a></strong> where they ask participant to create a web application that is either
using Microsoft® Silverlight™ or Windows Presentation Foundation, as a XAML Browser
Application running in Partial Trust or as a ClickOnce application in 10 kilobytes
or less. I decided to take a stab at it and this is what I've comed up with
</p>
        <p>
SilverCalendar: A Silverlight Pregancy Calendar
</p>
        <p>
          <img src="http://www.keithrull.com/content/binary/silvercalendarfullscreen.JPG" border="0" />
        </p>
        <p>
You can see the app live here <a href="http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0051">http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0051</a></p>
        <p>
Dont forget to vote when you're there :P LOL
</p>
        <p>
My primary motivation when I built the app is the idea of having something that is
going to be useful and at the same time fun to build. My wife is currently 34 weeks
pregnant and it made me think that a pregnancy calendar would be q great application
to do since it relates to me and my current day to day life. I love pregnancy calendars
because it gives you a good daily insight on the progress of your baby and what you
might expected as you go along in your daily life as a soon to be parent. 
</p>
        <p>
The application that i built is using Microsoft Silverlight 2 with a backend
WCF web service. You can find the pregnancy calendar web service <strong><a href="http://projects.devpinoy.org/services/wcf/pregnancycalendar/PregnancyCalendarService.svc">here</a></strong>.
I wasn't able to add any animations to the application because I decided to concentrate
in adding functionality to app rather than the eye candy' With that said, I'll be
posting the non-10K application this week.
</p>
        <p>
Be sure to comeback on this blog in the coming weeks because I'll be publishing the
source code to both project soon together with a 11 part tutorial and screencast
walkthrough that i have prepared to show how to to build an application using .NET
3.5, WCF, WPF and Silverlight.
</p>
        <img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=a9197992-e3fb-41ea-beda-38b5fd3588d1" />
      </body>
      <title>My MIX09 10K Contest Entry: Silverlight Pregnancy Calendar</title>
      <guid isPermaLink="false">http://www.keithrull.com/PermaLink,guid,a9197992-e3fb-41ea-beda-38b5fd3588d1.aspx</guid>
      <link>http://www.keithrull.com/2009/01/08/MyMIX0910KContestEntrySilverlightPregnancyCalendar.aspx</link>
      <pubDate>Thu, 08 Jan 2009 19:47:35 GMT</pubDate>
      <description>&lt;p&gt;
I had some free time during the holidays and saw at the &lt;a href="http://2009.visitmix.com/"&gt;&lt;strong&gt;MIX09&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;website
that they have&amp;nbsp;a contest entitled &lt;strong&gt;&lt;a href="http://2009.visitmix.com/MIXtify/TenKGallery.aspx"&gt;MIX09
10K Challenge&lt;/a&gt;&lt;/strong&gt; where they ask participant to create a web application&amp;nbsp;that&amp;nbsp;is&amp;nbsp;either
using Microsoft® Silverlight™ or Windows Presentation Foundation, as a XAML Browser
Application running in Partial Trust or as a ClickOnce application in 10 kilobytes
or less. I decided to take a stab at it and this is what I've comed up with
&lt;/p&gt;
&lt;p&gt;
SilverCalendar: A Silverlight Pregancy Calendar
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.keithrull.com/content/binary/silvercalendarfullscreen.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
You can see the app live here &lt;a href="http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0051"&gt;http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0051&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Dont forget to vote when you're there :P LOL
&lt;/p&gt;
&lt;p&gt;
My primary motivation when I built the app is the idea of having something that is
going to be useful and at the same time fun to build. My wife is currently 34 weeks
pregnant and it made me think that a pregnancy calendar would be q great application
to do since it relates to me and my current day to day life. I love pregnancy calendars
because it gives you a good daily insight on the progress of your baby and what you
might expected as you go along in your daily life as a soon to be parent.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The application that i&amp;nbsp;built is&amp;nbsp;using Microsoft Silverlight 2 with a backend
WCF web service.&amp;nbsp;You can find the pregnancy calendar web service &lt;strong&gt;&lt;a href="http://projects.devpinoy.org/services/wcf/pregnancycalendar/PregnancyCalendarService.svc"&gt;here&lt;/a&gt;&lt;/strong&gt;.
I wasn't able to add any animations to the application because I decided to concentrate
in adding functionality to app rather than the eye candy' With that said, I'll be
posting the non-10K application this week.
&lt;/p&gt;
&lt;p&gt;
Be sure to comeback on this blog in the coming weeks because I'll be publishing the
source code to both project&amp;nbsp;soon together with a 11 part tutorial and screencast
walkthrough that i have prepared to show how to to build an application using .NET
3.5, WCF, WPF and Silverlight.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.keithrull.com/aggbug.ashx?id=a9197992-e3fb-41ea-beda-38b5fd3588d1" /&gt;</description>
      <comments>http://www.keithrull.com/CommentView,guid,a9197992-e3fb-41ea-beda-38b5fd3588d1.aspx</comments>
      <category>.NET</category>
      <category>All about Keith</category>
      <category>Contest</category>
      <category>Family</category>
      <category>Fun Stuff</category>
      <category>Tutorial</category>
      <category>WPF</category>
      <category>WCF</category>
      <category>Silverlight</category>
      <category>Pregnancy</category>
    </item>
  </channel>
</rss>