Exemple #1
0
        /// <summary>
        /// Static method that is invoked when a client decides to join the chat.
        /// </summary>
        static void OnJoinChat(IClient client)
        {
            // We add the person to the chat room
            if (!PeopleInChat.Contains(client))
            {
                // Generate the avatar for the client
                client["Avatar"] = IdenticonRenderer.Create(client);

                // Add the person in the room
                PeopleInChat.Add(client);

                // Say something nice
                SayTo(client, "Welcome to CodeWithMe :)");
            }
        }
Exemple #2
0
        /// <summary>
        /// Static method that is ivoked when a client decides to join the chat.
        /// </summary>
        static void OnJoinChat(IClient client)
        {
            // We add the person to the chat room
            if (!PeopleInChat.Contains(client))
            {
                // Generate the avatar for the client
                client["Avatar"] = IdenticonRenderer.Create(client);

                // Add the person in the room
                PeopleInChat.Add(client);

                // Say something nice
                SayTo(client, "Hi, I'm the author of this sample, hope you like it! Just type a message below and see how it works on CodeProject.");
            }
        }
Exemple #3
0
        private int _patchOffset; // used to center patch shape at origin because shape rotation works correctly.

        /// Creates a new avatar for a client.
        /// </summary>
        /// <param name="client">The client to create the avatar for.</param>
        /// <returns>The byte array (png) of the image.</returns>
        public static byte[] Create(IClient client)
        {
            var renderer = new IdenticonRenderer();

            return(renderer.Render(client));
        }