public void OnClickAddGroupButton(object sender, EventArgs e)
        {
            NSApplication.SharedApplication.StopModal();
            var form = new ShowAllGroupsController();

            form.ServerDto  = ServerDto;
            form.TenantName = TenantName;
            form.DomainName = UserDto.Domain;
            var result = NSApplication.SharedApplication.RunModalForWindow(form.Window);

            if (result == VMIdentityConstants.DIALOGOK)
            {
                foreach (var group in form.SelectedGroups)
                {
                    var principalName = group.GroupName + "@" + group.GroupDomain;
                    if (!Groups.Exists(x => (x.GroupName + "@" + x.GroupDomain) == principalName))
                    {
                        Groups.Add(group);
                    }
                }
                var listView = new GroupsDataSource {
                    Entries = Groups
                };
                MemberTableView.DataSource = listView;
                MemberTableView.ReloadData();
            }
        }
 public void OnClickRemoveGroupButton(object sender, EventArgs e)
 {
     if (MemberTableView.SelectedRows.Count > 0)
     {
         foreach (var row in MemberTableView.SelectedRows)
         {
             Groups.RemoveAt((int)row);
         }
         var listView = new GroupsDataSource {
             Entries = Groups
         };
         MemberTableView.DataSource = listView;
         MemberTableView.ReloadData();
     }
 }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            UserDto = UserDtoOriginal.DeepCopy();
            Groups  = new List <GroupDto> (GroupsOriginal);

            TxtUsername.StringValue    = UserDto.Name == null ? string.Empty : UserDto.Name.Length > 10 ? UserDto.Name.Substring(0, 10) + "..." : UserDto.Name;
            TxtFirstName.StringValue   = UserDto.PersonDetails.FirstName == null ? string.Empty : UserDto.PersonDetails.FirstName;
            TxtLastName.StringValue    = UserDto.PersonDetails.LastName == null ? string.Empty : UserDto.PersonDetails.LastName;
            TxtEmail.StringValue       = UserDto.PersonDetails.EmailAddress == null ? string.Empty : UserDto.PersonDetails.EmailAddress;
            TxtDescription.StringValue = UserDto.PersonDetails.Description == null ? string.Empty : UserDto.PersonDetails.Description;
            chkActive.StringValue      = UserDto.Disabled ? "0" : "1";
            ChActAsUser.StringValue    = UserDto.ActAsUsers ? "1" : "0";
            ChIdpAdmin.StringValue     = UserDto.IsIdpAdmin ? "1" : "0";
            var roleTag = UserDto.Role == UserRole.Administrator ? 1 : UserDto.Role == UserRole.RegularUser ? 2 : 3;

            RdoRoleGroup.SelectCellWithTag((nint)roleTag);

            foreach (NSTableColumn column in MemberTableView.TableColumns())
            {
                MemberTableView.RemoveColumn(column);
            }
            MemberTableView.Delegate = new TableDelegate();
            var listView = new GroupsDataSource {
                Entries = Groups
            };
            var columnNames = new List <ColumnOptions> {
                new ColumnOptions {
                    Id = "Name", DisplayName = "Group Name", DisplayOrder = 1, Width = 200
                }
            };
            var columns = ListViewHelper.ToNSTableColumns(columnNames);

            foreach (var column in columns)
            {
                MemberTableView.AddColumn(column);
            }
            MemberTableView.DataSource = listView;
            MemberTableView.ReloadData();
            BtnApply.Hidden    = !IsSystemDomain;
            LoginAsUser.Hidden = !IsSystemDomain;

            //Events
            this.BtnApply.Activated       += OnClickSaveButton;
            this.BtnAddGroup.Activated    += OnClickAddGroupButton;
            this.BtnRemoveGroup.Activated += OnClickRemoveGroupButton;
            this.LoginAsUser.Activated    += OnLoginUserClicked;
        }
Exemplo n.º 4
0
        void ReleaseDesignerOutlets()
        {
            if (BtnAddGroup != null)
            {
                BtnAddGroup.Dispose();
                BtnAddGroup = null;
            }

            if (BtnApply != null)
            {
                BtnApply.Dispose();
                BtnApply = null;
            }

            if (BtnRemoveGroup != null)
            {
                BtnRemoveGroup.Dispose();
                BtnRemoveGroup = null;
            }

            if (ChActAsUser != null)
            {
                ChActAsUser.Dispose();
                ChActAsUser = null;
            }

            if (ChIdpAdmin != null)
            {
                ChIdpAdmin.Dispose();
                ChIdpAdmin = null;
            }

            if (chkActive != null)
            {
                chkActive.Dispose();
                chkActive = null;
            }

            if (MemberTableView != null)
            {
                MemberTableView.Dispose();
                MemberTableView = null;
            }

            if (RdoRoleGroup != null)
            {
                RdoRoleGroup.Dispose();
                RdoRoleGroup = null;
            }

            if (TxtDescription != null)
            {
                TxtDescription.Dispose();
                TxtDescription = null;
            }

            if (TxtEmail != null)
            {
                TxtEmail.Dispose();
                TxtEmail = null;
            }

            if (TxtFirstName != null)
            {
                TxtFirstName.Dispose();
                TxtFirstName = null;
            }

            if (TxtLastName != null)
            {
                TxtLastName.Dispose();
                TxtLastName = null;
            }

            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }

            if (LoginAsUser != null)
            {
                LoginAsUser.Dispose();
                LoginAsUser = null;
            }
        }