Ejemplo n.º 1
0
 private static void HandleError(OperationBase op, ref Exception error)
 {
     if (op.HasError)
     {
         error = op.Error;
         op.MarkErrorAsHandled();
     }
 }
        /// <summary>
        /// Handles completion of the underlying operation in the <see cref="DomainContext"/>.
        /// </summary>
        /// <param name="operation">The operation that completed</param>
        private void HandleOperationComplete(OperationBase operation)
        {
            WebAsyncResult result = ((WebAsyncResult)operation.UserState);

            if (operation.HasError)
            {
                operation.MarkErrorAsHandled();
            }
            if (!operation.IsCanceled)
            {
                result.Complete();
            }
        }
Ejemplo n.º 3
0
        private void OnOperationCompleted(object sender, EventArgs e)
        {
            OperationBase operation = (OperationBase)sender;

            progressIndicator.Visibility = Visibility.Collapsed;
            operation.Completed         -= OnOperationCompleted;

            if (operation.HasError && (operation.IsErrorHandled == false))
            {
                MessageBox.Show(operation.Error.Message, "Error", MessageBoxButton.OK);
                operation.MarkErrorAsHandled();
            }
        }
Ejemplo n.º 4
0
        private void RaiseLoadCompleted(OperationBase op)
        {
            if (op.HasError)
            {
                op.MarkErrorAsHandled();
            }

            AsyncCompletedEventHandler handler = this.LoadCompleted;

            if (handler != null)
            {
                handler(this, new AsyncCompletedEventArgs(op.Error, op.IsCanceled, op.UserState));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles completion of the underlying operation in the <see cref="DomainContext"/>.
        /// </summary>
        /// <param name="operation">The operation that completed</param>
        private void HandleOperationComplete(OperationBase operation)
        {
            WebAsyncResult result = ((WebAsyncResult)operation.UserState);

            // If the submic callback is executed before the BeginMethod has set InnerOparation
            // then do so here before calling Complete.
            // Since there is a race condition otherwise
            if (result.InnerOperation == null)
            {
                result.InnerOperation = operation;
            }

            if (operation.HasError)
            {
                operation.MarkErrorAsHandled();
            }
            if (!operation.IsCanceled)
            {
                result.Complete();
            }
        }
Ejemplo n.º 6
0
        private bool ProcessError(OperationBase op)
        {
            if (op.HasError)
            {
                op.MarkErrorAsHandled();
                Error = op.Error;

                return true;
            }

            return false;
        }
 /// <summary>
 /// Handles completion of the underlying operation in the <see cref="DomainContext"/>.
 /// </summary>
 /// <param name="operation">The operation that completed</param>
 private void HandleOperationComplete(OperationBase operation)
 {
     WebAsyncResult result = ((WebAsyncResult)operation.UserState);
     if (operation.HasError)
     {
         operation.MarkErrorAsHandled();
     }
     if (!operation.IsCanceled)
     {
         result.Complete();
     }
 }
Ejemplo n.º 8
0
        private void RaiseLoadCompleted(OperationBase op)
        {
            if (op.HasError)
            {
                op.MarkErrorAsHandled();
            }

            AsyncCompletedEventHandler handler = this.LoadCompleted;
            if (handler != null)
            {
                handler(this, new AsyncCompletedEventArgs(op.Error, op.IsCanceled, op.UserState));
            }
        }