Пример #1
0
        private void NotifierOnConnectedToServer(object sender,
                                                 NotifierEventArgs <ConnectionEstablished> notifierEventArgs)
        {
            if (notifierEventArgs?.Payload != null)
            {
                Me      = new MeseClient(_tcpClient, notifierEventArgs.Payload.Me);
                Friends = notifierEventArgs.Payload.Others.ToList();

                ConnectedToServer?.Invoke(this, notifierEventArgs);
            }
        }
Пример #2
0
        private async Task <IClient> GetMeseClientInformation(TcpClient client)
        {
            MeseClient meseClient = null;

            WaitForClient(client);

            var messageProtocol = await MessageCommunicator.ReadAsync(client);

            var name = messageProtocol.GetDataAs <string>();

            if (!string.IsNullOrEmpty(name))
            {
                meseClient = new MeseClient(client, name);
            }

            return(meseClient);
        }