当前位置: 首页>>代码示例>>C#>>正文


C# IObject.set_Value方法代码示例

本文整理汇总了C#中IObject.set_Value方法的典型用法代码示例。如果您正苦于以下问题:C# IObject.set_Value方法的具体用法?C# IObject.set_Value怎么用?C# IObject.set_Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObject的用法示例。


在下文中一共展示了IObject.set_Value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetDynamicValues


//.........这里部分代码省略.........
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14av"));
                                                        continue;
                                                    }

                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;

                                                    if (intFldIdxs.Count == 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14aw"));
                                                        continue;
                                                    }
                                                    if (intFldIdxs[0] == -1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am"));
                                                        continue;
                                                    }
                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]))
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ax"));
                                                        if (inObject.get_Value(intFldIdxs[0]).ToString() == valToCheck)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                            int chngFldIdx = Globals.GetFieldIndex(inObject.Fields, fldToChange);
                                                            if (chngFldIdx == -1)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am"));
                                                                continue;
                                                            }
                                                            try
                                                            {
                                                                inObject.set_Value(chngFldIdx, valToSet);
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));
                                                            }
                                                            catch
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14c") + valToSet);
                                                            }

                                                        }
                                                    }
                                                    pRowCh = null;

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "FIELD_TRIGGER: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "FIELD_TRIGGER");
                                            }
                                            break;
                                        case "VALIDATE_ATTRIBUTE_LOOKUP":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "VALIDATE_ATTRIBUTE_LOOKUP");
                                                IRowChanges pRowCh = null;
                                                ISQLSyntax sqlSyntax = null;
                                                IQueryFilter pQFilt = null;
                                                try
                                                {
                                                    if ((valData != null) && (inObject != null))
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:67,代码来源:AttributeAssistantEditorExtension.cs

示例2: setDynamicDefaults

        private void setDynamicDefaults(IObject inObject, string mode)
        {
            try
            {
                //Convert row to feature (test for feature is null before using - this could be a table update)
                IFeature inFeature = inObject as IFeature;

                // Skip Orphan Junctions (saves time)
                if (inFeature != null)
                {
                    INetworkFeature inNetFeat = inObject as INetworkFeature;
                    if ((inNetFeat != null) &&
                        (inFeature.Class.ObjectClassID == inNetFeat.GeometricNetwork.OrphanJunctionFeatureClass.ObjectClassID))
                        return;
                }

                //Get cursor to dynamic values table retriving only
                ICursor tabCursor;
                getDefaultRows(inObject, out tabCursor);
                IRow row = null;
                if (tabCursor != null)
                    row = tabCursor.NextRow();

                //for each row in the matching rows (matched by table name or wildcard) returned from the config table
                while (row != null)
                {
                    //get fieldname
                    string fieldName = row.get_Value(dynTargetField).ToString();

                    //if this field is found in the feature/object being added or modified...
                    int fieldNum = inObject.Fields.FindField(fieldName);
                    if (fieldNum > -1)
                    {
                        // get requested method and any data parameters
                        string valMethod = row.get_Value(dynMethodField).ToString();
                        string valData = row.get_Value(dynDataField).ToString();

                        switch (mode)
                        {
                            case "OnCreate":
                                //Continue to next field in config table if create events were not requested
                                if (row.get_Value(dynCreateField).ToString() == "0")
                                {
                                    row = tabCursor.NextRow();
                                    continue;
                                }
                                break;
                            case "OnChange":
                                // Collect value for changed feature (stored for LAST VALUE method)
                                IRowChanges inChanges = inObject as IRowChanges;
                                bool changed = inChanges.get_ValueChanged(fieldNum);
                                if (changed)
                                    lastValueProperties.SetProperty(fieldName, inObject.get_Value(fieldNum));
                                //Continue to next field in config table if change events were not requested
                                if (row.get_Value(dynChangeField).ToString() == "0")
                                {
                                    row = tabCursor.NextRow();
                                    continue;
                                }
                                break;
                        }

                        // set values as specified
                        switch (valMethod)
                        {
                            case "TIMESTAMP":

                                inObject.set_Value(fieldNum, DateTime.Now);
                                break;

                            case "LAST_VALUE":

                                if (mode == "OnCreate")
                                {
                                    //if (inObject.get_Value(fieldNum) == null)
                                    //{
                                    object lastValue = lastValueProperties.GetProperty(fieldName);
                                    if (lastValue != null)
                                        inObject.set_Value(fieldNum, lastValue);
                                    //}
                                }

                                break;

                            case "FIELD":

                                // verify that field to copy exists
                                int fieldCopy = inObject.Fields.FindField(valData as string);
                                if (fieldCopy > -1)
                                {
                                    //copy value only if current field is empty
                                    string currentValue = inObject.get_Value(fieldNum).ToString();
                                    if (currentValue == "")
                                        inObject.set_Value(fieldNum, inObject.get_Value(fieldCopy));
                                }
                                break;

                            case "CURRENT_USER":

                                if (lastEditorName == null)
//.........这里部分代码省略.........
开发者ID:jorik041,项目名称:utilities-telecom-desktop-addins,代码行数:101,代码来源:FiberEditorExtension.cs

示例3: OnCreate

		/// <summary>
		/// Fired when a new object is created.
		/// </summary>
		/// <param name="obj">The new object.</param>
		public void OnCreate(IObject obj)
		{
			// Set the created field's value to the current date and time.
			if (createdFieldIndex != -1)
			{
				obj.set_Value(createdFieldIndex, DateTime.Now);
			}

			// Set the user field's value to the current user.
			if (userFieldIndex != -1)
			{
				obj.set_Value(userFieldIndex, userName);
			}
		}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:18,代码来源:TimestampClassExtension.cs

示例4: SetDynamicValues


//.........这里部分代码省略.........
                                                    {
                                                        AAState.WriteLine("                  ERROR: Incorrect Value info was not found");
                                                        continue;
                                                    }

                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;
                                                    //Globals.GetFieldIndex(inObject.Fields,
                                                    if (intFldIdxs.Count == 0)
                                                    {
                                                        AAState.WriteLine("                  ERROR: Field Not Set");
                                                        continue;
                                                    }
                                                    if (intFldIdxs[0] == -1)
                                                    {
                                                        AAState.WriteLine("                  ERROR: Field Not Found");
                                                        continue;
                                                    }
                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]))
                                                    {
                                                        AAState.WriteLine("                  Listed field changed");
                                                        if (inObject.get_Value(intFldIdxs[0]).ToString() == valToCheck)
                                                        {
                                                            AAState.WriteLine("                  Values Match");
                                                            int chngFldIdx = Globals.GetFieldIndex(inObject.Fields, fldToChange);
                                                            if (chngFldIdx == -1)
                                                            {
                                                                AAState.WriteLine("                  ERROR: Field Not Found");
                                                                continue;
                                                            }
                                                            try
                                                            {
                                                                inObject.set_Value(chngFldIdx, valToSet);
                                                                AAState.WriteLine("                  Value Set");
                                                            }
                                                            catch
                                                            {
                                                                AAState.WriteLine("                  ERROR: Could not store Value: " + valToSet);
                                                            }

                                                        }
                                                    }
                                                    pRowCh = null;

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine("                  ERROR: FIELD_TRIGGER: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine("                  Finished: FIELD_TRIGGER");
                                            }
                                            break;
                                        case "VALIDATE_ATTRIBUTE_LOOKUP":
                                            {
                                                AAState.WriteLine("                  Trying VALIDATE_ATTRIBUTE_LOOKUP");
                                                IRowChanges pRowCh = null;
                                                ISQLSyntax sqlSyntax = null;
                                                IQueryFilter pQFilt = null;
                                                try
                                                {
                                                    if ((valData != null) && (inFeature != null))
开发者ID:riordabr,项目名称:3d-cities-template,代码行数:67,代码来源:AttributeAssistantEditorExtension.cs

示例5: SetDynamicValues


//.........这里部分代码省略.........

                                                                        fCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                        sourceFeature = fCursor.NextFeature();
                                                                        nearestFeature = null;

                                                                        proxOp = (IProximityOperator)inFeature.Shape;
                                                                        lastDistance = searchDistance;
                                                                        if (sourceFeature != null)
                                                                        {
                                                                            AAState.WriteLine("                  Features Found, looping for closest");

                                                                            while (sourceFeature != null)
                                                                            {

                                                                                distance = proxOp.ReturnDistance(sourceFeature.Shape);
                                                                                if (distance <= lastDistance)
                                                                                {
                                                                                    nearestFeature = sourceFeature;
                                                                                    lastDistance = distance;
                                                                                }
                                                                                sourceFeature = fCursor.NextFeature();
                                                                            }
                                                                        }
                                                                        if (nearestFeature != null)
                                                                        {
                                                                            AAState.WriteLine("                  Closest Feature is " + lastDistance + " Away with OID of " + nearestFeature.OID);

                                                                            for (int i = 0; i < sourceFieldNums.Length; i++)
                                                                            {
                                                                                try
                                                                                {
                                                                                    AAState.WriteLine("                  Trying to copy " + sourceFieldNums[i] + " to " + destFieldNums[i]);

                                                                                    inObject.set_Value(destFieldNums[i], nearestFeature.get_Value(sourceFieldNums[i]));
                                                                                }
                                                                                catch
                                                                                {
                                                                                    AAState.WriteLine("                  ERROR: copying " + sourceFieldNums[i] + " to " + destFieldNums[i]);

                                                                                }
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  No Feature was found, default fields");

                                                                            for (int i = 0; i < destFieldNums.Length; i++)
                                                                            {
                                                                                IField field = inObject.Fields.get_Field(destFieldNums[i]);
                                                                                object newval = field.DefaultValue;
                                                                                if (newval == null)
                                                                                {
                                                                                    if (field.IsNullable)
                                                                                    {
                                                                                        inObject.set_Value(destFieldNums[i], null);
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    inObject.set_Value(destFieldNums[i], newval);
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    else
                                                                    {
开发者ID:riordabr,项目名称:3d-cities-template,代码行数:67,代码来源:Copy+of+AttributeAssistantEditorExtension.cs


注:本文中的IObject.set_Value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。