Ejemplo n.º 1
0
 async Task PrintQueue()
 {
     while (_queue.IsEmpty == false)
     {
         var s = string.Empty;
         var b = _queue.TryDequeue(out s);
         messageTextBlock.Text = (s);;
         await Task.Delay(1000);
     }
 }
Ejemplo n.º 2
0
        private void send()
        {
            while (listening)
            {
                Packet packetToSend = _packetsToSend.TryDequeue();

                if (packetToSend != null)
                {
                    try
                    {
                        serializer.Serialize(stream, packetToSend);
                        Console.WriteLine("[Client] Packet sent! (" + packetToSend.GetType().ToString() + ")");
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }
            }
        }