public void saveAsync(string userId, string firstName, string lastName, string emailAddress, string locationName, int groupId, string savedByUser, object userState)
 {
     if ((this.onBeginsaveDelegate == null))
     {
         this.onBeginsaveDelegate = new BeginOperationDelegate(this.OnBeginsave);
     }
     if ((this.onEndsaveDelegate == null))
     {
         this.onEndsaveDelegate = new EndOperationDelegate(this.OnEndsave);
     }
     if ((this.onsaveCompletedDelegate == null))
     {
         this.onsaveCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnsaveCompleted);
     }
     base.InvokeAsync(this.onBeginsaveDelegate, new object[] {
         userId,
         firstName,
         lastName,
         emailAddress,
         locationName,
         groupId,
         savedByUser
     }, this.onEndsaveDelegate, this.onsaveCompletedDelegate, userState);
 }
Exemple #2
0
 public void ExportWebAsync(string jobName, string webUrl, string dataPath, bool includeSubwebs, bool includeUserSecurity, bool overWrite, int cabSize, object userState)
 {
     if ((this.onBeginExportWebDelegate == null))
     {
         this.onBeginExportWebDelegate = new BeginOperationDelegate(this.OnBeginExportWeb);
     }
     if ((this.onEndExportWebDelegate == null))
     {
         this.onEndExportWebDelegate = new EndOperationDelegate(this.OnEndExportWeb);
     }
     if ((this.onExportWebCompletedDelegate == null))
     {
         this.onExportWebCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnExportWebCompleted);
     }
     base.InvokeAsync(this.onBeginExportWebDelegate, new object[] {
         jobName,
         webUrl,
         dataPath,
         includeSubwebs,
         includeUserSecurity,
         overWrite,
         cabSize
     }, this.onEndExportWebDelegate, this.onExportWebCompletedDelegate, userState);
 }
        protected void InvokeAsync(BeginOperationDelegate beginOperationDelegate, object[] inValues, EndOperationDelegate endOperationDelegate, SendOrPostCallback competionCallback, object state)
        {
            SynchronizationContext syncContext = SynchronizationContext.Current;

            AsyncCallback completion = delegate(IAsyncResult result)
            {
                Exception error   = null;
                object[]  results = {};
                try
                {
                    results = endOperationDelegate(result);
                }
                catch (Exception exception)
                {
                    error = exception;
                }
                InvokeAsyncCompletedEventArgs completedEventArgs = new InvokeAsyncCompletedEventArgs(error, result.AsyncState);
                completedEventArgs.Results = results;
                if (syncContext == null)
                {
                    competionCallback(completedEventArgs);
                }
                else
                {
                    SendOrPostCallback send = delegate(object asyncResult)
                    {
                        competionCallback(asyncResult);
                    };
                    syncContext.Send(send, completedEventArgs);
                }
            };

            beginOperationDelegate(inValues, completion, state);
        }
Exemple #4
0
 internal AsyncOperationContext(AsyncOperation asyncOperation, EndOperationDelegate endDelegate, SendOrPostCallback completionCallback)
 {
     AsyncOperation      = asyncOperation;
     EndDelegate         = endDelegate;
     _completionCallback = completionCallback;
 }
        protected void InvokeAsync(BeginOperationDelegate <TChannel> beginOperationDelegate, object[] inValues, EndOperationDelegate <TChannel> endOperationDelegate, SendOrPostCallback operationCompletedCallback, object userState)
        {
            if (beginOperationDelegate == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("beginOperationDelegate");
            }
            if (endOperationDelegate == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endOperationDelegate");
            }
            AsyncOperationContext <TChannel> state = new AsyncOperationContext <TChannel>(AsyncOperationManager.CreateOperation(userState), endOperationDelegate, operationCompletedCallback);
            Exception error = null;

            object[]     results = null;
            IAsyncResult result  = null;

            try
            {
                result = beginOperationDelegate(inValues, ClientBase <TChannel> .onAsyncCallCompleted, state);
                if (result.CompletedSynchronously)
                {
                    results = endOperationDelegate(result);
                }
            }
            catch (Exception exception2)
            {
                if (Fx.IsFatal(exception2))
                {
                    throw;
                }
                error = exception2;
            }
            if ((error != null) || result.CompletedSynchronously)
            {
                ClientBase <TChannel> .CompleteAsyncCall(state, results, error);
            }
        }