Пример #1
0
        public async Task SetName(string name)
        {
            if (Logger.IsEnabled(LogLevel.Trace))
            {
                Logger.LogTrace($"name({Name})");
            }
            try
            {
                var puppetId = Puppet !.SelfId;
                if (Id != puppetId)
                {
                    throw new InvalidOperationException("only can set name for user self");
                }
            }
            catch (Exception exception)
            {
                throw new InvalidOperationException("Can not set name for user self, user might be either not logged in or already logged out", exception);
            }
            await Puppet.ContactSelfName(name);

            await Sync();
        }