You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.1 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace POSV.Printer
{
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class QRCodeXParameter
{
/// <summary>
/// 模版变量
/// </summary>
[JsonProperty(PropertyName = "template")]
public Tuple<QRCodeXTemplate> Template { get; set; }
[JsonProperty(PropertyName = "font")]
public FontStyle FontStyle { get; set; }
[JsonProperty(PropertyName = "align")]
public AlignStyle AlignStyle { get; set; }
[JsonProperty(PropertyName = "size")]
public QRCodeSizeMode SizeMode { get; set; }
}
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class QRCodeXTemplate
{
private Dictionary<string, List<VariableItem>> _dataSource;
public QRCodeXTemplate(Dictionary<string, List<VariableItem>> dataSource)
{
this._dataSource = dataSource;
this.DataSourceKey = "默认数据源";
this.Var1 = new VariableItem();
this.Condition = new VariableItem();
}
/// <summary>
/// 数据源
/// </summary>
[JsonIgnore]
public Dictionary<string, List<VariableItem>> DataSource
{
get
{
return this._dataSource;
}
set
{
this._dataSource = value;
}
}
/// <summary>
/// 绑定的数据源Key
/// </summary>
[JsonProperty(PropertyName = "data")]
public string DataSourceKey { get; set; }
/// <summary>
/// 行的打印条件变量
/// </summary>
[JsonProperty(PropertyName = "condition")]
public VariableItem Condition { get; set; }
/// <summary>
/// 内容变量
/// </summary>
[JsonProperty(PropertyName = "var1")]
public VariableItem Var1 { get; set; }
public override string ToString()
{
return JSON.Serialize(this);
}
}
}