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); } } } }
private void HandleSolutionReceived(IAsyncResult ar) { if (ar.IsNull() || ((AsyncResult)ar).AsyncDelegate.IsNull()) { throw new ArgumentNullException("ar"); } if (!ar.IsNull()) { var expr = ar.AsyncState as string; var proc = (ExpressionProcessorMethod)(((AsyncResult)ar).AsyncDelegate); if (!proc.IsNull()) { var solution = proc.EndInvoke(ar); if (!OnSolutionReceived.IsNull()) { OnSolutionReceived(solution, expr); } } } }
static void FinshCallBack(IAsyncResult result) { if (result.IsNull()) { return; } ReadFileClass rf = result.AsyncState as ReadFileClass; int length = rf.stream.EndRead(result); byte[] fileData = new byte[length]; Array.Copy(rf.data, fileData, fileData.Length); string content = Encoding.UTF8.GetString(fileData); Thread.Sleep(3 * 1000); Console.WriteLine("读取文件结束:文件长度为[{0}],文件内容为[{1}]", length.ToString(), content); }
private void HandleSolutionReceived(IAsyncResult ar) { if(ar.IsNull() || ((AsyncResult)ar).AsyncDelegate.IsNull()) throw new ArgumentNullException("ar"); if(!ar.IsNull()) { var expr = ar.AsyncState as string; var proc = (ExpressionProcessorMethod)(((AsyncResult) ar).AsyncDelegate); if(!proc.IsNull()) { var solution = proc.EndInvoke(ar); if(!OnSolutionReceived.IsNull()) OnSolutionReceived(solution, expr); } } }
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); } } }