示例#1
0
        /// <summary>
        /// Executes the action for when a person has been named.
        /// </summary>
        /// <param name="action">The name action containing the name of the user.</param>
        /// <returns>A Task object for this method is asynchronous.</returns>
        private async Task Execute(NameAction action)
        {
            if (sleeping)
            {
                return;
            }

            if (GetClientForCurrentUser().PersonId.Equals(AnonymousPersonId, StringComparison.OrdinalIgnoreCase))
            {
                var personId = await eyes.CreatePerson();

                currentIdentityPersonId = personId.ToString();
                pool.ChangeId(AnonymousPersonId, currentIdentityPersonId);

                var newName = await eyes.UpdatePerson(personId, action.Name);

                await eyes.StoreFaceFor(newName);
            }

            var p = new Profile
            {
                Name = action.Name
            };

            await GetClientForCurrentUser().UpdateProfile(p);

            await voice.Say($"Hi {action.Name}, nice to meet you!");
        }