/// <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);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///     Adds the automatic value (i.e ArcFM Auto Updater) to the subtype source for the specified event.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="editEvent">The edit event.</param>
        /// <param name="guid">The unique identifier.</param>
        /// <returns>
        ///     Returns a <see cref="IMMAutoValue" /> representing the value that was added; otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException">guid</exception>
        public static IMMAutoValue AddAutoValue(this IMMSubtype source, mmEditEvent editEvent, Guid guid)
        {
            if (source == null)
            {
                return(null);
            }
            if (guid == Guid.Empty)
            {
                throw new ArgumentNullException("guid");
            }

            var list = source as ID8List;

            if (list == null)
            {
                return(null);
            }

            var item = source.GetAutoValue(editEvent, guid);

            if (item != null)
            {
                return(item);
            }

            UID uid = new UIDClass();

            uid.Value = guid.ToString("B");

            item = new MMAutoValueClass
            {
                AutoGenID = uid,
                EditEvent = editEvent
            };

            list.Add((ID8ListItem)item);

            return(item);
        }