Exemple #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);
        }
Exemple #2
0
 protected override void Draw(PageBrush brush)
 {
     if (this.Origin == DrawOrigin.Header || this.Origin == DrawOrigin.Bottom)
     {
         brush.Backspace();
     }
     brush.Draw(GetCode(), this.Origin);
 }
 public static void OutputAttributes(CustomAttributeCollection attributes, PageBrush brush)
 {
     foreach (var item in attributes)
     {
         var attr = item as CustomAttribute;
         OutputAttribute(attr, brush);
     }
 }
 /// <summary>
 /// 绘制脚本回调方法指令
 /// </summary>
 private void DrawScriptCallback(PageBrush brush)
 {
     if (this.ScriptCallback != null)
     {
         var view   = new ScriptView();
         var result = this.ScriptCallback(view);
         brush.DrawScriptCallback(result);
     }
 }
Exemple #5
0
 public void Render(PageBrush brush)
 {
     foreach (var e in this)
     {
         var ui = e as IUIElement;
         if (e != null)
         {
             ui.Render(brush);
         }
     }
 }
Exemple #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();
        }
 public void Render(PageBrush brush)
 {
     RenderContext.Current.PushObject(this);
     OnPreRender();
     if (this.Visibility == Visibility.Collapsed)
     {
         return;                                          //如果隐藏元素,则不绘制
     }
     Draw(brush);
     DrawScriptCallback(brush);
     RenderContext.Current.PopObject();
 }
        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);
            }
        }
        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;
            }
        }
        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());
                }
            }
        }
Exemple #11
0
 protected virtual void Render(object templateParent, PageBrush brush)
 {
 }
 protected abstract void Draw(PageBrush brush);
Exemple #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);
 }
Exemple #14
0
 private static void AppendLanguage(PageBrush brush)
 {
     AssetStrings.Global.Render(brush); //添加多语言支持
     AssetStrings.Current.Render(brush);
 }