using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HRT_Measure { public class PrintHelp { public static string CombineDynamicCmd(string strBC) { //正确返回: // { "status":"ok","code":0,"descript":"ok"} var objJson = new { request_type = "post", path = "/engine/dynamic", print_mode = "single", data = new [] { new { type = "text", name = "Msg", content = strBC } } }; string postContent = JsonConvert.SerializeObject(objJson); ProgramHelp.Instance.SaveMsg("Print", $"添加动态打印命令{postContent}", true); return postContent; } public static string AddPrintTast() { //正确返回: // { // "status":"ok","hash":11112,"id":949817907,"attribute":{ "create_time":949817907} // } //错误返回: // { // "status":"error","id":949817351,"code":24581,"descript":"print engine is //running"} var objJson = new { request_type = "post", path = "/engine/printjob", hash = 1, attribute = new { print_data_name = "Msg" } }; string postContent = JsonConvert.SerializeObject(objJson); ProgramHelp.Instance.SaveMsg("Print", $"添加打印任务命令{postContent}", true); return postContent; } } }