FRBDK/GlueView/GlueView/GluxViewManager/RuntimeObjects/ElementRuntime.cs
/// <summary>
/// This method populates the mCustomVariables list with default valued variables.  These can later get set in SetCustomVariable, but they need to exist so that 
/// plugins like the script parser know whether something is a custom variable or not.
/// </summary>
/// <param name="cv">The variable to evaluate and add if it is a custom variable.</param>
This method populates the mCustomVariables list with default valued variables.  These can later get set in SetCustomVariable, but they need to exist so that
plugins like the script parser know whether something is a custom variable or not.
This method populates the mCustomVariables list with default valued variables . These can later get set in SetCustomVariable but they need to exist so that plugins like the script parser know whether something is a custom variable or not .
private void CreateCustomVariableContainer(CustomVariable cv)
        {
            bool isCustomVariable = true;
            if(!string.IsNullOrEmpty(cv.SourceObject))
            {
                isCustomVariable = false;
            }
            if (isCustomVariable)
            {
                Type positionedObjectType = typeof(PositionedObject);
                PropertyInfo property = positionedObjectType.GetProperty(cv.Name);
                FieldInfo field = positionedObjectType.GetField(cv.Name);
                if (property != null || field != null)
                {
                    isCustomVariable = false;
                }
            }
            if (isCustomVariable)
            {
                EntitySave baseEntitySave = ObjectFinder.Self.GetEntitySave(this.AssociatedIElement.BaseElement);
                if (baseEntitySave != null && baseEntitySave.GetCustomVariable(cv.Name) != null)
                {
                    isCustomVariable = false;
                }
            }
            if (isCustomVariable)
            {
                object defaultValue = null;
                if (cv.GetIsFile())
                {
                    defaultValue = null;
                }
                else if (cv.GetIsCsv())
                {
                    defaultValue = null;
                }
                else if (cv.GetIsVariableState())
                {
                    defaultValue = null;
                }
                else
                {
                    try
                    {
                        defaultValue = TypeManager.GetDefaultForTypeAsType(cv.Type);
                    }
                    catch
                    {
                        throw new Exception("Could not get the default value for variable " + cv);
                    }
                }
                mCustomVariables.Add(new PropertyValuePair(cv.Name, defaultValue));
            }
        }
private void CreateCustomVariableContainer ( CustomVariable cv ) { bool isCustomVariable = true ; if ( ! string . IsNullOrEmpty ( cv . SourceObject ) ) { isCustomVariable = false ; } if ( isCustomVariable ) { Type positionedObjectType = typeof ( PositionedObject ) ; PropertyInfo property = positionedObjectType . GetProperty ( cv . Name ) ; FieldInfo field = positionedObjectType . GetField ( cv . Name ) ; if ( property != null || field != null ) { isCustomVariable = false ; } } if ( isCustomVariable ) { EntitySave baseEntitySave = ObjectFinder . Self . GetEntitySave ( this . AssociatedIElement . BaseElement ) ; if ( baseEntitySave != null && baseEntitySave . GetCustomVariable ( cv . Name ) != null ) { isCustomVariable = false ; } } if ( isCustomVariable ) { object defaultValue = null ; if ( cv . GetIsFile ( ) ) { defaultValue = null ; } else if ( cv . GetIsCsv ( ) ) { defaultValue = null ; } else if ( cv . GetIsVariableState ( ) ) { defaultValue = null ; } else { try { defaultValue = TypeManager . GetDefaultForTypeAsType ( cv . Type ) ; } catch { throw new Exception ( " " + cv ) ; } } mCustomVariables . Add ( new PropertyValuePair ( cv . Name , defaultValue ) ) ; } }
This method populates the mCustomVariables list with default valued variables.
This method populates the mCustomVariables list with default valued variables .
cv
CustomVariable
The variable to evaluate and add if it is a custom variable.
The variable to evaluate and add if it is a custom variable .