public TextBlock TextBlockCreate(SRTPInfo srtpinfo) { TextBlock t = new TextBlock(); TextBlockChange(t, srtpinfo); t.FontSize = 20; t.Margin = new Thickness(10, 0, 0, 0); t.TextWrapping = TextWrapping.WrapWholeWords; return t; }
public void TextBlockChange(TextBlock t, SRTPInfo srtpinfo) { /*"credit": "学分", "proportion": "比例", "project": "项目名称", "department": "认定院系", "date": "获得日期", "type": "学分类型", "total credit": "总学分" */ t.Text += "学分: " + srtpinfo.credit + "\n"; if (!String.IsNullOrEmpty(srtpinfo.proportion)) t.Text += "比例: " + srtpinfo.proportion + "\n"; t.Text += "项目名称: " + srtpinfo.project + "\n"; if (!String.IsNullOrEmpty(srtpinfo.department)) t.Text += "认定院系: " + srtpinfo.department + "\n"; t.Text += "获得日期: " + srtpinfo.date + "\n"; if (!String.IsNullOrEmpty(srtpinfo.type)) t.Text += "学分类型: " + srtpinfo.type + "\n"; if (!String.IsNullOrEmpty(srtpinfo.totalCredit)) t.Text += "总学分: " + srtpinfo.totalCredit + "\n"; }