Пример #1
0
        /// <summary>
        /// 创建视图对象
        /// </summary>
        /// <param name="context">控制器上下文</param>
        /// <param name="virtualPath">视图虚拟路径</param>
        /// <param name="isPartial">是否为部分视图</param>
        /// <param name="viewProvider">产生该视图的视图提供程序</param>
        /// <returns>视图对象</returns>
        protected virtual ViewBase CreateViewCore(ControllerContext context, string virtualPath, bool isPartial, out IViewProvider viewProvider)
        {
            lock ( _providersSync )
            {
                foreach (var provider in ViewProviders)
                {
                    var view = provider.TryCreateView(context, VirtualPathProvider, virtualPath, isPartial);
                    if (view != null)
                    {
                        viewProvider = provider;
                        return(view);
                    }
                }
            }



            {//默认处理策略
                viewProvider = null;
                ViewBase view = TryCreateViewHandler(virtualPath, isPartial);


                if (view == null)
                {
                    view = new JumonyView();
                }


                OnViewCreated(new JumonyViewEventArgs()
                {
                    View = view
                });
                return(view);
            }
        }
Пример #2
0
    /// <summary>
    /// 创建 ContentAdapter 对象
    /// </summary>
    /// <param name="view">要渲染的内容视图</param>
    public ContentAdapter( JumonyView view )
    {
      if ( view.IsPartialView )
        throw new InvalidOperationException( "部分视图不能套用母板" );

      View = view;
      RenderAdapters = view.RenderAdapters.ToArray();
    }
Пример #3
0
        /// <summary>
        /// 创建 ContentAdapter 对象
        /// </summary>
        /// <param name="view">要渲染的内容视图</param>
        public ContentAdapter(JumonyView view)
        {
            if (view.IsPartialView)
            {
                throw new InvalidOperationException("部分视图不能套用母板");
            }

            View           = view;
            RenderAdapters = view.RenderAdapters.ToArray();
        }
Пример #4
0
 /// <summary>
 /// 当视图被渲染前执行
 /// </summary>
 /// <param name="context">当前视图上下文</param>
 /// <param name="view">正在处理的视图</param>
 public virtual void OnPreRender( ViewContext context, JumonyView view )
 {
 }
Пример #5
0
 /// <summary>
 /// 当视图被处理前执行
 /// </summary>
 /// <param name="context">当前视图上下文</param>
 /// <param name="view">正在处理的视图</param>
 public virtual void OnPreProcess( ViewContext context, JumonyView view )
 {
 }
Пример #6
0
        /// <summary>
        /// 创建视图对象
        /// </summary>
        /// <param name="context">控制器上下文</param>
        /// <param name="virtualPath">视图虚拟路径</param>
        /// <param name="isPartial">是否为部分视图</param>
        /// <param name="viewProvider">产生该视图的视图提供程序</param>
        /// <returns>视图对象</returns>
        protected virtual ViewBase CreateViewCore( ControllerContext context, string virtualPath, bool isPartial, out IViewProvider viewProvider )
        {
            lock ( _providersSync )
              {
            foreach ( var provider in ViewProviders )
            {
              var view = provider.TryCreateView( context, VirtualPathProvider, virtualPath, isPartial );
              if ( view != null )
              {
            viewProvider = provider;
            return view;
              }
            }
              }

              {//默认处理策略

            viewProvider = null;
            ViewBase view = TryCreateViewHandler( virtualPath, isPartial );

            if ( view == null )
              view = new JumonyView();

            OnViewCreated( new JumonyViewEventArgs() { View = view } );
            return view;
              }
        }
Пример #7
0
 /// <summary>
 /// 当视图被渲染后执行
 /// </summary>
 /// <param name="context">当前视图上下文</param>
 /// <param name="view">正在处理的视图</param>
 public virtual void OnPostRender(ViewContext context, JumonyView view)
 {
 }
Пример #8
0
 /// <summary>
 /// 当视图被处理后执行
 /// </summary>
 /// <param name="context">当前视图上下文</param>
 /// <param name="view">正在处理的视图</param>
 public virtual void OnPostProcess(ViewContext context, JumonyView view)
 {
 }