public void ApplyActiveUserPermissions() { if (CacheManager.ActiveUser.Permissions.Contains(UserAdminObject.PermissionTypes.ShowCheckedOutBy)) { AdminLabelTextbox checkedOutByLabelItem = new AdminLabelTextbox(); checkedOutByLabelItem.PropertyId = PropertyId.CheckOutBy; checkedOutByLabelItem.SetMinGapSize = UISettings.ADMINLABELTEXTBOX_GAPSIZE; checkedOutByLabelItem.IsEditable = false; RowDefinition checkedOutByRowDefinition = new RowDefinition(); checkedOutByRowDefinition.Height = GridLength.Auto; BasicIdsGrid.RowDefinitions.Add(checkedOutByRowDefinition); Grid.SetRow(checkedOutByLabelItem, basicIds.Count()); bool checkedOutByAlreadyExists = BasicIdsGrid.Children.Cast<AdminLabelTextbox>() .Any(textbox => textbox.PropertyId == PropertyId.CheckOutBy); if (!checkedOutByAlreadyExists) BasicIdsGrid.Children.Add(checkedOutByLabelItem); } }
private void LoadBasicIds(IAdminObject item) { for (int i = 0; i < basicIds.Count(); i++) // PropertyId propertyId in basicIds) { PropertyId propertyId = basicIds[i]; AdminLabelTextbox labelItem = new AdminLabelTextbox(); labelItem.PropertyId = propertyId; labelItem.SetMinGapSize = UISettings.ADMINLABELTEXTBOX_GAPSIZE; RowDefinition rowDefinition = new RowDefinition(); rowDefinition.Height = GridLength.Auto; BasicIdsGrid.RowDefinitions.Add(rowDefinition); Grid.SetRow(labelItem, i); bool alreadyExists = BasicIdsGrid.Children.Cast<AdminLabelTextbox>().Any(textbox => textbox.PropertyId == propertyId); if (!alreadyExists) BasicIdsGrid.Children.Add(labelItem); } }