public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            this.BtnClose.Activated += (object sender, EventArgs e) => {
                this.Close();
                NSApplication.SharedApplication.StopModalWithCode(0);
            };
            this.BtnAdd.Activated += OnClickAddGroupButton;

            foreach (NSTableColumn column in GroupsTableView.TableColumns())
            {
                GroupsTableView.RemoveColumn(column);
            }
            GroupsTableView.Delegate = new TableDelegate();
            var groupInfo = new GroupMembershipDto()
            {
                Groups = new List <GroupDto> ()
            };

            ActionHelper.Execute(delegate() {
                var auth  = SnapInContext.Instance.AuthTokenManager.GetAuthToken(ServerDto.ServerName);
                groupInfo = SnapInContext.Instance.ServiceGateway.Tenant.Search(ServerDto, TenantName, DomainName, MemberType.GROUP, SearchType.NAME, auth.Token);
            });

            var listView = new GroupsDataSource {
                Entries = groupInfo.Groups
            };
            var columnNames = new List <ColumnOptions> {
                new ColumnOptions {
                    Id = "Name", DisplayName = "Group Name", DisplayOrder = 1, Width = 500
                },
            };
            var columns = ListViewHelper.ToNSTableColumns(columnNames);

            foreach (var column in columns)
            {
                GroupsTableView.AddColumn(column);
            }
            GroupsTableView.DataSource = listView;
            GroupsTableView.ReloadData();
        }
Beispiel #2
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            this.BtnClose.Activated += (object sender, EventArgs e) => {
                this.Close();
                NSApplication.SharedApplication.StopModalWithCode(0);
            };
            this.BtnAdd.Activated       += OnClickAddGroupButton;
            this.SearchButton.Activated += (object sender, EventArgs e) => {
                if (!IsUserSearch)
                {
                    var domain = ((NSString)DomainComboBox.SelectedValue).ToString();
                    var filter = (MemberTypeFilter)((int)MemberTypeComboBox.SelectedIndex);
                    Search(NameTextString.StringValue, domain, filter);
                }
                else
                {
                    Search(NameTextString.StringValue, DomainName, MemberTypeFilter.Groups);
                }
            };
            foreach (NSTableColumn column in GroupsTableView.TableColumns())
            {
                GroupsTableView.RemoveColumn(column);
            }
            var columnNames = new List <ColumnOptions> {
                new ColumnOptions {
                    Id = "Name", DisplayName = "Name", DisplayOrder = 1, Width = 500
                },
            };
            var columns = ListViewHelper.ToNSTableColumns(columnNames);

            foreach (var column in columns)
            {
                GroupsTableView.AddColumn(column);
            }
            GroupsTableView.AllowsMultipleSelection = true;
            GroupsTableView.Delegate = new TableDelegate();
            GetIdentitySources();
        }