Пример #1
0
        /// <summary>
        /// Triggered when properties have been changed inside Sandbox. Will notify the managed entity instance (if it exists).
        /// </summary>
        /// <param name="entity">Entity.</param>
        public override void PropertiesChanged(IEntity entity)
        {
            uint       id  = entity.GetId();
            BaseEntity ent = EntityFramework.GetEntity(id);

            if (ent != null)
            {
                ent.OnPropertiesChanged();
            }
        }
Пример #2
0
        /// <summary>
        /// Set the property of the given native entity at the given property index to the given value in string representation. Won't do anything if the index is invalid, no managed entity instance exists for the native entity or the value cannot be converted.
        /// </summary>
        /// <param name="entity">Native entity instance.</param>
        /// <param name="index">Property index.</param>
        /// <param name="value">Value in string representation.</param>
        public override void SetProperty(IEntity entity, int index, string value)
        {
            if (index >= _properties.Count)
            {
                return;
            }

            uint       id  = entity.GetId();
            BaseEntity ent = EntityFramework.GetEntity(id);

            if (ent == null)
            {
                return;
            }

            _properties [index].Set(ent, value);
        }
Пример #3
0
        /// <summary>
        /// Get the current property value for the given native entity at the given property index.
        /// </summary>
        /// <returns>'Null' if the index doesn't correspond to a valid index - otherwise the current property value in string representation.</returns>
        /// <param name="entity">Native entity instance.</param>
        /// <param name="index">Property index.</param>
        public override string GetProperty(IEntity entity, int index)
        {
            if (index >= _properties.Count)
            {
                return(null);
            }

            uint       id  = entity.GetId();
            BaseEntity ent = EntityFramework.GetEntity(id);

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

            return(_properties [index].Get(ent));
        }