public ChatPeerListener(ChatClient chatClient, PlayerInfo playerInfo, string serverAddress, string applicationName)
        {
            Player = playerInfo;
            ChatClient = chatClient;
            _connected = false;
            _operations = new Dictionary<byte, IBaseOp>();
            foreach (var item in typeof(IBaseOp).Assembly.GetTypes().Where(_ => !_.IsAbstract && typeof(IBaseOp).IsAssignableFrom(_)))
            {
                var obj = (IBaseOp)Activator.CreateInstance(item);
                _operations[obj.OpCode] = obj;
            }

            _peer = new PhotonPeer(this, ConnectionProtocol.Udp);
            _peer.Connect(serverAddress, applicationName);
            while (!_connected)
            {
                _peer.Service();
            }

            var t = new Timer
            {
                Enabled = true,
                Interval = 10
            };

            t.Elapsed += (sender, args) => _peer.Service();
            t.Start();
        }
 private void NewPlayerButton(object sender, RoutedEventArgs e)
 {
     Task.Run(() =>
     {
         var obj = new ChatClient();
         obj.Execute();
     });
 }