示例#1
0
        public async Task <MethodCallInfo> SendMessageAsync(MethodCallInfo methodCallInfo)
        {
            var Client   = new Client();
            var response = new MethodCallInfo()
            {
                Name = methodCallInfo.Name,
            };
            var result = await methodCallInfo.InvokeAsync(Client);

            response.Result = result;
            return(response);
        }
        private async Task SocketPipeClient_RequestReceived(object sender, SocketRequestReceivedEventArgs args)
        {
            MethodCallInfo methodCallInfo = (MethodCallInfo)BytesSerialization.BytesArrayToObject(args.RawBytes);
            var            invoke_result  = await methodCallInfo.InvokeAsync(GetExcuteObject());

            var response = new MethodCallInfo()
            {
                Name   = methodCallInfo.Name,
                Result = invoke_result,
            };
            var resBytes = BytesSerialization.ObjectToBytesArray(response);
            var status   = await args.SendResponseAsync(resBytes);
        }
        private async void MethodCallInfoInvokeTaskObject(object sender, RoutedEventArgs e)
        {
            Client         client         = new Client();
            MethodCallInfo methodCallInfo = new MethodCallInfo()
            {
                Name = "ToBase64Async",
                Args = new List <object>()
                {
                    Helper.RandomString(20),
                }
            };
            var result = await methodCallInfo.InvokeAsync(client);

            Log.Info(result);
        }