private static WorkItemLinkAttribute PropertyInfoLinkTypeCache( IPropertyInspector inspector, PropertyInfo property) { return(PropertyInfoFields.GetOrAdd( property, info => inspector.GetAttribute <WorkItemLinkAttribute>(property))); }
// <summary> // Writes the attached property OwningPropertyInspector to the given element. // </summary> // <param name="d">The element to which to write the attached property.</param> // <param name="value">The property value to set</param> public static void SetOwningPropertyInspectorModel(DependencyObject dependencyObject, IPropertyInspector value) { if (dependencyObject == null) { throw FxTrace.Exception.ArgumentNull("dependencyObject"); } dependencyObject.SetValue(PropertyInspectorHelper.OwningPropertyInspectorModelProperty, value); }
protected SceneNodeObjectSet(IPropertyInspector transactionContext) { if (transactionContext == null) { throw new ArgumentNullException("transactionContext"); } this.transactionContext = transactionContext; }
// -------------------------------------------------------------------- private void OnObjectPropertyInspectorChanged(object s, PropertyValueChangedEventArgs e) { PropertyGrid propGrid = s as PropertyGrid; IPropertyInspector inspector = propGrid.SelectedObject as IPropertyInspector; propGrid.Refresh(); inspector.Apply(); InspectorChanged?.Invoke(this, e); }
internal SelectedElementsObjectSet(DesignerContext designerContext, IPropertyInspector transactionContext) : base(designerContext, transactionContext) { ObservableCollection <SystemResourceModel> systemResources = this.SystemResources; this.DesignerContext.SelectionManager.EarlyActiveSceneUpdatePhase += new SceneUpdatePhaseEventHandler(this.SelectionManager_EarlyActiveSceneUpdatePhase); this.DesignerContext.SelectionManager.LateActiveSceneUpdatePhase += new SceneUpdatePhaseEventHandler(this.SelectionManager_LateActiveSceneUpdatePhase); this.SetActiveViewModel(designerContext.ActiveSceneViewModel); }
private void CategoryContainer_Loaded(object sender, RoutedEventArgs e) { IPropertyInspector propertyInspectorModel = PropertyInspectorHelper.GetOwningPropertyInspectorModel((DependencyObject)this); if (propertyInspectorModel == null || CategoryContainer.GetPopupHost((DependencyObject)this) != null) { return; } this.Category.Expanded = propertyInspectorModel.IsCategoryExpanded(this.Category.get_CategoryName()); }
public AnnotatedPropertyValidator([NotNull] IPropertyInspector inspector) { _inspector = inspector ?? throw new ArgumentNullException(nameof(inspector)); PropertyInfoValidator = (item, info) => { var name = GetFieldDefinition(info)?.FieldName; var validName = !string.IsNullOrWhiteSpace(name); return(validName && item.Fields.Contains(name)); }; }
public SimpleInspectorCategory(CCategoryInfo info, IPropertyInspector inspector) : base(info.Priority) { InitializeComponent(); m_inspector = inspector; m_propertyGrid = PropertyGrid; m_leftColumn = LeftColumn; m_rightColumn = RightColumn; }
/// <summary> /// Initializes a new instance of the <see cref="BulkIdentityAwareAttributeMapperStrategy"/> class. /// </summary> /// <param name="inspector">The inspector.</param> /// <param name="identityValueConverter">The identity value converter.</param> /// <exception cref="ArgumentNullException">inspector</exception> /// <autogeneratedoc /> public BulkIdentityAwareAttributeMapperStrategy( IPropertyInspector inspector, IIdentityValueConverter <string, object> identityValueConverter ) { Contract.Requires(inspector != null); Contract.Requires(identityValueConverter != null); _inspector = inspector ?? throw new ArgumentNullException(nameof(inspector)); _displayNameToAliasValueConverter = identityValueConverter ?? throw new ArgumentNullException(nameof(identityValueConverter)); }
private bool IsStrongTypeId(IPropertyInspector propertyInspector) { var systemType = propertyInspector.Type.GetUnderlyingSystemType(); if (systemType is null) { return(false); } return(StrongTypeIdHelper.IsStrongTypeId(systemType)); }
public ExpandableInspectorCategory(CCategoryInfo info, IPropertyInspector inspector) : base(info.Priority) { InitializeComponent(); Expander.Header = info.Name; m_inspector = inspector; m_propertyGrid = PropertyGrid; m_leftColumn = LeftColumn; m_rightColumn = RightColumn; }
// -------------------------------------------------------------------- private PropertyGrid CreatePropertyInspector(IPropertyInspector obj) { PropertyGrid propGrid = new PropertyGrid(); propGrid.SelectedObject = obj; propGrid.PropertyValueChanged += OnObjectPropertyInspectorChanged; propGrid.HelpVisible = false; propGrid.Width = this.Width; propGrid.ToolbarVisible = false; propGrid.Height = obj.GetInspectorHeight(); return(propGrid); }
private void CategoryContainer_Loaded(object sender, RoutedEventArgs e) { IPropertyInspector owningPI = PropertyInspectorHelper.GetOwningPropertyInspectorModel(this); if (owningPI != null) { if (CategoryContainer.GetPopupHost(this) == null) { this.Expanded = owningPI.IsCategoryExpanded(this.Category.CategoryName); } } }
private bool Check(IPropertyInspector inspector) { //walkaround: //this convention causes problems with Components - creates columns like Issue`Id` so we apply it only to entities var type = inspector.EntityType; if (!(type.IsSubclassOf(typeof(Entity)) || type.IsSubclassOf(typeof(GlossaryEntity)))) { return(false); } return(true); }
private static IEnumerable <PropertyInfo> PropertiesOnWorkItemCache( IPropertyInspector inspector, IWorkItem workItem, Type targetType, Type attributeType) { // Composite key: work item type and target type var workItemType = workItem.Type.Name; var key = new Tuple <string, RuntimeTypeHandle>(workItemType, targetType.TypeHandle); return(PropertiesThatExistOnWorkItem.GetOrAdd( key, tuple => inspector.GetAnnotatedProperties(targetType, attributeType).ToList())); }
private static IEnumerable <PropertyInfo> PropertiesOnWorkItemCache(IPropertyInspector inspector, IWorkItem workItem, Type targetType, Type attributeType) { // Composite key: work item type and target type var workItemType = workItem.Type.Name; var key = new Tuple <string, RuntimeTypeHandle>(workItemType, targetType.TypeHandle); return(PropertiesThatExistOnWorkItem.GetOrAdd( key, tuple => { return inspector.GetAnnotatedProperties(targetType, typeof(FieldDefinitionAttribute)) .Select( property => new { property, fieldName = PropertyInfoFieldCache(inspector, property)?.FieldName }) .Where( @t => !string.IsNullOrEmpty(@t.fieldName) && workItem.Fields.Contains(@t.fieldName)) .Select(@t => @t.property) .ToList(); })); }
/// <summary> /// Creates a new instance of <see cref="AttributeMapperStrategy"/> with a <see cref="AnnotatedPropertyValidator"/> using the specified <paramref name="inspector"/> and <paramref name="typeParser"/>. /// </summary> /// <param name="inspector">An instance of <see cref="IPropertyInspector"/>.</param> /// <param name="typeParser">An instance of <see cref="ITypeParser"/>.</param> public AttributeMapperStrategy([NotNull] IPropertyInspector inspector, [NotNull] ITypeParser typeParser) : this(new AnnotatedPropertyValidator(inspector), typeParser) { }
public WorkItemLinksMapperStrategy(IPropertyInspector inspector, IWorkItemStore store) { _inspector = inspector; Store = store; }
public static void SetOwningPropertyInspectorModel(DependencyObject dependencyObject, IPropertyInspector value) { if (dependencyObject == null) { throw new ArgumentNullException("dependencyObject"); } dependencyObject.SetValue(PropertyInspectorHelper.OwningPropertyInspectorModelProperty, value); }
public EditResourceModel(DesignerContext designerContext, DictionaryEntryNode resourceEntryNode, IPropertyInspector transactionContext) { this.designerContext = designerContext; this.resourceEntryNode = resourceEntryNode; object key = resourceEntryNode.Key; DocumentNode expression; if ((expression = key as DocumentNode) != null) { this.keyString = XamlExpressionSerializer.GetStringFromExpression(expression, resourceEntryNode.DocumentNode); } else if ((this.keyString = key as string) == null) { this.keyString = key.ToString(); } this.keyStringIsValid = true; ResourceEntryItem resource = (ResourceEntryItem)this.designerContext.ResourceManager.GetResourceItem((DocumentCompositeNode)resourceEntryNode.DocumentNode); this.resourceObjectSet = new ResourceValueObjectSet(resource, designerContext, transactionContext); this.standInProperty = this.resourceObjectSet.CreateProperty(new PropertyReference((ReferenceStep)this.resourceObjectSet.ProjectContext.ResolveProperty(DictionaryEntryNode.ValueProperty)), TypeUtilities.GetAttributes(resource.EffectiveType)); this.standInProperty.PropertyValue.PropertyValueException += new EventHandler <PropertyValueExceptionEventArgs>(this.OnPropertyValueException); this.standInProperty.PropertyValue.PropertyChanged += new PropertyChangedEventHandler(this.OnValuePropertyChanged); }
public BulkIdentityAwareAttributeMapperStrategy(IPropertyInspector inspector, IIdentityManagementService identityManagementService) { _inspector = inspector; _identityManagementService = identityManagementService; }
public ResourceValueObjectSet(ResourceEntryItem resource, DesignerContext designerContext, IPropertyInspector transactionContext) : base(designerContext, transactionContext) { this.resource = resource; this.designerContext = designerContext; }
/// <summary> /// Initializes a new instance of the <see cref="BulkIdentityAwareAttributeMapperStrategy" /> class. /// </summary> /// <param name="inspector">The inspector.</param> /// <param name="identityManagementService">The identity management service.</param> /// <exception cref="ArgumentNullException"> /// inspector /// or /// identityManagementService /// </exception> public BulkIdentityAwareAttributeMapperStrategy(IPropertyInspector inspector, IIdentityManagementService identityManagementService) : this(inspector, new IdentityFieldValueConverter(identityManagementService)) { }
internal SceneNodeObjectSetBase(DesignerContext designerContext, IPropertyInspector transactionContext) : base(transactionContext) { this.designerContext = designerContext; this.designerContext.SelectionManager.LateActiveSceneUpdatePhase += new SceneUpdatePhaseEventHandler(this.SelectionManager_LateActiveSceneUpdatePhase); }
public void CreateDsl() { mapping = new PropertyMapping(); inspector = new PropertyInspector(mapping); }
private static FieldDefinitionAttribute PropertyInfoFieldCache(IPropertyInspector inspector, PropertyInfo property) { return(PropertyInfoFields.GetOrAdd( property, info => inspector.GetAttribute <FieldDefinitionAttribute>(property))); }
public bool Accept(IPropertyInspector propertyMapping) { return propertyMapping.Type == typeof(string) && propertyMapping.Property.Name.ToLower() == "description"; }
private static bool IsEnum(IPropertyInspector pi) { return(pi.Property.PropertyType.IsEnum); }
private static bool IsNullableEnum(IPropertyInspector pi) { return(pi.Property.PropertyType.IsGenericType && pi.Property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>) && pi.Property.PropertyType.GetGenericArguments().Single().IsEnum); }
internal static Dictionary <string, List <PropertyInfo> > GetWorkItemIdentityFieldNameToIdentityPropertyMap(Type targetWorkItemType, IPropertyInspector propertyInspector) { var hashtable = IdentityPropertyTypeMap; var props = (Dictionary <string, List <PropertyInfo> >)hashtable[targetWorkItemType]; if (props != null) { return(props); } lock (hashtable) { var identityProperties = propertyInspector.GetAnnotatedProperties(targetWorkItemType, typeof(IdentityFieldAttribute)); props = new Dictionary <string, List <PropertyInfo> >(StringComparer.OrdinalIgnoreCase); foreach (var identityProperty in identityProperties) { var witFieldName = propertyInspector.GetAttribute <FieldDefinitionAttribute>(identityProperty) ?.FieldName; if (string.IsNullOrEmpty(witFieldName) || !identityProperty.CanWrite) { continue; } if (!props.ContainsKey(witFieldName)) { props.Add(witFieldName, new List <PropertyInfo>()); } props[witFieldName].Add(identityProperty); } hashtable[targetWorkItemType] = props; return(props); } }
public void Init(IPropertyInspector inspector) { m_inspector = inspector; }
public AttributeMapperStrategy(IPropertyInspector inspector, ITypeParser typeParser) { _inspector = inspector; _typeParser = typeParser; }
internal static IDictionary <string, PropertyInfo> GetWorkItemIdentityFieldNameToIdentityPropertyMap(Type targetWorkItemType, IPropertyInspector propertyInspector) { var identityProperties = propertyInspector.GetAnnotatedProperties(targetWorkItemType, typeof(IdentityFieldAttribute)); return (identityProperties .Select( p => new { IdentityProperty = p, WitFieldName = propertyInspector.GetAttribute <FieldDefinitionAttribute>(p)?.FieldName }) .Where(p => !string.IsNullOrEmpty(p.WitFieldName) && p.IdentityProperty.CanWrite) .ToDictionary(x => x.WitFieldName, x => x.IdentityProperty)); }