コード例 #1
0
        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);
                    }
                }
            }
        }
コード例 #2
0
        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);
                    }
                }
            }
        }
コード例 #3
0
ファイル: Class7.cs プロジェクト: kikyoqiang/Common
        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);
        }
コード例 #4
0
ファイル: WAClient.cs プロジェクト: Schumix/Schumix2
        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);
                }
            }
        }
コード例 #5
0
ファイル: WAClient.cs プロジェクト: Schumix/Schumix2
        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);
                }
            }
        }