Example #1
0
        /// <summary>
        ///     Changes the field visibility to the specified <paramref name="visible" /> value for the subtype in the specified
        ///     <paramref name="table" /> object class
        ///     that match the field name.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="table">The object class.</param>
        /// <param name="subtypeCode">The subtype code.</param>
        /// <param name="visible">if set to <c>true</c> if the field is visible.</param>
        /// <param name="fieldNames">The field names.</param>
        /// <exception cref="ArgumentNullException">
        ///     fieldNames
        ///     or
        ///     table
        /// </exception>
        public static void ChangeVisibility(this IMMConfigTopLevel source, IObjectClass table, int subtypeCode, bool visible, params string[] fieldNames)
        {
            if (source == null)
            {
                return;
            }
            if (fieldNames == null)
            {
                throw new ArgumentNullException("fieldNames");
            }
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            IMMSubtype subtype = source.GetSubtypeByID(table, subtypeCode, false);

            if (subtype == null)
            {
                return;
            }

            foreach (var fieldName in fieldNames)
            {
                subtype.ChangeVisibility(fieldName, visible);
            }
        }
Example #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);
            }
        }