예제 #1
0
        /// <summary>
        /// Helper that performs our asynchronous deleting.
        /// </summary>
        private void DoDeleteAsync(object asyncState)
        {
            FileOperationState state = asyncState as FileOperationState;
            Exception          error = null;

            // perform the delete operation
            try
            {
                Delete(state.Container, state.File);
            }
            catch (Exception e)
            {
                error = e;
            }

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

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

            // recycle our state object
            ReturnFileOperationState(state);

            // decrement our pending operation count
            PendingOperationsDecrement();
        }
예제 #2
0
        /// <summary>
        /// Helper that performs our asynchronous loading.
        /// </summary>
        private void DoLoadAsync(object asyncState)
        {
            // set our processor affinity
            SetProcessorAffinity();

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

            // perform the load operation
            try
            {
                Load(state.Container, state.File, state.Action);
            }
            catch (Exception e)
            {
                error = e;
            }

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

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

            // recycle our state object
            ReturnFileOperationState(state);

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