/// <summary> /// Fill in the controls in with the entity's data. /// </summary> protected virtual void Populate(Entity entity) { Boolean enabled = true; string type = ""; string location = ""; string contains = ""; List <AccessControl> roles = new List <AccessControl>(); try { lock (DataModel.SyncRoot) { if (entity == null) { enabled = false; } else { EntityRow entityRow = DataModel.Entity.EntityKey.Find(entity.EntityId); // General tab: type = DataModel.Type.TypeKey.Find(entity.TypeId).Description; location = this.GetLocation(entity.EntityId); contains = String.Format("{0} items", this.CountChildren(entityRow)); // Security tab: foreach (AccessControlRow accessor in entityRow.GetAccessControlRows()) { roles.Add(new AccessControl(accessor)); } } } // Push the information we just collected to the foreground to update the dialog box. this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new populate(this.Populate), enabled, entity, type, location, contains, roles); } catch (Exception exception) { EventLog.Warning("Error populating properties window. {0}:\n{1}", exception.Message, exception.StackTrace); } }