Пример #1
0
        public async override void SelectObject(object obj)
        {
            this.descriptor = obj as IDomainDescriptor;

            if (this.descriptor != null)
            {
                var domain = this.descriptor.Target;

                if (domain.ExtendedProperties.ContainsKey(this) == true)
                {
                    var listBase = domain.ExtendedProperties[this] as DomainUserListBase;
                    this.Users = listBase.Users;
                }
                else
                {
                    var listBase = await domain.Dispatcher.InvokeAsync(() => new DomainUserListBase(this.authenticator, domain, true, this));

                    this.compositionService?.SatisfyImportsOnce(listBase);
                    this.Users = listBase.Users;
                }

                this.SelectedUser = null;
            }
            else
            {
                this.Users        = null;
                this.SelectedUser = null;
            }
            this.NotifyOfPropertyChange(nameof(this.IsVisible));
            this.NotifyOfPropertyChange(nameof(this.SelectedObject));
        }
Пример #2
0
 public static bool CanEndEdit(Authentication authentication, IDomainDescriptor descriptor)
 {
     return(authentication.Authority == Authority.Admin);
     //if (descriptor is IPermissionDescriptor permissionDescriptor)
     //    return permissionDescriptor.AccessType >= AccessType.Developer;
     //return false;
 }
Пример #3
0
        public static async Task <bool> EndEditAsync(Authentication authentication, IDomainDescriptor descriptor)
        {
            if (descriptor.Target is IDomain domain)
            {
                if (AppMessageBox.ShowProceed("편집을 종료합니다. 계속하시겠습니까?") == false)
                {
                    return(false);
                }

                try
                {
                    await domain.Dispatcher.InvokeAsync(() => domain.Delete(authentication, false));

                    return(true);
                }
                catch (Exception e)
                {
                    AppMessageBox.ShowError(e);
                    return(false);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Пример #4
0
 public override void SelectObject(object obj)
 {
     this.descriptor = obj as IDomainDescriptor;
     if (this.descriptor != null)
     {
         this.DomainInfo = this.descriptor.DomainInfo;
     }
     this.NotifyOfPropertyChange(nameof(this.IsVisible));
     this.NotifyOfPropertyChange(nameof(this.SelectedObject));
 }
Пример #5
0
 public static bool IsModified(Authentication authentication, IDomainDescriptor descriptor)
 {
     if (authentication == null)
     {
         throw new ArgumentNullException(nameof(authentication));
     }
     if (descriptor == null)
     {
         throw new ArgumentNullException(nameof(descriptor));
     }
     return(descriptor.DomainState.HasFlag(DomainState.IsModified));
 }
Пример #6
0
 public DomainDescriptor(Authentication authentication, IDomainDescriptor descriptor, bool isSubscriptable, object owner)
     : base(authentication, descriptor.Target, descriptor, isSubscriptable)
 {
     this.domain = descriptor.Target;
     this.owner  = owner ?? this;
 }
        public static async Task <bool> CancelEditAsync(Authentication authentication, IDomainDescriptor descriptor)
        {
            if (descriptor.Target is IDomain domain)
            {
                if (await AppMessageBox.ShowProceedAsync("편집을 취소합니다. 저장되지 않는 항목은 사라집니다. 계속하시겠습니까?") == false)
                {
                    return(false);
                }

                try
                {
                    await domain.DeleteAsync(authentication, true);

                    return(true);
                }
                catch (Exception e)
                {
                    await AppMessageBox.ShowErrorAsync(e);

                    return(false);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }