コード例 #1
0
        /// <summary>
        ///     Add the <paramref name="uids" /> from the <paramref name="list" /> that match the event and UID.
        /// </summary>
        /// <param name="uids">The dictionary of events and UIDs.</param>
        /// <param name="list">The list of events and UIDs.</param>
        /// <param name="messages">The messages.</param>
        protected void Add(Dictionary <mmEditEvent, IEnumerable <IUID> > uids, ID8List list, IGPMessages messages)
        {
            // Enumerate through the dictionary of events and UIDs.
            foreach (var uid in uids)
            {
                // Locate all of the "AutoValue" types.
                foreach (var item in list.AsEnumerable())
                {
                    if (item.ItemType == mmd8ItemType.mmitAutoValue)
                    {
                        IMMAutoValue autoValue = (IMMAutoValue)item;
                        if (autoValue.AutoGenID != null && autoValue.EditEvent == uid.Key)
                        {
                            // When the UID is not contained within the list.
                            if (!uid.Value.Contains(autoValue.AutoGenID))
                            {
                                // Enumerate through all of the UIDs in the collection and add them to list.
                                foreach (var id in uid.Value)
                                {
                                    IMMAutoValue newAutoValue = new MMAutoValueClass();
                                    newAutoValue.EditEvent = uid.Key;
                                    newAutoValue.AutoGenID = new UIDClass()
                                    {
                                        Value = id
                                    };

                                    ((ID8List)item).AddEx(newAutoValue);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///     Changes the field visibility to the specified <paramref name="visible" /> value for the fields
        ///     that match the field name.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <param name="visible">if set to <c>true</c> if the field is visible.</param>
        /// <exception cref="System.NullReferenceException">
        ///     source
        ///     or
        ///     fieldName
        /// </exception>
        public static void ChangeVisibility(this IMMFeatureClass source, string fieldName, bool visible)
        {
            if (source == null)
            {
                throw new NullReferenceException("source");
            }
            if (fieldName == null)
            {
                throw new NullReferenceException("fieldName");
            }

            ID8List list = source as ID8List;

            if (list == null)
            {
                return;
            }

            IMMSubtype all = source.GetSubtype(ConfigTopLevelExtensions.ALL_SUBTYPES);

            if (all != null)
            {
                all.ChangeVisibility(fieldName, visible);
            }

            foreach (var subtype in list.AsEnumerable().OfType <IMMSubtype>())
            {
                subtype.ChangeVisibility(fieldName, visible);
            }
        }
コード例 #3
0
        /// <summary>
        ///     Creates an <see cref="IEnumerable{T}" /> from an <see cref="ID8List" />
        /// </summary>
        /// <param name="source">An <see cref="ID8List" /> to create an <see cref="IEnumerable{T}" /> from.</param>
        /// <returns>
        ///     An <see cref="IEnumerable{T}" /> that contains the list items from the input source.
        /// </returns>
        public static IEnumerable <ID8ListItem> AsEnumerable(this ID8List source)
        {
            if (source == null)
            {
                return(null);
            }

            return(source.AsEnumerable(Recursion <ID8ListItem> .Infinity));
        }
コード例 #4
0
 /// <summary>
 ///     Removes the <paramref name="uids" /> from the <paramref name="list" /> that match the event and UID.
 /// </summary>
 /// <param name="uids">The dictionary of events and UIDs.</param>
 /// <param name="list">The list of events and UIDs.</param>
 /// <param name="messages">The messages.</param>
 protected void Remove(Dictionary <mmEditEvent, IEnumerable <IUID> > uids, ID8List list, IGPMessages messages)
 {
     // Enumerate through the dictionary of events and UIDs.
     foreach (var uid in uids)
     {
         // Locate all of the "AutoValue" types.
         foreach (var item in list.AsEnumerable())
         {
             if (item.ItemType == mmd8ItemType.mmitAutoValue)
             {
                 IMMAutoValue autoValue = (IMMAutoValue)item;
                 if (autoValue.AutoGenID != null && autoValue.EditEvent == uid.Key)
                 {
                     // When the UID is contained within the list it should be removed.
                     if (uid.Value.Contains(autoValue.AutoGenID))
                     {
                         list.Remove(item);
                         messages.Add(esriGPMessageType.esriGPMessageTypeInformative, "Removing the {0} from the {1} event.", autoValue.AutoGenID.Value, autoValue.EditEvent);
                     }
                 }
             }
         }
     }
 }
コード例 #5
0
        public void ID8List_AsEnumerable_Equals_9()
        {
            var iter = _List.AsEnumerable().OfType <ID8Feature>();

            Assert.AreEqual(9, iter.Count());
        }