views:

19

answers:

2

Hi,

How do I programmatically show the waiting icon on Windows Mobile 6?

It should be easy to do, but I could not google it since there are so many waiting icon replacements out there... :-)

Thanks,

Adrian

+1  A: 

You mean the wait cursor?

using System.Windows.Forms;
Cursor.Current = Cursors.WaitCursor;
PaulG
+2  A: 

Something like this is somewhat useful:

class WaitCursor : IDisposable
{
    public WaitCursor()
    {
        Cursor.Current = Cursors.WaitCursor;
    }

    public void Dispose()
    {
        Cursor.Current = Cursors.Default;
    }
}

It allows you to make use of "using" blocks to return to the default cursor even if you have an exception or a return:

public Foo()
{
    using (var c = new WaitCursor())
    {
       // do long-running stuff
       // when we exit the using block, the cursor will return to the default state
    }
}
ctacke