Example #1
0
        /// <summary>
        /// Helper that performs our asynchronous GetFiles.
        /// </summary>
        private void DoGetFilesAsync(object asyncState)
        {
            // set our processor affinity
            SetProcessorAffinity();

            FileOperationState state = asyncState as FileOperationState;
            Exception          error = null;

            string[] result = null;

            // perform the GetFiles operation
            try
            {
                result = GetFiles(state.Container, state.Pattern);
            }
            catch (Exception e)
            {
                error = e;
            }

            // construct our event arguments
            GetFilesCompletedEventArgs args = new GetFilesCompletedEventArgs(error, result, state.UserState);

            // fire our completion event
            if (GetFilesCompleted != null)
            {
                GetFilesCompleted(this, args);
            }

            // recycle our state object
            ReturnFileOperationState(state);

            // decrement our pending operation count
            PendingOperationsDecrement();
        }
Example #2
0
        /// <summary>
        /// Helper that performs our asynchronous GetFiles.
        /// </summary>
        private void DoGetFilesAsync(Object asyncState)
        {
            FileOperationState state = asyncState as FileOperationState;
            Exception          error = null;

            String[] result = null;

            // perform the GetFiles operation
            try
            {
                result = GetFiles(state.Container, state.Pattern, state.Location);
            }
            catch (Exception e)
            {
                error = e;
            }

            // construct our event arguments
            GetFilesCompletedEventArgs args = new GetFilesCompletedEventArgs(error, result, state.UserState);

            // fire our completion event
            GetFilesCompleted(this, args);

            // recycle our state Object
            ReturnFileOperationState(state);

            // decrement our pending operation count
            PendingOperationsDecrement();
        }
		/// <summary>
		/// Helper that performs our asynchronous GetFiles.
		/// </summary>
		private void DoGetFilesAsync(Object asyncState)
		{
			FileOperationState state = asyncState as FileOperationState;
			Exception error = null;
			String[] result = null;

			// perform the GetFiles operation
			try
			{
				result = GetFiles(state.Container, state.Pattern, state.Location);
			}
			catch (Exception e)
			{
				error = e;
			}

			// construct our event arguments
			GetFilesCompletedEventArgs args = new GetFilesCompletedEventArgs(error, result, state.UserState);

			// fire our completion event
			GetFilesCompleted(this, args);

			// recycle our state Object
			ReturnFileOperationState(state);

			// decrement our pending operation count
			PendingOperationsDecrement();
		}