예제 #1
0
파일: HtmlForm.cs 프로젝트: ajayumi/Jumony
    /// <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();
    }
예제 #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 );
    }
예제 #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));
        }