国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

網(wǎng)頁(yè)抓取 wordpress西安自動(dòng)seo

網(wǎng)頁(yè)抓取 wordpress,西安自動(dòng)seo,網(wǎng)站內(nèi)容與模板設(shè)計(jì),wordpress 官方文檔上位機(jī)開發(fā)中一定會(huì)用到的技術(shù)就是 設(shè)備的線程開始運(yùn)行執(zhí)行生產(chǎn)流程,在生產(chǎn)過(guò)程中會(huì)有要打開安全門或暫停設(shè)備動(dòng)作,人為去排除設(shè)備小問(wèn)題的時(shí)就要用到暫停功能,問(wèn)題排除后設(shè)備繼續(xù)運(yùn)行,生產(chǎn)完成后設(shè)備停止。 這些操作是上位機(jī)開發(fā)…

????????上位機(jī)開發(fā)中一定會(huì)用到的技術(shù)就是 設(shè)備的線程開始運(yùn)行執(zhí)行生產(chǎn)流程,在生產(chǎn)過(guò)程中會(huì)有要打開安全門或暫停設(shè)備動(dòng)作,人為去排除設(shè)備小問(wèn)題的時(shí)就要用到暫停功能,問(wèn)題排除后設(shè)備繼續(xù)運(yùn)行,生產(chǎn)完成后設(shè)備停止。 這些操作是上位機(jī)開發(fā)中必須要實(shí)現(xiàn)的功能。下面是一個(gè)簡(jiǎn)單的示例。

?1.界面

2.代碼

2.1主要用到的對(duì)象

//線程源
private CancellationTokenSource cts = new CancellationTokenSource();
//手動(dòng)停止事件對(duì)象
private ManualResetEvent resetEvent = new ManualResetEvent(true);
//線程
private Task task;

2.2 開始

/// <summary>
/// 開 始
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></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();//阻止當(dāng)前線程var strInfo = "運(yùn)行日志[" + count + "]";AddListViewThread(null, strInfo, clrInfo);count++;Thread.Sleep(1000);}});
}

2.3 暫 停

/// <summary>
/// 暫 停
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnPause_Click(object sender, EventArgs e)
{resetEvent.Reset();
}

2.4繼 續(xù)

/// <summary>
/// 繼 續(xù)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnContinue_Click(object sender, EventArgs e)
{resetEvent.Set();
}

2.5停 止

/// <summary>
/// 停 止
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></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();//手動(dòng)停止事件對(duì)象private ManualResetEvent resetEvent = new ManualResetEvent(true);//線程private Task task;/// <summary>/// 開 始/// </summary>/// <param name="sender"></param>/// <param name="e"></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();//阻止當(dāng)前線程var strInfo = "運(yùn)行日志[" + count + "]";AddListViewThread(null, strInfo, clrInfo);count++;Thread.Sleep(1000);}});}/// <summary>/// 暫 停/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void btnPause_Click(object sender, EventArgs e){resetEvent.Reset();}/// <summary>/// 繼 續(xù)/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void btnContinue_Click(object sender, EventArgs e){resetEvent.Set();}/// <summary>/// 顯示(添加)日志/// </summary>/// <param name="strTime">時(shí)間</param>/// <param name="strContent">內(nèi)褲</param>/// <param name="textColor">顏色</param>public void AddListViewThread(string strTime, string strContent, Color textColor){if (this.IsDisposed){return;}if (this.listViewWorkLogs.InvokeRequired){//獲取一個(gè)值,該值指示調(diào)用方在對(duì)控件進(jìn)行方法調(diào)用時(shí)是否必須調(diào)用 Invoke 方法,因?yàn)檎{(diào)用方位于創(chuàng)建控件所在的線程以外的線程中AddListViewCallback d = new AddListViewCallback(AddListViewThread);this.Invoke(d, new object[] { strTime, strContent, textColor });}else{AddContent2ListView(strTime, strContent, textColor);}}/// <summary>/// 顯示(添加)日志/// </summary>/// <param name="strTime">時(shí)間</param>/// <param name="strContent">內(nèi)褲</param>/// <param name="textColor">顏色</param>public 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 name="sender"></param>/// <param name="e"></param>private void btnStop_Click(object sender, EventArgs e){cts.Cancel();}}
}

http://aloenet.com.cn/news/37639.html

相關(guān)文章:

  • php網(wǎng)站模塊如何編寫一個(gè)網(wǎng)站
  • 尋找手機(jī)網(wǎng)站建設(shè)北京優(yōu)化seo排名
  • 官網(wǎng)做的好看的網(wǎng)站有哪些設(shè)計(jì)網(wǎng)站排行
  • 宜春做網(wǎng)站公司網(wǎng)站seo優(yōu)化工具
  • 網(wǎng)站開發(fā)測(cè)試過(guò)程中文域名查詢官網(wǎng)
  • 阜寧做網(wǎng)站的公司新手怎么做電商
  • 自適應(yīng)網(wǎng)站做mip改造在哪里可以免費(fèi)自學(xué)seo課程
  • 哪家做公司網(wǎng)站互聯(lián)網(wǎng)廣告推廣好做嗎
  • 吧網(wǎng)站做軟件的軟件網(wǎng)絡(luò)銷售平臺(tái)怎么做
  • 做國(guó)際網(wǎng)站的流程廣州seo報(bào)價(jià)
  • java做網(wǎng)站百度客服怎么轉(zhuǎn)人工電話
  • 仿做唯品會(huì)網(wǎng)站黃岡便宜的網(wǎng)站推廣怎么做
  • pmp培訓(xùn)seo網(wǎng)站
  • 沈陽(yáng)網(wǎng)站搜索引擎優(yōu)化google推廣教程
  • 網(wǎng)頁(yè)版視頻網(wǎng)站建設(shè)需要多少錢百度sem推廣具體做什么
  • kol合作推廣seo外鏈?zhǔn)鞘裁?/a>
  • 自己創(chuàng)業(yè)做原公司一樣的網(wǎng)站網(wǎng)站seo設(shè)計(jì)
  • 公司做網(wǎng)站的步驟廣州seo關(guān)鍵字推廣
  • 做韋恩圖的網(wǎng)站怎么樣推廣自己的公司
  • wordpress 添加導(dǎo)航菜單成都seo招聘
  • 網(wǎng)站域名有什么用計(jì)算機(jī)培訓(xùn)
  • 大學(xué)新校區(qū)建設(shè)網(wǎng)站網(wǎng)站seo重慶
  • 網(wǎng)站推廣資訊上海百度競(jìng)價(jià)托管
  • 中國(guó)大型建筑公司有哪些seo西安
  • 全國(guó)公安網(wǎng)站備案應(yīng)用寶aso優(yōu)化
  • 班級(jí)建設(shè)網(wǎng)站設(shè)計(jì)方案搜索引擎優(yōu)化到底是優(yōu)化什么
  • 陜西省建設(shè)廳小紅書關(guān)鍵詞排名優(yōu)化
  • java 網(wǎng)站設(shè)計(jì)都有什么推廣平臺(tái)
  • 香港網(wǎng)站代理seo優(yōu)化方案
  • 南昌做網(wǎng)站市場(chǎng)報(bào)價(jià)刷seo關(guān)鍵詞排名軟件