Exemplo n.º 1
0
        //public object DefaultStyleKey { get; set; }

        protected override void Draw(PageBrush brush)
        {
            if (this.Template == null)
            {
                throw new XamlException("没有模板,无法绘制控件" + this.GetType().FullName);
            }
            this.Template.Render(brush);
        }
Exemplo n.º 2
0
 protected override void Draw(PageBrush brush)
 {
     if (this.Origin == DrawOrigin.Header || this.Origin == DrawOrigin.Bottom)
     {
         brush.Backspace();
     }
     brush.Draw(GetCode(), this.Origin);
 }
Exemplo n.º 3
0
 public static void OutputAttributes(CustomAttributeCollection attributes, PageBrush brush)
 {
     foreach (var item in attributes)
     {
         var attr = item as CustomAttribute;
         OutputAttribute(attr, brush);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 绘制脚本回调方法指令
 /// </summary>
 private void DrawScriptCallback(PageBrush brush)
 {
     if (this.ScriptCallback != null)
     {
         var view   = new ScriptView();
         var result = this.ScriptCallback(view);
         brush.DrawScriptCallback(result);
     }
 }
Exemplo n.º 5
0
 public void Render(PageBrush brush)
 {
     foreach (var e in this)
     {
         var ui = e as IUIElement;
         if (e != null)
         {
             ui.Render(brush);
         }
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// 渲染
        /// </summary>
        /// <param name="templateParent"></param>
        /// <param name="brush"></param>
        public void Render(PageBrush brush)
        {
            var templateParent = this.TemplateParent;

            if (templateParent == null)
            {
                throw new XamlException("没有设置模板的应用对象,无法渲染");
            }
            RenderContext.Current.PushObject(this);
            Render(templateParent, brush);
            RenderContext.Current.PopObject();
        }
Exemplo n.º 7
0
 public void Render(PageBrush brush)
 {
     RenderContext.Current.PushObject(this);
     OnPreRender();
     if (this.Visibility == Visibility.Collapsed)
     {
         return;                                          //如果隐藏元素,则不绘制
     }
     Draw(brush);
     DrawScriptCallback(brush);
     RenderContext.Current.PopObject();
 }
Exemplo n.º 8
0
        protected override void Draw(PageBrush brush)
        {
            if (brush.Contains(this.GetCode()))
            {
                return;
            }
            base.Draw(brush);

            if (this.Origin == DrawOrigin.Header || this.Origin == DrawOrigin.Bottom)
            {
                brush.DrawLine(this.Origin);
            }
        }
Exemplo n.º 9
0
        public static void OutputAttribute(CustomAttribute attr, PageBrush brush)
        {
            switch (attr.Name)
            {
            case "view": brush.DrawFormat(" data-view=\"{0}\"", ProxyCodeExtend.TidyView(attr.GetPrintValue())); break;

            case "form": brush.DrawFormat(" data-form=\"{0}\"", attr.GetPrintValue()); break;

            default:
                brush.DrawFormat(" {0}=\"{1}\"", attr.Name, attr.GetPrintValue());
                break;
            }
        }
Exemplo n.º 10
0
        protected override void Render(object templateParent, PageBrush brush)
        {
            var e = this.Template;

            if (e == null)
            {
                return;
            }
            var parent = templateParent as DependencyObject;

            foreach (var item in e)
            {
                var t = item as UIElement;
                if (t != null)
                {
                    t.Parent = parent;
                    t.Render(brush);
                }
                else
                {
                    brush.Draw(t.ToString());
                }
            }
        }
Exemplo n.º 11
0
 protected virtual void Render(object templateParent, PageBrush brush)
 {
 }
Exemplo n.º 12
0
 protected abstract void Draw(PageBrush brush);
Exemplo n.º 13
0
 /// <summary>
 /// 将画刷<paramref name="target" />的内容写入到源内容中
 /// </summary>
 /// <param name="target"></param>
 internal void Combine(PageBrush target)
 {
     _header.Append(target._header);
     _bottom.Append(target._bottom);
     _current.Append(target._current);
 }
Exemplo n.º 14
0
 private static void AppendLanguage(PageBrush brush)
 {
     AssetStrings.Global.Render(brush); //添加多语言支持
     AssetStrings.Current.Render(brush);
 }