Пример #1
0
        public override bool Connect(IDomain domain, IArea rootArea, IArea currentArea, IObject currentObject)
        {
            IResource          Resource          = HtmlResource;
            IObject            Object            = HtmlObject;
            IObjectProperty    ObjectProperty    = HtmlObjectProperty;
            IDeclarationSource ObjectPropertyKey = HtmlKey;
            bool IsConnected = HtmlProperty.ConnectToResourceOrObject(domain, currentArea, currentObject, ref Resource, ref Object, ref ObjectProperty, ref ObjectPropertyKey);

            if (!(ObjectProperty is IObjectPropertyReadonlyString) &&
                !(ObjectProperty is IObjectPropertyStringDictionary))
            {
                throw new ParsingException(0, Source.Source, $"Invalid type for property '{Source.Name}'.");
            }

            HtmlResource       = Resource;
            HtmlObject         = Object;
            HtmlObjectProperty = ObjectProperty;
            HtmlKey            = ObjectPropertyKey;

            HtmlObjectProperty?.SetIsRead();

            return(IsConnected);
        }
 set => SetValue(HtmlProperty, value);
Пример #3
0
 /// <summary>
 /// Sets a property.
 /// </summary>
 /// <param name="property">The HTML property.</param>
 /// <param name="value">The value to set.</param>
 public void SetProperty(HtmlProperty property, object value)
 {
     SetProperty(property.ScriptPropertyName(), value);
 }
Пример #4
0
 /// <summary>
 /// Returns the ScriptProperty name.  This is a camel-case value. Only
 /// alters the first character.
 /// </summary>
 /// <param name="property">The property name.</param>
 /// <returns>Returns the value, as a string, with the first letter
 /// capitalized.</returns>
 public static string ScriptPropertyName(this HtmlProperty property)
 {
     return(CamelCase(property.ToString()));
 }
Пример #5
0
 /// <summary>
 /// Gets a property.
 /// </summary>
 /// <param name="property">The HTML property.</param>
 /// <returns>Returns the value.</returns>
 public object GetProperty(HtmlProperty property)
 {
     return GetProperty(property.ScriptPropertyName());
 }
Пример #6
0
 /// <summary>
 /// Get a property value as an integer.
 /// </summary>
 /// <param name="property">The ScriptObject property name.</param>
 /// <returns>Returns the property value.</returns>
 protected int GetPropertyNumber(HtmlProperty property)
 {
     return GetPropertyNumber(property.ScriptPropertyName());
 }
Пример #7
0
 /// <summary>
 /// Sets a property.
 /// </summary>
 /// <param name="property">The HTML property.</param>
 /// <param name="value">The value to set.</param>
 public void SetProperty(HtmlProperty property, object value)
 {
     SetProperty(property.ScriptPropertyName(), value);
 }
Пример #8
0
 /// <summary>
 /// Gets a property.
 /// </summary>
 /// <param name="property">The HTML property.</param>
 /// <returns>Returns the value.</returns>
 public object GetProperty(HtmlProperty property)
 {
     return(GetProperty(property.ScriptPropertyName()));
 }
Пример #9
0
 /// <summary>
 /// Get a property value as an integer.
 /// </summary>
 /// <param name="property">The ScriptObject property name.</param>
 /// <returns>Returns the property value.</returns>
 protected int GetPropertyNumber(HtmlProperty property)
 {
     return(GetPropertyNumber(property.ScriptPropertyName()));
 }