Created
November 17, 2009 13:49
-
-
Save jfromaniello/236905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Input; | |
namespace Mantenimiento.ViewModels | |
{ | |
/// <summary> | |
/// This class implements a disposable WaitCursor to | |
/// show an hourglass while some long-running event occurs. | |
/// </summary> | |
/// <example> | |
/// <![CDATA[ | |
/// | |
/// using (new WaitCursor()) | |
/// { | |
/// .. Do work here .. | |
/// } | |
/// | |
/// ]]> | |
/// </example> | |
public class WaitCursor : IDisposable | |
{ | |
#region Data | |
private readonly Cursor oldCursor; | |
#endregion | |
#region Ctor | |
/// <summary> | |
/// Constructor | |
/// </summary> | |
public WaitCursor() | |
{ | |
oldCursor = Mouse.OverrideCursor; | |
Mouse.OverrideCursor = Cursors.Wait; | |
} | |
#endregion | |
#region Public Methods | |
/// <summary> | |
/// Returns the cursor to the default state. | |
/// </summary> | |
public void Dispose() | |
{ | |
Mouse.OverrideCursor = oldCursor; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment