/// <summary>
		/// Shows a wait dialog.
		/// </summary>
		/// <param name="titleName">Title of the wait dialog</param>
		/// <param name="allowCancel">Specifies whether a cancel button should be shown.</param>
		/// <returns>AsynchronousWaitDialog object - you can use it to access the wait dialog's properties.
		/// To close the wait dialog, call Dispose() on the AsynchronousWaitDialog object</returns>
		public static AsynchronousWaitDialog ShowWaitDialog(string titleName, bool allowCancel)
		{
			if (titleName == null)
				throw new ArgumentNullException("titleName");
			AsynchronousWaitDialog h = new AsynchronousWaitDialog(titleName, allowCancel);
			h.Start();
			return h;
		}
        /// <summary>
        /// Shows a wait dialog that does not support cancelling and waits for an asynchronous operation to end.
        /// </summary>
        /// <param name="titleName">Title of the wait dialog</param>
        /// <param name="allowCancel">Specifies whether a cancel button should be shown.</param>
        /// <param name="defaultTaskName">The default description text, if no named task is active.</param>
        /// <param name="asyncOperation">Asynchronous operation to be executed.</param>
        /// <returns>AsynchronousWaitDialog object - you can use it to access the wait dialog's properties.
        /// To close the wait dialog, call Dispose() on the AsynchronousWaitDialog object</returns>
        public static void ShowWaitDialogForAsyncOperation(string titleName, string defaultTaskName, Action <IProgressMonitor> asyncOperation)
        {
            if (titleName == null)
            {
                throw new ArgumentNullException("titleName");
            }
            AsynchronousWaitDialog h = new AsynchronousWaitDialog(titleName, defaultTaskName, false, asyncOperation);

            h.StartWithAsyncOperation();
        }
        /// <summary>
        /// Shows a wait dialog that does not support cancelling.
        /// </summary>
        /// <param name="titleName">Title of the wait dialog</param>
        /// <param name="allowCancel">Specifies whether a cancel button should be shown.</param>
        /// <param name="defaultTaskName">The default description text, if no named task is active.</param>
        /// <returns>AsynchronousWaitDialog object - you can use it to access the wait dialog's properties.
        /// To close the wait dialog, call Dispose() on the AsynchronousWaitDialog object</returns>
        public static AsynchronousWaitDialog ShowWaitDialog(string titleName, string defaultTaskName, bool allowCancel)
        {
            if (titleName == null)
            {
                throw new ArgumentNullException("titleName");
            }
            AsynchronousWaitDialog h = new AsynchronousWaitDialog(titleName, defaultTaskName, allowCancel, null);

            h.StartInThread();
            return(h);
        }
예제 #4
0
        /// <summary>
        /// Shows a wait dialog.
        /// </summary>
        /// <param name="titleName">Title of the wait dialog</param>
        /// <returns>AsynchronousWaitDialog object - you can use it to access the wait dialog's properties.
        /// To close the wait dialog, call Dispose() on the AsynchronousWaitDialog object</returns>
        public static AsynchronousWaitDialog ShowWaitDialog(string titleName)
        {
            if (titleName == null)
            {
                throw new ArgumentNullException("titleName");
            }
            AsynchronousWaitDialog h = new AsynchronousWaitDialog(titleName, false);

            h.Start();
            return(h);
        }
 /// <summary>
 /// Shows a wait dialog that does supports cancelling.
 /// </summary>
 /// <param name="titleName">Title of the wait dialog</param>
 /// <param name="defaultTaskName">The default description text, if no named task is active.</param>
 /// <param name="action">The action to run within the wait dialog</param>
 public static void RunInCancellableWaitDialog(string titleName, string defaultTaskName, Action <AsynchronousWaitDialog> action)
 {
     if (titleName == null)
     {
         throw new ArgumentNullException("titleName");
     }
     using (AsynchronousWaitDialog h = new AsynchronousWaitDialog(titleName, defaultTaskName, true, null)) {
         h.StartInThread();
         try {
             action(h);
         } catch (OperationCanceledException ex) {
             // consume OperationCanceledException
             if (ex.CancellationToken != h.CancellationToken)
             {
                 throw;
             }
         }
     }
 }
예제 #6
0
		/// <summary>
		/// Shows a wait dialog that does supports cancelling.
		/// </summary>
		/// <param name="titleName">Title of the wait dialog</param>
		/// <param name="defaultTaskName">The default description text, if no named task is active.</param>
		/// <param name="action">The action to run within the wait dialog</param>
		public static void RunInCancellableWaitDialog(string titleName, string defaultTaskName, Action<AsynchronousWaitDialog> action)
		{
			if (titleName == null)
				throw new ArgumentNullException("titleName");
			using (AsynchronousWaitDialog h = new AsynchronousWaitDialog(titleName, defaultTaskName, true)) {
				h.Start();
				try {
					action(h);
				} catch (OperationCanceledException ex) {
					// consume OperationCanceledException
					if (ex.CancellationToken != h.CancellationToken)
						throw;
				}
			}
		}