Exemplo n.º 1
0
 private void Domain_UserRemoved(object sender, DomainUserRemovedEventArgs e)
 {
     if (sender is IDomain domain && e.RemoveInfo.Reason == RemoveReason.Kick && e.DomainUserInfo.UserID == this.CommandContext.UserID)
     {
         domain.UserRemoved          -= Domain_UserRemoved;
         this.CommandContext.Category = null;
         this.CommandContext.Target   = null;
     }
 }
Exemplo n.º 2
0
        public void InvokeDomainUserRemovedEvent(Authentication authentication, Domain domain, DomainUser domainUser, RemoveInfo removeInfo)
        {
            var args     = new DomainUserRemovedEventArgs(authentication, domain, domainUser, removeInfo);
            var eventLog = EventLogBuilder.Build(authentication, this, nameof(InvokeDomainUserRemovedEvent), domain, domainUser, removeInfo.Reason, removeInfo.Message);
            var comment  = removeInfo.Reason == RemoveReason.Kick
                ? EventMessageBuilder.KickDomainUser(authentication, domain, domainUser)
                : EventMessageBuilder.LeaveDomainUser(authentication, domain);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.CremaHost.Debug(eventLog);
                this.CremaHost.Info(comment);
                this.OnDomainUserRemoved(args);
            });
        }
Exemplo n.º 3
0
        private void Domain_UserRemoved(object sender, DomainUserRemovedEventArgs e)
        {
            var domainUserID = e.DomainUserInfo.UserID;
            var removeInfo   = e.RemoveInfo;
            var userID       = e.UserID;

            if (domainUserID == this.authentication.ID && removeInfo.Reason == RemoveReason.Kick)
            {
                this.accessType = DomainAccessType.None;
                this.Dispatcher.InvokeAsync(async() =>
                {
                    await this.RefreshAsync();
                    this.OnKicked(e);
                });
            }
        }
Exemplo n.º 4
0
        private void DomainContext_DomainUserRemoved(object sender, DomainUserRemovedEventArgs e)
        {
            var userID          = this.authentication.ID;
            var exceptionUserID = e.UserID;
            var signatureDate   = e.SignatureDate;
            var domainID        = e.DomainInfo.DomainID;
            var domainUserInfo  = e.DomainUserInfo;
            var removeInfo      = e.RemoveInfo;

            if (domainUserInfo.UserID == this.OwnerID)
            {
                this.domains.Remove(domainID);
            }
            if (this.resettings.Contains(e.DomainInfo.DataBaseID))
            {
                return;
            }
            this.InvokeEvent(userID, exceptionUserID, () => this.Callback.OnUserRemoved(signatureDate, domainID, domainUserInfo, removeInfo));
        }
Exemplo n.º 5
0
 protected virtual void OnUserRemoved(DomainUserRemovedEventArgs e)
 {
     this.userRemoved?.Invoke(this, e);
 }
 private void Domains_DomainUserRemoved(object sender, DomainUserRemovedEventArgs e)
 {
     this.Invoke(null);
 }