using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using Newtonsoft.Json; namespace POSV.Printer { [Serializable] [JsonObject(MemberSerialization.OptIn)] public class R2Parameter { /// /// 数据模版 /// [JsonProperty(PropertyName = "template")] public Tuple Template { get; set; } /// /// 字体大小 /// [JsonProperty(PropertyName = "font")] public FontStyle FontStyle { get; set; } /// /// 背景颜色 /// [JsonProperty(PropertyName = "color")] public Color BackColor { get; set; } /// /// 填充线条 /// [JsonProperty(PropertyName = "line")] public LineStyle LineStyle { get; set; } } [Serializable] [JsonObject(MemberSerialization.OptIn)] public class R2Template { private Dictionary> _dataSource; public R2Template(Dictionary> dataSource) { this._dataSource = dataSource; this.DataSourceKey = "默认数据源"; this.Prefix = string.Empty; this.Middle = string.Empty; this.Suffix = string.Empty; this.Var1 = new VariableItem(); this.Var2 = new VariableItem(); this.Condition = new VariableItem(); this.Percent = 50; } /// /// 数据源 /// [JsonIgnore] public Dictionary> DataSource { get { return this._dataSource; } set { this._dataSource = value; } } /// /// 绑定的数据源Key /// [JsonProperty(PropertyName = "data")] public string DataSourceKey { get; set; } /// /// 行的打印条件变量 /// [JsonProperty(PropertyName = "condition")] public VariableItem Condition { get; set; } /// /// 打印内容前缀 /// [JsonProperty(PropertyName = "prefix")] public string Prefix { get; set; } /// /// 打印变量1 /// [JsonProperty(PropertyName = "var1")] public VariableItem Var1 { get; set; } /// /// 变量中缀 /// [JsonProperty(PropertyName = "middle")] public string Middle { get; set; } /// /// 打印变量2 /// [JsonProperty(PropertyName = "var2")] public VariableItem Var2 { get; set; } /// /// 变量后缀 /// [JsonProperty(PropertyName = "suffix")] public string Suffix { get; set; } /// /// 打印字体 /// [JsonProperty(PropertyName = "font")] public FontStyle FontStyle { get; set; } /// /// 打印对齐方式 /// [JsonProperty(PropertyName = "align")] public AlignStyle AlignStyle { get; set; } /// /// 宽度百分比 /// [JsonProperty(PropertyName = "percent")] public decimal Percent { get; set; } } }