Exemplo n.º 1
0
            public void Start()
            {
                Task.Run(async() =>
                {
                    while (true)
                    {
                        pipeStream = new NamedPipeClientStream(PipeName);
                        await pipeStream.ConnectAsync();
                        using (StreamReader rdr = new StreamReader(pipeStream))
                        {
                            string result;

                            result = await rdr.ReadLineAsync();
                            // Debug.WriteLine("1");
                            if (result == "\0")
                            {
                                Debug.Write("\\0");
                                break;
                            }
                            GotMessage.Invoke(this, new PipeMessageEventArgs(result));
                            //Debug.WriteLine("结果:" + result);
                        }
                    }
                });
            }
Exemplo n.º 2
0
 private async void ListenForMessage(int NumberInPull)
 {
     await Task.Run(() =>
     {
         byte[] buffer = new byte[1024];
         do
         {
             SocketPull[NumberInPull].Receive(buffer);
             GotMessage?.Invoke(Encoding.UTF8.GetString(buffer));
         } while (SocketPull[NumberInPull] != null);
     });
 }
 public static void Fire_GotMessage(Object sender, ClsStringEventArgs args)
 {
     GotMessage?.Invoke(sender, args);
 }
Exemplo n.º 4
0
 private async Task OnGotMessageAsync(RemoteEventArgs args)
 {
     await Task.Run(() => GotMessage?.Invoke(this, args));
 }