using System; using System.IO; using System.Threading; namespace WebService.Test { class Program { static void Main(string[] args) { //WebServiceClient.Instance.Polling(); } } /// /// 导出为word /// public class ExportWordHelper { ///// ///// 导出html 到word ///// ///// 待导出数据 ///// 导出磁盘地址 ///// doc模板文件(含书签)磁盘地址 //public static void ExportHtmlToWord(string info, string wordFilePath, string fileTempPath) //{ // //string fileTempPath = Server.MapPath("~/Templates/NCR.docx"); // //载入模板 // Aspose.Words.Document doc = new Aspose.Words.Document(fileTempPath); // Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc); // builder.InsertHtml(content);//含html的文章内容 // // doc.Save("E:/DownLoadWord/DocumentBuilder.InsertTableFromHtml Out.doc"); // doc.Save(wordFilePath); //} } public class WebServiceClient { private static WebServiceClient _instance; public static WebServiceClient Instance => _instance ?? (_instance = new WebServiceClient()); public WebServiceClient() { //Client = new SmartPlanWebServiceClient(); _switch = true; } // public SmartPlanWebServiceClient Client { get; set; } private string Id { get; set; } private bool _switch; public void OnSwitch() { _switch = true; } public void OffSwitch() { _switch = false; } public void Polling() { while (_switch) { //Query(); Thread.Sleep(1000 * 5); } } //public void Query() //{ // var result = Client.QueryAction(); // if (result.Success) // { // if (result.Id != Id) // { // Id = result.Id; // Console.WriteLine($"\r\n接受新指令 【{Id}】"); // //TODO 接受到新指令需要做的 5-10s模拟程序处理 // Thread.Sleep(1000 * new Random().Next(5, 10)); // Complete(); // } // else // { // Console.Write("."); // } // } // //return result; //} //public AjaxResultWs Complete() //{ // var result = Client.CompleteAction(Id); // return result; //} } }