public void ReturnResult(object input) { if (OnResultReceived != null) { OnResultReceived.Invoke(this, decimal.Parse(input.ToString())); } }
public void Pop(OnResultReceived callback) { //try { // string returned = null; // pipeServer.BeginWaitForConnection((IAsyncResult result) => { // if () // returned = reader.ReadLine(); // pipeServer.Disconnect(); // callback(returned); // }, returned); // //string receivedFileName = // //return receivedFileName; //} catch (Exception e) { // reader.Close(); // pipeServer.Close(); // //eeturn null; //} var asyncResult = pipeServer.BeginWaitForConnection((result) => { signal.Set(); }, null); signal.WaitOne(); if (asyncResult.IsCompleted) { pipeServer.EndWaitForConnection(asyncResult); // success string result = reader.ReadLine(); callback(result); signal.Reset(); pipeServer.Disconnect(); } }
public CaptchaVerify(string pvtkey, string chlg, string r, IPAddress addr, OnResultReceived orr) { string updata = "privatekey=" + pvtkey + "&remoteip=" + addr.ToString() + "&challenge=" + chlg + "&response=" + r; ResultReceivedCB = orr; WebClient wc = new WebClient(); wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted); wc.UploadStringAsync(new Uri("http://www.google.com/recaptcha/api/verify"), updata); }
public void Query(string remoteAE, string remoteHost, int remotePort, OnResultReceived callback) { _callback = callback; IPAddress addr = Dns.GetHostAddresses(remoteHost)[0]; ClientAssociationParameters _assocParams = new ClientAssociationParameters(AETitle, remoteAE, new IPEndPoint(addr, remotePort)); byte pcid = _assocParams.AddPresentationContext(SopClass.StudyRootQueryRetrieveInformationModelFind); _assocParams.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); _assocParams.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); _dicomClient = DicomClient.Connect(_assocParams, this); }
private void HandleResultReceived(IAsyncResult ar) { if (ar.IsNull() || ((AsyncResult)ar).AsyncDelegate.IsNull()) { throw new ArgumentNullException("ar"); } if (!ar.IsNull()) { var expr = ar.AsyncState as string; var proc = (RetrieveResultMethod)(((AsyncResult)ar).AsyncDelegate); if (!proc.IsNull()) { var result = proc.EndInvoke(ar); if (!OnResultReceived.IsNull()) { OnResultReceived(result, expr); } } } }