Exemple #1
0
		/// <summary>
		/// Constructor. Uses the given form.
		/// </summary>
		/// <param name="owner">The form to set/reset the cursor.</param>
		/// <param name="options">The options.</param>
		public WaitCursor(
			Control owner,
			WaitCursorOption options )
		{
			Init( owner, options );
		}
Exemple #2
0
		/// <summary>
		/// Constructor. Uses the given form.
		/// </summary>
		/// <param name="owner">The form to set/reset the cursor.</param>
		/// <param name="options">The options.</param>
		public WaitCursor(
			Form owner,
			WaitCursorOption options )
		{
			Init( owner, options );
		}
Exemple #3
0
		// ------------------------------------------------------------------
		#endregion

		#region Private members.
		// ------------------------------------------------------------------

		/// <summary>
		/// Inits the specified owner.
		/// </summary>
		/// <param name="owner">The owner.</param>
		/// <param name="options">The options.</param>
		private void Init(
			Control owner,
			WaitCursorOption options )
		{
			if ( owner != null )
			{
				if ( !(owner is Form) )
				{
					Form form = owner.FindForm();
					if ( form != null )
					{
						owner = form;
					}
				}

				startDate = DateTime.Now;

				this.owner = owner;
				this.previousCursor = this.owner.Cursor;
				this.owner.Cursor = Cursors.WaitCursor;

				if ( (options & WaitCursorOption.ShortSleep) != 0 )
				{
					Thread.Sleep( 100 );
				}
				if ( (options & WaitCursorOption.DoEvents) != 0 )
				{
					Application.DoEvents();
				}
			}
		}
Exemple #4
0
		/// <summary>
		/// Constructor. Uses the current active form.
		/// </summary>
		/// <param name="options">The options.</param>
		public WaitCursor(
			WaitCursorOption options )
		{
			Init( Form.ActiveForm, options );
		}
Exemple #5
0
		/// <summary>
		/// Constructor. Uses the given form.
		/// </summary>
		/// <param name="owner">The form to set/reset the cursor.</param>
		/// <param name="options">The options.</param>
		public WaitCursor(
			IWin32Window owner,
			WaitCursorOption options )
		{
			Debug.Assert(
				owner is Form ||
				owner is Control,
				@"The passed IWin32Window is not a Form or Control." );

			Init( owner as Form, options );
		}