<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.refactormycode.com,2007:users10</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/10" rel="self"/>
  <title>D_Guidi</title>
  <updated>Fri Sep 28 03:41:53 -0700 2007</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor89</id>
    <published>2007-09-28T03:41:53-07:00</published>
    <title>[C#] On .NET BusyIndicator</title>
    <content type="html">&lt;p&gt;Cool :)
&lt;br /&gt;A suggest, You could (i think, looking at msdn: &lt;a href="http://tinyurl.com/26rqaq" target="_blank"&gt;http://tinyurl.com/26rqaq&lt;/a&gt;) use a Control instead of a Form as a parameter... right?&lt;/p&gt;

&lt;pre&gt;public class WaitCursor: IDisposable
{
  public WaitCursor(Control control)
  {
    control.UseWaitCursor = true
  }
  
  public void Dispose()
  {
    control.UseWaitCursor = false
  }
}&lt;/pre&gt;</content>
    <author>
      <name>D_Guidi</name>
      <email>diegoguidi@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/18-net-busyindicator/refactors/89" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor65</id>
    <published>2007-09-28T00:10:43-07:00</published>
    <title>[C#] On .NET BusyIndicator</title>
    <content type="html">&lt;p&gt;I agree with you, Darius.
&lt;br /&gt;Simply, i need to store cursor's status in a field before the invoke, and use this field to restore the correct status in the callback.
&lt;br /&gt;Thanks for the suggest ;)&lt;/p&gt;

&lt;p&gt;P.S: this service is so cool :)&lt;/p&gt;

&lt;pre&gt;&lt;/pre&gt;</content>
    <author>
      <name>D_Guidi</name>
      <email>diegoguidi@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/18-net-busyindicator/refactors/65" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor45</id>
    <published>2007-09-27T00:41:46-07:00</published>
    <title>[C#] On .NET BusyIndicator</title>
    <content type="html">&lt;p&gt;I've tested the code and this indicator is something like &amp;quot;Control-specific&amp;quot;: this means that the BusyIndicator is showed only when the mouse is under the specific control, and not globally showed (better solutions exists for a global busy indicator using Cursor.Current).
&lt;br /&gt;This means that you could use (i think) more than one of this snippets at the same time, using different components as &amp;quot;host&amp;quot;.
&lt;br /&gt;Now a better solution for a global wait cursor.&lt;/p&gt;

&lt;pre&gt;##code provided by &amp;lt;a href=&amp;quot;http://blogs.ugidotnet.org/Crad/Default.aspx&amp;quot;&amp;gt;Marco De Sanctis&amp;lt;/a&amp;gt; 
public class WaitCursor: IDisposable
{
public WaitCursor()
{
Cursor.Current = Cursors.WaitCursor;
}
public void Dispose()
{
Cursor.Current = Cursors.Default;
}
}

##usage
using (new WaitCursor())
{
// some code here
}
&lt;/pre&gt;</content>
    <author>
      <name>D_Guidi</name>
      <email>diegoguidi@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/18-net-busyindicator/refactors/45" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Code18</id>
    <published>2007-09-26T23:40:49-07:00</published>
    <updated>2008-09-23T20:29:19-07:00</updated>
    <title>[C#] .NET BusyIndicator</title>
    <content type="html">&lt;p&gt;Show a BusyIndicator during long-tasks execution.&lt;/p&gt;

&lt;pre&gt;##code
public static class BusyIndicator
{
private static readonly AsyncCallback   nullCallback    = delegate { };
        private static readonly object[]        emptyArray      = new object[] { };

        public static void ShowWhile(Control control, ThreadStart method)
        {
            if (method == null)
                throw new ArgumentException(&amp;quot;Missing method definition&amp;quot;, &amp;quot;method&amp;quot;);

            if (control == null)
            {
                method.BeginInvoke(nullCallback, emptyArray);
                return;
            }

            control.Cursor = Cursors.WaitCursor;
            MethodInvoker callback = delegate   { control.Cursor = Cursors.Default; };
            AsyncCallback invoke   = delegate   { control.Invoke(callback); };
            method.BeginInvoke(invoke, emptyArray);           
        }
    }

##sample usage
BusyIndicator.ShowWhile(this, delegate
{
    // Do stuff
});&lt;/pre&gt;</content>
    <author>
      <name>D_Guidi</name>
      <email>diegoguidi@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/18-net-busyindicator" rel="alternate"/>
  </entry>
</feed>

