public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            UserDto = UserDtoOriginal.DeepCopy();
            Groups  = new List <GroupDto> (GroupsOriginal);

            TxtUsername.StringValue    = UserDto.Name == null ? string.Empty : 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;
            if (UserDto.PasswordDetails != null)
            {
                TxtPasswordLastChanged.StringValue     = DateTimeHelper.UnixToWindows((long)UserDto.PasswordDetails.LastSet).ToString("dd-MMM-yyyy hh:mm:ss");
                TxtPasswordDaysUntilExpiry.StringValue = SecondsToDaysAndHours(UserDto.PasswordDetails.Lifetime);
            }
            ChDisabled.StringValue = UserDto.Disabled ? "0" : "1";
            //Window.Title = UserDto.Name + "@" + UserDto.Domain + " Properties";
            ChActAsUser.StringValue = UserDto.ActAsUsers ? "1" : "0";
            ChIdpAdmin.StringValue  = UserDto.IsIdpAdmin ? "1" : "0";
            RdoRoleGroup.SelectCell(new NSCell(UserDto.Role.ToString()));

            lstGroups          = new NSTableView();
            lstGroups.Delegate = new TableDelegate();
            this.LstGroupMembershipView.AddSubview(lstGroups);
            var listView = new GroupsDataSource {
                Entries = Groups
            };
            var columnNames = new List <ColumnOptions> {
                new ColumnOptions {
                    Id = "Name", DisplayName = "Group Name", DisplayOrder = 1, Width = 300
                }
            };
            var columns = ListViewHelper.ToNSTableColumns(columnNames);

            foreach (var column in columns)
            {
                lstGroups.AddColumn(column);
            }
            lstGroups.DataSource = listView;
            lstGroups.ReloadData();

            //Events
            this.BtnSave.Activated        += OnClickSaveButton;
            this.BtnAddGroup.Activated    += OnClickAddGroupButton;
            this.BtnRemoveGroup.Activated += OnClickRemoveGroupButton;
//			this.BtnClose.Activated += (object sender, EventArgs e) => {
//				this.Close ();
//				NSApplication.SharedApplication.StopModalWithCode (0);
//			};
        }
        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.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (BtnAddGroup != null)
            {
                BtnAddGroup.Dispose();
                BtnAddGroup = null;
            }

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

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

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

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

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

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

            if (LstGroupMembershipView != null)
            {
                LstGroupMembershipView.Dispose();
                LstGroupMembershipView = 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 (TxtPasswordDaysUntilExpiry != null)
            {
                TxtPasswordDaysUntilExpiry.Dispose();
                TxtPasswordDaysUntilExpiry = null;
            }

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

            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }
        }
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;
            }
        }