We did a disposable class that changes the cursor for us when the app is going to take long, it looks like this:
public class WaitCursor : IDisposable
{
private Cursor _previousCursor;
public WaitCursor()
{
_previousCursor = Mouse.OverrideCursor;
Mouse.OverrideCursor = Cursors.Wait;
}
#region IDisposable Members
public void Dispose()
{
Mouse.OverrideCursor = _previousCursor;
}
#endregion
}
And we use it like this:
using(new WaitCursor())
{
// very long task
}
Might not be the greatest design, but it does the trick =)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…