Ejemplo n.º 1
0
    /// <summary>
    /// 创建一个 HTML 表单对象
    /// </summary>
    /// <param name="element">表单元素</param>
    /// <param name="configuration">表单配置</param>
    /// <param name="provider">表单控件提供程序</param>
    public HtmlForm( IHtmlElement element, FormConfiguration configuration = null, IFormProvider provider = null )
    {

      if ( element == null )
        throw new ArgumentNullException( "element" );

      var document = element.Document;

      if ( document == null )
        throw new InvalidOperationException();


      var modifier = document.DomModifier as ISynchronizedDomModifier;
      if ( modifier == null )
        throw new InvalidOperationException();


      SyncRoot = modifier.SyncRoot;
      
      _element = element;

      Configuration = configuration ?? new FormConfiguration();
      Provider = provider ?? new StandardFormProvider();


      RefreshForm();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 尝试将一个HTML元素转换为表单
    /// </summary>
    /// <param name="element">要转换为表单的元素</param>
    /// <param name="configuration">表单配置</param>
    /// <param name="provider">表单控件提供程序</param>
    /// <returns></returns>
    public static HtmlForm AsForm( this IHtmlElement element, FormConfiguration configuration = null, IFormProvider provider = null )
    {

      if ( element == null )
        throw new ArgumentNullException( "element" );


      return new HtmlForm( element, configuration, provider );
    }
Ejemplo n.º 3
0
        /// <summary>
        /// 尝试将一个HTML元素转换为表单
        /// </summary>
        /// <param name="element">要转换为表单的元素</param>
        /// <param name="configuration">表单配置</param>
        /// <param name="provider">表单控件提供程序</param>
        /// <returns></returns>
        public static HtmlForm AsForm(this IHtmlElement element, FormConfiguration configuration = null, IFormProvider provider = null)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }


            return(new HtmlForm(element, configuration, provider));
        }