コード例 #1
0
        /// <summary>
        /// 添加所有资源引用
        /// </summary>
        /// <param name="document"></param>
        /// <param name="clearReferenceFirst"></param>
        public void AddAllReference(IHtmlDocument document, bool clearReferenceFirst = true)
        {
            if (document == null)
            {
                return;
            }

            if (clearReferenceFirst)
            {
                ClearAllReference(document);
            }

            var headElement = document.FindFirstOrDefault("head");

            if (headElement == null)
            {
                var firstElement = document.Elements().FirstOrDefault();

                if (firstElement != null)
                {
                    headElement = firstElement.AddElementBeforeSelf("head");
                }
                else
                {
                    headElement = document.AddElement(0, "head");
                }
            }

            AddStyleReferences(headElement, styleFiles);
            AddScriptReferences(headElement, scriptFiles);
        }
コード例 #2
0
ファイル: BindingManager.cs プロジェクト: ajayumi/Jumony
    /// <summary>
    /// 对文档进行数据绑定
    /// </summary>
    /// <param name="document">要进行数据绑定的文档</param>
    protected virtual void DataBind( IHtmlDocument document, object dataContext )
    {
      var bindings = FindBindings( document ).OrderBy( b => b.Priority );

      var context = new BindingContext( this, dataContext );
      bindings.ForAll( b => b.DataBind( context ) );

      document.Elements().ForAll( e => DataBind( e, context ) );
    }
コード例 #3
0
ファイル: BindingManager.cs プロジェクト: zpzgone/Jumony
        /// <summary>
        /// 对文档进行数据绑定
        /// </summary>
        /// <param name="document">要进行数据绑定的文档</param>
        protected virtual void DataBind(IHtmlDocument document, object dataContext)
        {
            var bindings = FindBindings(document).OrderBy(b => b.Priority);

            var context = new BindingContext(this, dataContext);

            bindings.ForAll(b => b.DataBind(context));

            document.Elements().ForAll(e => DataBind(e, context));
        }
コード例 #4
0
ファイル: ResourceManager.cs プロジェクト: ajayumi/Jumony
    /// <summary>
    /// 添加所有资源引用
    /// </summary>
    /// <param name="document"></param>
    /// <param name="clearReferenceFirst"></param>
    public void AddAllReference( IHtmlDocument document, bool clearReferenceFirst = true )
    {

      if ( document == null )
        return;

      if ( clearReferenceFirst )
        ClearAllReference( document );

      var headElement = document.FindFirstOrDefault( "head" );
      if ( headElement == null )
      {
        var firstElement = document.Elements().FirstOrDefault();

        if ( firstElement != null )
          headElement = firstElement.AddElementBeforeSelf( "head" );
        else
          headElement = document.AddElement( 0, "head" );
      }

      AddStyleReferences( headElement, styleFiles );
      AddScriptReferences( headElement, scriptFiles );
    }