当前位置: 首页 > news >正文

aspsqlserver做网站wordpress显示所有文章列表

aspsqlserver做网站,wordpress显示所有文章列表,百度一下搜索,郑州公司做网站上位机开发中一定会用到的技术就是 设备的线程开始运行执行生产流程#xff0c;在生产过程中会有要打开安全门或暂停设备动作#xff0c;人为去排除设备小问题的时就要用到暂停功能#xff0c;问题排除后设备继续运行#xff0c;生产完成后设备停止。 这些操作是上位机开发…        上位机开发中一定会用到的技术就是 设备的线程开始运行执行生产流程在生产过程中会有要打开安全门或暂停设备动作人为去排除设备小问题的时就要用到暂停功能问题排除后设备继续运行生产完成后设备停止。 这些操作是上位机开发中必须要实现的功能。下面是一个简单的示例。 1.界面 2.代码 2.1主要用到的对象 //线程源 private CancellationTokenSource cts new CancellationTokenSource(); //手动停止事件对象 private ManualResetEvent resetEvent new ManualResetEvent(true); //线程 private Task task; 2.2 开始 /// summary /// 开 始 /// /summary /// param namesender/param /// param namee/param private void btnStart_Click(object sender, EventArgs e) {if (cts.IsCancellationRequested){cts new CancellationTokenSource();}resetEvent.Set();task Task.Factory.StartNew(() {int count 1;Color clrInfo Color.Blue;while (!cts.IsCancellationRequested){resetEvent.WaitOne();//阻止当前线程var strInfo 运行日志[ count ];AddListViewThread(null, strInfo, clrInfo);count;Thread.Sleep(1000);}}); } 2.3 暂 停 /// summary /// 暂 停 /// /summary /// param namesender/param /// param namee/param private void btnPause_Click(object sender, EventArgs e) {resetEvent.Reset(); } 2.4继 续 /// summary /// 继 续 /// /summary /// param namesender/param /// param namee/param private void btnContinue_Click(object sender, EventArgs e) {resetEvent.Set(); } 2.5停 止 /// summary /// 停 止 /// /summary /// param namesender/param /// param namee/param private void btnStop_Click(object sender, EventArgs e) {cts.Cancel(); } 全部代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Dynamic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms;namespace TaskWindowsFormsApp {public partial class Form1 : Form{public Form1(){InitializeComponent();}delegate void AddListViewCallback(string strTime, string strContent, Color textColor);//线程源private CancellationTokenSource cts new CancellationTokenSource();//手动停止事件对象private ManualResetEvent resetEvent new ManualResetEvent(true);//线程private Task task;/// summary/// 开 始/// /summary/// param namesender/param/// param namee/paramprivate void btnStart_Click(object sender, EventArgs e){if (cts.IsCancellationRequested){cts new CancellationTokenSource();}resetEvent.Set();task Task.Factory.StartNew(() {int count 1;Color clrInfo Color.Blue;while (!cts.IsCancellationRequested){resetEvent.WaitOne();//阻止当前线程var strInfo 运行日志[ count ];AddListViewThread(null, strInfo, clrInfo);count;Thread.Sleep(1000);}});}/// summary/// 暂 停/// /summary/// param namesender/param/// param namee/paramprivate void btnPause_Click(object sender, EventArgs e){resetEvent.Reset();}/// summary/// 继 续/// /summary/// param namesender/param/// param namee/paramprivate void btnContinue_Click(object sender, EventArgs e){resetEvent.Set();}/// summary/// 显示添加日志/// /summary/// param namestrTime时间/param/// param namestrContent内裤/param/// param nametextColor颜色/parampublic void AddListViewThread(string strTime, string strContent, Color textColor){if (this.IsDisposed){return;}if (this.listViewWorkLogs.InvokeRequired){//获取一个值该值指示调用方在对控件进行方法调用时是否必须调用 Invoke 方法因为调用方位于创建控件所在的线程以外的线程中AddListViewCallback d new AddListViewCallback(AddListViewThread);this.Invoke(d, new object[] { strTime, strContent, textColor });}else{AddContent2ListView(strTime, strContent, textColor);}}/// summary/// 显示添加日志/// /summary/// param namestrTime时间/param/// param namestrContent内裤/param/// param nametextColor颜色/parampublic void AddContent2ListView(string strTime, string strContent, Color textColor){try{if (strTime null){strTime string.Format({0}:{1}:{2}, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);}int nCount listViewWorkLogs.Items.Count;if (nCount 600){for (int i nCount - 1; i 100; i--){listViewWorkLogs.Items.RemoveAt(i);}}}catch{int nCount listViewWorkLogs.Items.Count;if (nCount 600){listViewWorkLogs.Clear();}}ListViewItem lvItem new ListViewItem();lvItem.ForeColor textColor;lvItem.Text strTime;lvItem.StateImageIndex 0;lvItem.SubItems.Add(strContent);this.listViewWorkLogs.Items.Insert(0, lvItem);}/// summary/// 停 止/// /summary/// param namesender/param/// param namee/paramprivate void btnStop_Click(object sender, EventArgs e){cts.Cancel();}} }
http://www.hkea.cn/news/14379657/

相关文章:

  • 网页美工设计主要从哪些方面设计seo外包公司优化
  • 如何建设考研网站wordpress网站布置视频
  • 小说网站怎么建设wap网站怎么做
  • 网站导航页面制作wordpress自动 插件
  • 电脑做系统ppt下载网站好郑州网站制作公司汉狮
  • 网站建设 协议书做网站运营需要学的东西
  • 模板网站 知乎写作网站5妙不写就删除
  • 静安建设机械网站网站建设教程讲解
  • 网站原创文章来源wordpress+程序优化
  • 上海自助建站系统手机怎么做网站免费的
  • 徐水住房建设局网站wordpress主题修改软件
  • 设计师网站建设厅网站集约化建设
  • 成都建站优化妻子2018高清免费视频
  • o2o网站建设服务网站推广关键词排名
  • 建设网站还不如搬砖wordpress用户排行
  • 学做宝宝衣服网站好网站关键词用什么符号
  • 网站最合适的字体大小合肥市城乡建设局2019网站
  • 中国营销型网站有哪些公司网站建设需要些什么要求
  • 福建网站建建设网站建设四川推来客网站系统
  • 柳州正规网站制作公司html5手机网站开发实例
  • 广州最专业的网站建设网站建设工作室+怎么样
  • 四平网站建设有哪些博客园网站开发
  • 成品网站货源入口福田皇岗社区网站建设
  • 南宁武鸣区建设局网站上海58同城招聘网最新招聘
  • 江门手机模板建站嵌入式开发的系统
  • 网站建设与运营课程总结建设银行网站登录不上去
  • 晋城龙采网站建设网站后台密码在哪里
  • 物流信息网站qq对话制作器app
  • 广州开发区建设局网站黄埔企业logo标志设计免费
  • 官网网站怎么创建扬中网站推广导流