예제 #1
0
        /// <summary>
        ///     Pre validates the given set of values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void UpdateParameters(Dictionary <string, IGPParameter> parameters, IGPEnvironmentManager environmentManager, IGPUtilities2 utilities)
        {
            IGPValue value = utilities.UnpackGPValue(parameters["in_table"]);

            if (!value.IsEmpty())
            {
                IObjectClass table = utilities.OpenTable(value);
                if (table != null)
                {
                    // Populate the subtype parameter with the subtypes from the table and ensure the it's editable.
                    IGPParameterEdit3 subtypeParameter = (IGPParameterEdit3)parameters["in_subtype"];
                    subtypeParameter.Domain = this.GetSubtypes(table);

                    // Populate the auto updater values for the object class for the specific subtype.
                    IGPValue subtype = utilities.UnpackGPValue(subtypeParameter);
                    if (!subtype.IsEmpty())
                    {
                        var subtypeCode = subtype.Cast(-1);
                        IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                        configTopLevel.Workspace = utilities.GetWorkspace(value);

                        var values = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureCreate);
                        IGPParameterEdit3 parameter = (IGPParameterEdit3)parameters["in_create"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureUpdate);
                        parameter        = (IGPParameterEdit3)parameters["in_update"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureDelete);
                        parameter        = (IGPParameterEdit3)parameters["in_delete"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventBeforeFeatureSplit);
                        parameter        = (IGPParameterEdit3)parameters["in_before"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureSplit);
                        parameter        = (IGPParameterEdit3)parameters["in_split"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventAfterFeatureSplit);
                        parameter        = (IGPParameterEdit3)parameters["in_after"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        ///     Pre validates the given set of values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void UpdateParameters(Dictionary <string, IGPParameter> parameters, IGPEnvironmentManager environmentManager, IGPUtilities2 utilities)
        {
            IGPValue value = utilities.UnpackGPValue(parameters["in_table"]);

            if (!value.IsEmpty())
            {
                IObjectClass table = utilities.OpenTable(value);
                if (table != null)
                {
                    IGPParameterEdit3 parameter = (IGPParameterEdit3)parameters["in_field"];
                    parameter.Domain = base.GetFields(table);
                    string fieldName = utilities.UnpackGPValue(parameter).GetAsText();

                    parameter        = (IGPParameterEdit3)parameters["in_subtype"];
                    parameter.Domain = base.GetSubtypes(table);

                    IGPValue subtype = utilities.UnpackGPValue(parameter);
                    if (!subtype.IsEmpty())
                    {
                        if (!string.IsNullOrEmpty(fieldName))
                        {
                            var subtypeCode = subtype.Cast(-1);
                            IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                            configTopLevel.Workspace = utilities.GetWorkspace(value);

                            var values = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureCreate, fieldName);
                            parameter        = (IGPParameterEdit3)parameters["in_create"];
                            parameter.Domain = base.CreateDomain <IMMAttrAUStrategy>(values[subtypeCode][fieldName]);

                            values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureUpdate, fieldName);
                            parameter        = (IGPParameterEdit3)parameters["in_update"];
                            parameter.Domain = base.CreateDomain <IMMAttrAUStrategy>(values[subtypeCode][fieldName]);

                            values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureDelete, fieldName);
                            parameter        = (IGPParameterEdit3)parameters["in_delete"];
                            parameter.Domain = base.CreateDomain <IMMAttrAUStrategy>(values[subtypeCode][fieldName]);
                        }
                    }
                }
            }
        }