Exemplo n.º 1
0
        private PropertyDefinitionCollection getSystemPara()
        {
            PropertyDefinitionCollection result = new PropertyDefinitionCollection();

            foreach (XmlNode p in Parameter.glb_Parameter.system_parameter)
            {
                try
                {
                    PropertyDefinition para = new PropertyDefinition();
                    para.Category = "系统参数";
                    para.TargetProperties.Add(p.Name);
                    para.Description = "";
                    para.SetValue(StringProperty, p.InnerText);
                    para.DisplayName = cnNames[p.Name];
                    string des;
                    cnDescription.TryGetValue(p.Name, out des);
                    para.Description = des;
                    result.Add(para);
                }
                catch (Exception e)
                {
                }
            }
            return(result);
        }
        public void CopyConstructor()
        {
            var copiedCollection = new PropertyDefinitionCollection(new[] { _propertyDefinition }, false);

            Assert.That(copiedCollection.Count, Is.EqualTo(1));
            Assert.That(copiedCollection[0], Is.SameAs(_propertyDefinition));
        }
        private IPropertyInformation EnsurePropertyDefinitionExisitsOnClassDefinition(
            ClassDefinition classDefinition,
            Type declaringType,
            string propertyName)
        {
            var propertyInfo =
                PropertyInfoAdapter.Create(declaringType.GetProperty(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance));
            var propertyReflector = new PropertyReflector(
                classDefinition,
                propertyInfo,
                new ReflectionBasedMemberInformationNameResolver(),
                PropertyMetadataProvider,
                DomainModelConstraintProviderStub);
            var propertyDefinition = propertyReflector.GetMetadata();

            if (!classDefinition.MyPropertyDefinitions.Contains(propertyDefinition.PropertyName))
            {
                var propertyDefinitions = new PropertyDefinitionCollection(classDefinition.MyPropertyDefinitions, false);
                propertyDefinitions.Add(propertyDefinition);
                PrivateInvoke.SetNonPublicField(classDefinition, "_propertyDefinitions", propertyDefinitions);
                var endPoints = new RelationEndPointDefinitionCollection(classDefinition.MyRelationEndPointDefinitions, false);
                endPoints.Add(MappingObjectFactory.CreateRelationEndPointDefinition(classDefinition, propertyInfo));
                PrivateInvoke.SetNonPublicField(classDefinition, "_relationEndPoints", endPoints);
            }

            return(propertyInfo);
        }
Exemplo n.º 4
0
 public virtual void VisitPropertyDefinitionCollection(PropertyDefinitionCollection properties)
 {
     foreach (PropertyDefinition property in properties)
     {
         VisitPropertyDefinition(property);
     }
 }
        public override void SetUp()
        {
            base.SetUp();

            _propertyDefinition = PropertyDefinitionObjectMother.CreateForFakePropertyInfo();
            _collection         = new PropertyDefinitionCollection();
        }
 public PersonSchemaProperties(PropertyDefinition[] extendedProperties, params IEnumerable <PropertyDefinition>[] otherPropertySets)
 {
     if (extendedProperties != null)
     {
         StorePropertyDefinition[] array = new StorePropertyDefinition[extendedProperties.Length];
         for (int i = 0; i < extendedProperties.Length; i++)
         {
             array[i] = (StorePropertyDefinition)extendedProperties[i];
         }
         ApplicationAggregatedProperty item    = new ApplicationAggregatedProperty(PersonSchema.ExtendedProperties, PersonPropertyAggregationStrategy.CreateExtendedPropertiesAggregation(array));
         HashSet <PropertyDefinition>  hashSet = new HashSet <PropertyDefinition>();
         hashSet.Add(item);
         if (otherPropertySets != null)
         {
             foreach (ICollection <PropertyDefinition> collection in otherPropertySets)
             {
                 if (collection != null)
                 {
                     foreach (PropertyDefinition propertyDefinition in collection)
                     {
                         if (!object.Equals(propertyDefinition, PersonSchema.ExtendedProperties))
                         {
                             hashSet.Add(propertyDefinition);
                         }
                     }
                 }
             }
         }
         this.All = new PropertyDefinition[hashSet.Count];
         hashSet.CopyTo(this.All);
         return;
     }
     this.All = PropertyDefinitionCollection.Merge <PropertyDefinition>(otherPropertySets);
 }
 public RecursiveContactsEnumerator(IMailboxSession session, IXSOFactory xsoFactory, DefaultFolderType folderType, params PropertyDefinition[] properties)
 {
     Util.ThrowOnNullArgument(session, "session");
     Util.ThrowOnNullArgument(properties, "properties");
     this.session    = session;
     this.xsoFactory = xsoFactory;
     this.folderType = folderType;
     this.properties = PropertyDefinitionCollection.Merge <PropertyDefinition>(RecursiveContactsEnumerator.RequiredProperties, properties);
 }
Exemplo n.º 8
0
 public IEnumerator <IStorePropertyBag> GetEnumerator()
 {
     PropertyDefinition[] additionalProperties = new PropertyDefinition[]
     {
         this.property
     };
     PropertyDefinition[] allProperties   = PropertyDefinitionCollection.Merge <PropertyDefinition>(additionalProperties, this.requestedProperties);
     SortBy[]             ascendingSortBy = new SortBy[]
     {
         new SortBy(this.property, SortOrder.Ascending)
     };
     using (IQueryResult queryResult = this.folder.IItemQuery(ItemQueryType.None, null, ascendingSortBy, allProperties))
     {
         foreach (string propertyValue in this.propertyValues)
         {
             ContactsByPropertyValueEnumerator.Tracer.TraceDebug <string, PropertyDefinition>((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: Finding matches for {0} in property {1}.", propertyValue, this.property);
             QueryFilter filter = new TextFilter(this.property, propertyValue, MatchOptions.FullString, MatchFlags.IgnoreCase);
             if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, filter, SeekToConditionFlags.AllowExtendedFilters))
             {
                 ContactsByPropertyValueEnumerator.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: no matching contacts found.", propertyValue);
             }
             else
             {
                 bool more = true;
                 while (more)
                 {
                     IStorePropertyBag[] contacts = queryResult.GetPropertyBags(10);
                     if (contacts == null || contacts.Length == 0)
                     {
                         ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: no more rows to fecth.");
                         break;
                     }
                     foreach (IStorePropertyBag contact in contacts)
                     {
                         string retrievedPropertyValue = contact.GetValueOrDefault <string>(this.property, null);
                         if (string.IsNullOrEmpty(retrievedPropertyValue))
                         {
                             ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: stop looking for matches, found a null/empty property value.");
                             more = false;
                             break;
                         }
                         if (!StringComparer.OrdinalIgnoreCase.Equals(retrievedPropertyValue, propertyValue))
                         {
                             ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: stop looking for matches, found a mismatch.");
                             more = false;
                             break;
                         }
                         ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: Found a match, returning the contact.");
                         yield return(contact);
                     }
                 }
             }
         }
     }
     yield break;
 }
Exemplo n.º 9
0
 private void setVisionPara(PropertyDefinitionCollection paras)
 {
     Parameter.glb_Parameter.DoNotSave = true;
     foreach (var p in paras)
     {
         Parameter.glb_Parameter.WriteSystemPara(p.TargetProperties[0] as string, p.GetValue(StringProperty));
     }
     Parameter.glb_Parameter.DoNotSave = false;
     Parameter.glb_Parameter.Save();
 }
        protected ReflectedProviderFactoryDefinitionBase(MethodBase method,
                                                         QualifiedName qname,
                                                         Type outputType)
        {
            this.qname = qname;
            this.outputType = outputType;
            this.method = method;

            this.parameters = new PropertyDefinitionCollection();
            parameters.AddRange(this, qname.NamespaceName, method.GetParameters(), method.IsExtension());
        }
        private void PreparePropertyGrid()
        {
            PropertyDefinitionCollection propertyDefinitions = new PropertyDefinitionCollection();

            var properties = TypeDescriptor.GetProperties(person.GetType());

            // Allowing for multiple selection, if on further iterations through the selected items we will remove properties that do not exist in both PropertySets
            foreach (var p in properties.Cast <PropertyDescriptor>())
            {
                if (p.PropertyType != typeof(System.Windows.Media.Color?))
                {
                    continue;
                }
                string category     = p.Category;
                string description  = p.Description;
                string displayName  = p.DisplayName ?? p.Name;
                int?   displayOrder = null;
                bool?  isBrowsable  = p.IsBrowsable;
                bool?  isExpandable = null;

                var orderAttribute = p.Attributes[typeof(PropertyOrderAttribute)] as PropertyOrderAttribute;
                if (orderAttribute != null)
                {
                    displayOrder = orderAttribute.Order;
                }

                var expandableAttribute = p.Attributes[typeof(ExpandableObjectAttribute)] as ExpandableObjectAttribute;
                if (expandableAttribute != null)
                {
                    isExpandable = true;
                }

                var aPropertyDefinition = new PropertyDefinition
                {
                    Category         = category,
                    Description      = description,
                    DisplayName      = displayName,
                    DisplayOrder     = displayOrder,
                    IsBrowsable      = isBrowsable,
                    IsExpandable     = isExpandable,
                    TargetProperties = new[] { p.Name },
                };
                if (p.PropertyType == typeof(System.Windows.Media.Color?))
                {
                    aPropertyDefinition.IsExpandable = true;
                    aPropertyDefinition.PropertyDefinitions.Add(new PropertyDefinition()
                    {
                        TargetProperties = new[] { "R", "G", "B" }
                    });
                }
                propertyDefinitions.Add(aPropertyDefinition);
            }
            this.propertyGrid.PropertyDefinitions = propertyDefinitions;
        }
Exemplo n.º 12
0
 internal FacebookContactsUploader(IContactsUploaderPerformanceTracker performanceTracker, IFacebookClient client, IPeopleConnectApplicationConfig configuration, Func <PropertyDefinition[], IEnumerable <IStorePropertyBag> > contactsEnumeratorBuilder)
 {
     ArgumentValidator.ThrowIfNull("performanceTracker", performanceTracker);
     ArgumentValidator.ThrowIfNull("client", client);
     ArgumentValidator.ThrowIfNull("configuration", configuration);
     ArgumentValidator.ThrowIfNull("contactsEnumerator", contactsEnumeratorBuilder);
     this.performanceTracker = performanceTracker;
     this.client             = client;
     this.configuration      = configuration;
     PropertyDefinition[] arg = PropertyDefinitionCollection.Merge <PropertyDefinition>(FacebookContactsUploader.ContactPropertiesToExport, FacebookContactsUploader.AdditionalContactPropertiesToLoad);
     this.contactsEnumerator = contactsEnumeratorBuilder(arg);
 }
Exemplo n.º 13
0
        public PropertyGrid()
        {
            _propertyDefinitionsListener = new WeakEventListener <NotifyCollectionChangedEventArgs>(this.OnPropertyDefinitionsCollectionChanged);
            _editorDefinitionsListener   = new WeakEventListener <NotifyCollectionChangedEventArgs>(this.OnEditorDefinitionsCollectionChanged);
            UpdateContainerHelper();
            EditorDefinitions   = new EditorDefinitionCollection();
            PropertyDefinitions = new PropertyDefinitionCollection();

            AddHandler(PropertyItemBase.ItemSelectionChangedEvent, new RoutedEventHandler(OnItemSelectionChanged));
            AddHandler(PropertyItemsControl.PreparePropertyItemEvent, new PropertyItemEventHandler(OnPreparePropertyItemInternal));
            AddHandler(PropertyItemsControl.ClearPropertyItemEvent, new PropertyItemEventHandler(OnClearPropertyItemInternal));
            CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter));
        }
        public void CreateForAllPropertyDefinitions_ClassDefinitionWithoutBaseClassDefinition_MakeCollectionReadOnlyIsTrue()
        {
            var classDefinition    = ClassDefinitionObjectMother.CreateClassDefinition();
            var propertyDefinition = PropertyDefinitionObjectMother.CreateForFakePropertyInfo(classDefinition);

            classDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinition }, false));

            var propertyDefinitions = PropertyDefinitionCollection.CreateForAllProperties(classDefinition, true);

            Assert.That(propertyDefinitions.Count, Is.EqualTo(1));
            Assert.That(propertyDefinitions.IsReadOnly, Is.True);
            Assert.That(propertyDefinitions[0], Is.SameAs(propertyDefinition));
        }
Exemplo n.º 15
0
        protected virtual void OnPropertyDefinitionsChanged(PropertyDefinitionCollection oldValue, PropertyDefinitionCollection newValue)
        {
            if (oldValue != null)
            {
                CollectionChangedEventManager.RemoveListener(oldValue, _propertyDefinitionsListener);
            }

            if (newValue != null)
            {
                CollectionChangedEventManager.AddListener(newValue, _propertyDefinitionsListener);
            }

            this.Notify(this.PropertyChanged, () => this.PropertyDefinitions);
        }
        public CommonReflectionInfo(OperatorDefinition def, RoleAttribute attr, MethodBase method)
        {
            this.method = method;
            this.def = def;
            this.name = attr.ComputeName(method);

            var type = method.DeclaringType;
            if (type.IsGenericType && !type.IsGenericTypeDefinition)
                type = type.GetGenericTypeDefinition();

            this.ns = TypeHelper.GetNamespaceName(type);
            parameters = new PropertyDefinitionCollection();
            parameters.AddRange(def, ns, method.GetParameters(), method.IsExtension());
        }
Exemplo n.º 17
0
 public void VisitPropertyDefinitionCollection(PropertyDefinitionCollection properties)
 {
     foreach (PropertyDefinition @property in properties)
     {
         AppendNode(@property.DeclaringType, @property, true);
         if (@property.GetMethod != null)
         {
             AppendNode(@property, @property.GetMethod, false);
         }
         if (@property.SetMethod != null)
         {
             AppendNode(@property, @property.SetMethod, false);
         }
     }
 }
Exemplo n.º 18
0
 public AllContactsCursor(MailboxSession session, PropertyDefinition[] properties, SortBy[] sortByProperties)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         Util.ThrowOnNullArgument(session, "session");
         Util.ThrowOnNullArgument(properties, "properties");
         StorageGlobals.TraceConstructIDisposable(this);
         this.disposeTracker   = this.GetDisposeTracker();
         this.session          = session;
         this.properties       = PropertyDefinitionCollection.Merge <PropertyDefinition>(AllContactsCursor.requiredProperties, properties);
         this.sortByProperties = sortByProperties;
         this.PrepareQuery();
         disposeGuard.Success();
     }
 }
        public void CreateForAllPropertyDefinitions_ClassDefinitionWithBaseClassDefinition()
        {
            var baseClassDefinition = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(Company));
            var classDefinition     = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(Partner), baseClass: baseClassDefinition);

            var propertyDefinitionInBaseClass    = PropertyDefinitionObjectMother.CreateForFakePropertyInfo(baseClassDefinition, "Property1");
            var propertyDefinitionInDerivedClass = PropertyDefinitionObjectMother.CreateForFakePropertyInfo(classDefinition, "Property2");

            baseClassDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinitionInBaseClass }, true));
            classDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinitionInDerivedClass }, true));

            var propertyDefinitions = PropertyDefinitionCollection.CreateForAllProperties(classDefinition, false);

            Assert.That(propertyDefinitions.Count, Is.EqualTo(2));
            Assert.That(propertyDefinitions[0], Is.SameAs(propertyDefinitionInDerivedClass));
            Assert.That(propertyDefinitions[1], Is.SameAs(propertyDefinitionInBaseClass));
        }
        public FDOFeatureReaderFeature(IFeatureReader featureReader)
        {
            featureReader.RequireArgument <IFeatureReader>("featureReader").NotNull <IFeatureReader>();

            _featureReader   = featureReader;
            _classDefinition = _featureReader.GetClassDefinition();
            _propertyDefinitionCollection = _classDefinition.Properties;

            IEnumerable <PropertyDefinition> temp = from PropertyDefinition pd in _propertyDefinitionCollection
                                                    where pd.PropertyType == PropertyType.PropertyType_GeometricProperty
                                                    select pd;

            _geometryPropertyDefinition = temp.First <PropertyDefinition>();
            if (_geometryPropertyDefinition == null)
            {
                throw new ArgumentException("A geometry field was not found on the reader.");
            }
        }
        public IEnumerator <IStorePropertyBag> GetEnumerator()
        {
            ContactsByGALLinkIdEnumerator.Tracer.TraceDebug <Guid>((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: this.galLinkId = {0}", this.galLinkId);
            ComparisonFilter filter = new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.GALLinkID, this.galLinkId);

            PropertyDefinition[] allProperties = PropertyDefinitionCollection.Merge <PropertyDefinition>(new IEnumerable <PropertyDefinition>[]
            {
                ContactsByGALLinkIdEnumerator.RequiredProperties,
                this.requestedProperties
            });
            Folder      folder      = Folder.Bind(this.session, this.defaultFolderType, Array <PropertyDefinition> .Empty);
            QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, ContactsByGALLinkIdEnumerator.SortByGalLinkId, allProperties);

            if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, filter))
            {
                ContactsByGALLinkIdEnumerator.Tracer.TraceDebug <Guid>((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: SeekToCondition = false.  No contacts with GALLinkID={0}.", this.galLinkId);
                yield break;
            }
            for (;;)
            {
                ContactsByGALLinkIdEnumerator.Tracer.TraceDebug <int>((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: querying for {0} more property bags", 100);
                IStorePropertyBag[] contacts = queryResult.GetPropertyBags(100);
                if (contacts == null || contacts.Length == 0)
                {
                    break;
                }
                foreach (IStorePropertyBag contact in contacts)
                {
                    Guid contactGalLinkId = contact.GetValueOrDefault <Guid>(InternalSchema.GALLinkID, Guid.Empty);
                    if (contactGalLinkId != this.galLinkId)
                    {
                        goto Block_3;
                    }
                    ContactsByGALLinkIdEnumerator.Tracer.TraceDebug((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: found property bag");
                    yield return(contact);
                }
            }
            ContactsByGALLinkIdEnumerator.Tracer.TraceDebug((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: no more property bags");
            yield break;
Block_3:
            ContactsByGALLinkIdEnumerator.Tracer.TraceDebug((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: no more property bags");
            yield break;
            yield break;
        }
Exemplo n.º 22
0
        private void CheckPropertyDefinitions(
            PropertyDefinitionCollection expectedDefinitions,
            PropertyDefinitionCollection actualDefinitions,
            ClassDefinition expectedClassDefinition)
        {
            Assert.AreEqual(
                expectedDefinitions.Count,
                actualDefinitions.Count,
                "Number of property definitions in class definition '{0}' does not match. Expected: {1}",
                expectedClassDefinition.ID,
                string.Join(", ", actualDefinitions.Select(pd => pd.PropertyName)));

            foreach (PropertyDefinition expectedDefinition in expectedDefinitions)
            {
                PropertyDefinition actualDefinition = actualDefinitions[expectedDefinition.PropertyName];
                Assert.IsNotNull(actualDefinition, "Class '{0}' has no property '{1}'.", expectedClassDefinition.ID, expectedDefinition.PropertyName);
                CheckPropertyDefinition(expectedDefinition, actualDefinition, expectedClassDefinition);
            }
        }
Exemplo n.º 23
0
        private IEnumerable <IPropertyBag> QueryAssociationFolder(string context, QueryFilter filter, int?maxItems, params PropertyDefinition[] properties)
        {
            if (maxItems != null)
            {
                ArgumentValidator.ThrowIfZeroOrNegative("maxItems", maxItems.Value);
            }
            IFolder folder = this.mailboxAssociationFolder.Value;

            properties = PropertyDefinitionCollection.Merge <PropertyDefinition>(properties, new PropertyDefinition[]
            {
                ItemSchema.Id
            });
            using (IQueryResult queryResult = folder.IItemQuery(ItemQueryType.None, filter, null, properties))
            {
                int  itemsNumber   = 0;
                bool fetchAllItems = maxItems == null;
                while (fetchAllItems || itemsNumber < maxItems.Value)
                {
                    LocalAssociationStore.Tracer.TraceDebug <Guid>((long)this.GetHashCode(), "LocalAssociationStore.QueryAssociationFolder: Retrieving mailbox associations in mailbox {0}.", this.session.MailboxGuid);
                    int fetchRowCount         = fetchAllItems ? 100 : Math.Min(maxItems.Value - itemsNumber, 100);
                    IStorePropertyBag[] items = queryResult.GetPropertyBags(fetchRowCount);
                    if (items == null || items.Length == 0)
                    {
                        LocalAssociationStore.Tracer.TraceDebug((long)this.GetHashCode(), "LocalAssociationStore.QueryAssociationFolder: No more property bags found.");
                        yield break;
                    }
                    foreach (IStorePropertyBag item in items)
                    {
                        LocalAssociationStore.Tracer.TraceDebug((long)this.GetHashCode(), "LocalAssociationStore.QueryAssociationFolder: Returning property bag with Id {0}.", new object[]
                        {
                            item[ItemSchema.Id]
                        });
                        this.performanceTracker.IncrementAssociationsRead();
                        if (this.ValidateItem(context, item))
                        {
                            yield return(item);
                        }
                    }
                    itemsNumber += items.Length;
                }
            }
            yield break;
        }
        public FDOFeatureReaderFeature(IFeatureReader featureReader, string geometryFieldName)
        {
            featureReader.RequireArgument <IFeatureReader>("featureReader").NotNull <IFeatureReader>();
            geometryFieldName.RequireArgument <string>("geometryFieldName").NotNullOrEmpty();

            _featureReader   = featureReader;
            _classDefinition = _featureReader.GetClassDefinition();
            _propertyDefinitionCollection = _classDefinition.Properties;

            IEnumerable <PropertyDefinition> temp = from PropertyDefinition pd in _propertyDefinitionCollection
                                                    where (pd.PropertyType == PropertyType.PropertyType_GeometricProperty && pd.Name.ToLower() == geometryFieldName.ToLower())
                                                    select pd;

            _geometryPropertyDefinition = temp.First <PropertyDefinition>();
            if (_geometryPropertyDefinition == null)
            {
                throw new ArgumentException(string.Format("A geometry field with the given name '{0}' was not found", geometryFieldName));
            }
        }
Exemplo n.º 25
0
 /// <summary>
 /// Utility method to copy a property definition collection
 /// </summary>
 /// <param name="srcProperties"></param>
 /// <param name="targetProperties"></param>
 private static void CopyProperties(PropertyDefinitionCollection srcProperties, PropertyDefinitionCollection targetProperties, bool ignoreDeleted)
 {
     if (ignoreDeleted)
     {
         foreach (PropertyDefinition propDef in srcProperties)
         {
             if (propDef.ElementState != SchemaElementState.SchemaElementState_Deleted)
             {
                 targetProperties.Add(CloneProperty(propDef));
             }
         }
     }
     else
     {
         foreach (PropertyDefinition propDef in srcProperties)
         {
             targetProperties.Add(CloneProperty(propDef));
         }
     }
 }
Exemplo n.º 26
0
        public FDOFeatureReaderAttributes(IFeatureReader featureReader)
        {
            featureReader.RequireArgument <IFeatureReader>("featureReader").NotNull <IFeatureReader>();

            _featureReader = featureReader;
            ClassDefinition classDefinition = _featureReader.GetClassDefinition();
            PropertyDefinitionCollection propertyDefinitionCollection = classDefinition.Properties;

            List <string> fieldNames = new List <string>();

            foreach (PropertyDefinition pd in propertyDefinitionCollection)
            {
                if (pd.PropertyType == PropertyType.PropertyType_DataProperty)
                {
                    fieldNames.Add(pd.Name);
                    _fields.Add(pd.Name, pd);
                }
            }
            _fieldNames = fieldNames;
        }
Exemplo n.º 27
0
        internal static PropertyDefinition [] GetProperties(TypeDefinition type)
        {
            ArrayList list = new ArrayList();

            PropertyDefinitionCollection properties = type.Properties;            //type.GetProperties (flags);

            foreach (PropertyDefinition property in properties)
            {
                MethodDefinition getMethod = property.GetMethod;
                MethodDefinition setMethod = property.SetMethod;

                bool hasGetter = (getMethod != null) && MustDocumentMethod(getMethod);
                bool hasSetter = (setMethod != null) && MustDocumentMethod(setMethod);

                // if neither the getter or setter should be documented, then
                // skip the property
                if (hasGetter || hasSetter)
                {
                    list.Add(property);
                }
            }

            return((PropertyDefinition [])list.ToArray(typeof(PropertyDefinition)));
        }
Exemplo n.º 28
0
 public void VisitPropertyDefinitionCollection(PropertyDefinitionCollection properties)
 {
 }
Exemplo n.º 29
0
 public override void VisitPropertyDefinitionCollection(PropertyDefinitionCollection properties)
 {
     VisitCollection(properties);
 }
Exemplo n.º 30
0
    public PropertyGrid()
    {
      _propertyDefinitionsListener = new WeakEventListener<NotifyCollectionChangedEventArgs>( this.OnPropertyDefinitionsCollectionChanged );
      _editorDefinitionsListener = new WeakEventListener<NotifyCollectionChangedEventArgs>( this.OnEditorDefinitionsCollectionChanged);     
      UpdateContainerHelper();
      EditorDefinitions = new EditorDefinitionCollection();
      PropertyDefinitions = new PropertyDefinitionCollection();      

      AddHandler( PropertyItemBase.ItemSelectionChangedEvent, new RoutedEventHandler( OnItemSelectionChanged ) );
      AddHandler( PropertyItemsControl.PreparePropertyItemEvent, new PropertyItemEventHandler( OnPreparePropertyItemInternal ) );
      AddHandler( PropertyItemsControl.ClearPropertyItemEvent, new PropertyItemEventHandler( OnClearPropertyItemInternal ) );
      CommandBindings.Add( new CommandBinding( PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter ) );
    }
Exemplo n.º 31
0
    protected virtual void OnPropertyDefinitionsChanged( PropertyDefinitionCollection oldValue, PropertyDefinitionCollection newValue )
    {
      if( oldValue != null )
        CollectionChangedEventManager.RemoveListener( oldValue, _propertyDefinitionsListener );

      if( newValue != null )
        CollectionChangedEventManager.AddListener( newValue, _propertyDefinitionsListener );

      this.Notify( this.PropertyChanged, () => this.PropertyDefinitions );
    }
Exemplo n.º 32
0
 internal ConversationMembersQueryResult(MapiTable mapiTable, ICollection <PropertyDefinition> propertyDefinitions, IList <PropTag> alteredProperties, StoreSession session, bool isTableOwned, SortOrder sortOrder, AggregationExtension aggregationExtension) : base(mapiTable, PropertyDefinitionCollection.Merge <PropertyDefinition>(propertyDefinitions, ConversationMembersQueryResult.RequiredProperties), alteredProperties, session, isTableOwned, sortOrder)
 {
     this.originalProperties   = propertyDefinitions;
     this.aggregationExtension = aggregationExtension;
 }
Exemplo n.º 33
0
 /// <summary>
 /// Utility method to copy a property definition collection
 /// </summary>
 /// <param name="srcProperties"></param>
 /// <param name="targetProperties"></param>
 private static void CopyProperties(PropertyDefinitionCollection srcProperties, PropertyDefinitionCollection targetProperties, bool ignoreDeleted)
 {
     if (ignoreDeleted)
     {
         foreach (PropertyDefinition propDef in srcProperties)
         {
             if (propDef.ElementState != SchemaElementState.SchemaElementState_Deleted)
                 targetProperties.Add(CloneProperty(propDef));
         }
     }
     else
     {
         foreach (PropertyDefinition propDef in srcProperties)
         {
             targetProperties.Add(CloneProperty(propDef));
         }
     }
 }
Exemplo n.º 34
0
 public PropertyGrid()
 {
   EditorDefinitions = new EditorDefinitionCollection();
   PropertyDefinitions = new PropertyDefinitionCollection();
   CommandBindings.Add( new CommandBinding( PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter ) );
 }
        void EnsureProperties()
        {
            if (this.properties == null) {
                this.properties = new PropertyDefinitionCollection(
                    TypeDescriptor.GetProperties(this.SourceClrType).Cast<PropertyDescriptor>().Select(t => new ReflectedPropertyDefinition(t)));

                var defaultMember = (PropertyInfo) this.type.GetDefaultMembers().FirstOrDefault(IsValidIndexer);
                if (defaultMember != null) {
                    this.defaultProperty = new ReflectedIndexerPropertyDefinition(defaultMember);
                    this.Properties.AddInternal(this.defaultProperty);
                }

                var methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public);
                FindExtensionProperties(methods);

                // Could define extender properties
                ExtensionCache.Init(type.Assembly);
                this.properties.MakeReadOnly();
            }
        }
Exemplo n.º 36
0
 public void SetBaseProperties(PropertyDefinitionCollection value)
 {
     this.DecoratedObject.SetBaseProperties(value);
 }
Exemplo n.º 37
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            PropertyDefinitionCollection col = new PropertyDefinitionCollection();

            col.Add(new PropertyDefinition()
            {
                Name = "Name"
            });

            if (value is Page)
            {
                col.Add(new PropertyDefinition()
                {
                    Name = "Width"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Height"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Image"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "ImageTop"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "ImageLeft"
                });
            }

            else if (value is Element)
            {
                col.Add(new PropertyDefinition()
                {
                    Name = "Width"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Height"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "X"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Y"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Value"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "FontSize"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "FontName"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Bold"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Italic"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Underline"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "Strikeout"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "ElementType"
                });
                col.Add(new PropertyDefinition()
                {
                    Name = "ListChoises"
                });
                //col.Add(new PropertyDefinition() { Name = "Font" });
                //col.Add(new PropertyDefinition() { Name = "Style" });
                //col.Add(new PropertyDefinition() { Name = "GroupName" });
            }

            return(col);
        }
        public WixInternalPropertyGridControl()
        {
            // Получаем свойства для чтения.
              PropertyInfo PropertyBuilderInfo = typeof(PropertyGridControl).GetProperty("PropertyBuilder", BindingFlags.Instance | BindingFlags.NonPublic);
              PropertyInfo DataControllerInfo = typeof(RowDataGenerator).GetProperty("DataController", BindingFlags.Instance | BindingFlags.NonPublic);
              PropertyInfo RowDataGeneratorInfo = typeof(PropertyGridControl).GetProperty("RowDataGenerator", BindingFlags.Instance | BindingFlags.NonPublic);

              // Аналогично this.PropertyBuilder = new WixPropertyBuilder(this).
              PropertyBuilderInfo.SetValue(this, propertyBuilder = new WixPropertyBuilder(this), null);

              RowDataGenerator rowDataGenerator = new RowDataGenerator();

              rowDataGenerator.BeginInit();
              rowDataGenerator.PropertyBuilder = PropertyBuilder;
              rowDataGenerator.View = View;

              // Аналогично rowDataGenerator.DataController = this.DataController.
              DataControllerInfo.SetValue(rowDataGenerator, DataController, null);
              // Аналогично this.RowDataGenerator = rowDataGenerator.
              RowDataGeneratorInfo.SetValue(this, rowDataGenerator, null);

              PropertyDefinitions = new PropertyDefinitionCollection();
              UpdateDataViewByShowCategories();
              rowDataGenerator.EndInit();

              ((IVisualClient)View).Invalidate(RowHandle.Root);
              InitializeInputBindings();
              AddLogicalChild(PropertyBuilder);
        }