void OnAbandonCompleted(object state) { EventHandler <AsyncCompletedEventArgs> abortCompleted = this.AbandonCompleted; if (abortCompleted != null) { InvokeAsyncCompletedEventArgs e = (InvokeAsyncCompletedEventArgs)state; abortCompleted(this, new AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState)); } }
private static void CompleteAsyncCall(AsyncOperationContext context, object[] results, Exception error) { if (context.CompletionCallback != null) { InvokeAsyncCompletedEventArgs e = new InvokeAsyncCompletedEventArgs(results, error, false, context.AsyncOperation.UserSuppliedState); context.AsyncOperation.PostOperationCompleted(context.CompletionCallback, e); } else { context.AsyncOperation.OperationCompleted(); } }
private void OnGetDataUsingDataContractCompleted(object state) { if (GetDataUsingDataContractCompleted == null) { return; } InvokeAsyncCompletedEventArgs completedEventArgs = (InvokeAsyncCompletedEventArgs)state; GetDataUsingDataContractCompleted(this, new GetDataUsingDataContractCompletedEventArgs(completedEventArgs.Results, completedEventArgs.Error, completedEventArgs.Cancelled, completedEventArgs.UserState)); }
//IAsyncResult delegate_async; void RunCompletedCallback(SendOrPostCallback callback, InvokeAsyncCompletedEventArgs args) { #if !NET_2_1 || MONOTOUCH callback(args); #else object dispatcher = dispatcher_main_property.GetValue(null, null); if (dispatcher == null) { callback(args); return; } EventHandler a = delegate { try { callback(args); Console.WriteLine("ClientBase<TChannel>: operationCompletedCallback is successfully done (unless the callback has further async operations)"); } catch (Exception ex) { Console.WriteLine("ClientBase<TChannel> caught an error during operationCompletedCallback: " + ex); throw; } }; dispatcher_begin_invoke_method.Invoke(dispatcher, new object [] { a, new object [] { this, new EventArgs() } }); #endif }
/// <summary> /// Process an inbound message in a synchronous manner /// </summary> public Message ProcessInboundMessage(Message m) { // This is a synchronous method (for now) because we need // to maintain compatiblity with the Everest Framework. // TODO: Make this async. AutoResetEvent resetEvent = new AutoResetEvent(false); Message result = null; BeginOperationDelegate bod = new BeginOperationDelegate(this.OnBeginProcessInboundMessage); EndOperationDelegate eod = new EndOperationDelegate(this.OnEndProcessMessage); SendOrPostCallback sopcb = new SendOrPostCallback( delegate(object state) { InvokeAsyncCompletedEventArgs e = state as InvokeAsyncCompletedEventArgs; result = e.Results[0] as Message; // Pulse the waiting async to let it know its been set resetEvent.Set(); } ); base.InvokeAsync(bod, new object[] { m }, eod, sopcb, null); resetEvent.WaitOne(); return(result); }
//IAsyncResult delegate_async; void RunCompletedCallback(SendOrPostCallback callback, InvokeAsyncCompletedEventArgs args) { callback(args); }
private void OnCloseCompleted(object state) { if ((this.CloseCompleted != null)) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState)); } }
private void OnGetLoggingLevelCompleted(object state) { if ((this.GetLoggingLevelCompleted != null)) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.GetLoggingLevelCompleted(this, new GetLoggingLevelCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } }
public void WebCallbackAsync(string username, string number) { ClientBase <ICallManagerServiceProxy> .BeginOperationDelegate beginWebCallback = (i, c, s) => { return(Channel.BeginWebCallback(username, number, c, s)); }; ClientBase <ICallManagerServiceProxy> .EndOperationDelegate endWebCallback = (r) => { string retVal = Channel.EndWebCallback(r); return(new object[] { retVal }); }; SendOrPostCallback completeWebCallback = (s) => { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(s)); WebCallbackComplete(this, new CompletedEventArgs <string>(e.Results, e.Error, e.Cancelled, e.UserState)); }; base.InvokeAsync(beginWebCallback, null, endWebCallback, completeWebCallback, null); }
public void IsAliveAsync() { ClientBase <ICallManagerServiceProxy> .BeginOperationDelegate beginIsAlive = (i, c, s) => { return(Channel.BeginIsAlive(c, s)); }; ClientBase <ICallManagerServiceProxy> .EndOperationDelegate endIsAlive = (r) => { bool retVal = Channel.EndIsAlive(r); return(new object[] { retVal }); }; SendOrPostCallback completeIsAlive = (s) => { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(s)); IsAliveComplete(this, new CompletedEventArgs <bool>(e.Results, e.Error, e.Cancelled, e.UserState)); }; base.InvokeAsync(beginIsAlive, null, endIsAlive, completeIsAlive, null); }
private void OnUpdateRecordCompleted(object state) { if ((this.UpdateRecordCompleted != null)) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.UpdateRecordCompleted(this, new UpdateRecordCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } }
private void OnSocialMediaNotificationOptionsCompleted(object state) { if ((this.SocialMediaNotificationOptionsCompleted != null)) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.SocialMediaNotificationOptionsCompleted(this, new SocialMediaNotificationOptionsCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } }
private void OnRetrieveSocialMediaTypesCompleted(object state) { if ((this.RetrieveSocialMediaTypesCompleted != null)) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.RetrieveSocialMediaTypesCompleted(this, new RetrieveSocialMediaTypesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } }