コード例 #1
0
		public void Invoke (AsyncOperation methodCall, int timeout)
		{
			methodCall.Aborted = false;
			methodCall.Manager = this;

			lock (operationsToCancel) {
				operationsToCancel.Add (methodCall);
				methodCall.Invoke ();
			}

			if (timeout != -1) {
				if (!methodCall.WaitForCompleted (timeout)) {
					bool wasAborted = methodCall.Aborted;
					methodCall.InternalAbort ();
					lock (operationsToCancel) {
						operationsToCancel.Remove (methodCall);
						ST.Monitor.PulseAll (operationsToCancel);
					}
					if (wasAborted)
						throw new EvaluatorException ("Aborted.");
					else
						throw new TimeOutException ();
				}
			}
			else {
				methodCall.WaitForCompleted (System.Threading.Timeout.Infinite);
			}

			lock (operationsToCancel) {
				operationsToCancel.Remove (methodCall);
				ST.Monitor.PulseAll (operationsToCancel);
				if (methodCall.Aborted) {
					throw new EvaluatorException ("Aborted.");
				}
			}

			if (!string.IsNullOrEmpty (methodCall.ExceptionMessage)) {
				throw new Exception (methodCall.ExceptionMessage);
			}
		}
コード例 #2
0
		public void AsyncExecute (AsyncOperation operation, int timeout)
		{
			asyncOperationManager.Invoke (operation, timeout);
		}
コード例 #3
0
 public void LeaveBusyState(AsyncOperation oper)
 {
     BusyStateEventArgs args = new BusyStateEventArgs ();
     args.IsBusy = false;
     args.Description = oper.Description;
     if (BusyStateChanged != null)
         BusyStateChanged (this, args);
 }
コード例 #4
0
 public void AsyncExecute(AsyncOperation operation, int timeout)
 {
     asyncOperationManager.Invoke(operation, timeout);
 }