public MsgRegisterCompletionEvent(CompletionEnlistment completion, ref Register register, RequestAsyncResult result, CompletionParticipantProxy proxy) : base(completion) { this.register = register; proxy.AddRef(); this.proxy = proxy; this.result = result; }
public MsgRegisterEvent(ParticipantEnlistment participant, ref Register register, RequestAsyncResult result) : base(participant) { this.register = register; this.result = result; }
public virtual IAsyncResult BeginRequest(string item, int format, AsyncCallback callback, object state) { if (IsDisposed) { throw new ObjectDisposedException(this.GetType().ToString()); } if (!IsConnected) { throw new InvalidOperationException(Resources.NotConnectedMessage); } if (item == null) { throw new ArgumentNullException("item"); } if (item.Length > Ddeml.MAX_STRING_SIZE) { throw new ArgumentException(Resources.StringParameterInvalidMessage, "item"); } // Create a string handle for the item name. IntPtr itemHandle = Ddeml.DdeCreateStringHandle(_InstanceId, item, Ddeml.CP_WINANSI); // TODO: It might be possible that the request completed synchronously. // Request the data from the server. int transactionId = 0; IntPtr result = Ddeml.DdeClientTransaction( IntPtr.Zero, 0, _ConversationHandle, itemHandle, format, Ddeml.XTYP_REQUEST, Ddeml.TIMEOUT_ASYNC, ref transactionId); // Free the string handle created earlier. Ddeml.DdeFreeStringHandle(_InstanceId, itemHandle); // If the result is null then the asynchronous operation could not begin. if (result == IntPtr.Zero) { int error = Ddeml.DdeGetLastError(_InstanceId); string message = Resources.RequestFailedMessage; message = message.Replace("${service}", _Service); message = message.Replace("${topic}", _Topic); message = message.Replace("${item}", item); throw new DdemlException(message, error); } // Create an IAsyncResult for the asynchronous operation and add it to the asynchronous transaction table. RequestAsyncResult ar = new RequestAsyncResult(this); ar.Item = item; ar.Format = format; ar.Callback = callback; ar.AsyncState = state; ar.TransactionId = transactionId; _AsynchronousTransactionTable.Add(transactionId, ar); return ar; }
public MsgEnlistTransactionEvent(CoordinatorEnlistment coordinator, ref CreateCoordinationContext create, RequestAsyncResult result) : base(coordinator) { this.create = create; this.result = result; }
public Message EndRequest(IAsyncResult result) { return(RequestAsyncResult.End(result)); }
public static Message End(IAsyncResult result) { RequestAsyncResult thisPtr = AsyncResult.End <RequestAsyncResult>(result); return(thisPtr.replyMessage); }
public MsgCreateTransactionEvent(CompletionEnlistment completion, ref CreateCoordinationContext create, RequestAsyncResult result) : base(completion) { this.create = create; this.result = result; }
public static Message End(IAsyncResult result) { RequestAsyncResult requestResult = AsyncResult.End <RequestAsyncResult>(result); return(requestResult.reply); }
internal override async Task devRequestAsync(YDevice device, string req_first_line, byte[] req_head_and_body, RequestAsyncResult asyncResult, object asyncContext) { String serial = device.imm_getSerialNumber(); byte[] req = imm_prepareRequest(req_first_line, req_head_and_body); await _ywatcher.DevRequestAsync(serial, req, asyncResult, asyncContext); //Debug.WriteLine("async req to " + serial + " " + req_first_line); }