最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢(xún)
選擇下列產(chǎn)品馬上在線(xiàn)溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
c#之下如何做定時(shí)

先如下定義一個(gè)定時(shí)器:

為黃山等地區(qū)用戶(hù)提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及黃山網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、外貿(mào)網(wǎng)站建設(shè)、黃山網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專(zhuān)業(yè)、用心的態(tài)度為用戶(hù)提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶(hù)的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!

public DispatcherTimer dispatcherTimer;

然后在某處創(chuàng)建這個(gè)對(duì)象實(shí)例:

dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

設(shè)定超時(shí)回調(diào)函數(shù):

dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);

設(shè)定間隔(下方例子是10秒鐘):

dispatcherTimer.Interval = new TimeSpan(0, 0, 10);

啟動(dòng)定時(shí)器:

dispatcherTimer.Start();

定義超時(shí)回調(diào)函數(shù):

private void dispatcherTimer_Tick(object sender, EventArgs e)

{

// do something here...

}

值得注意的是DispatcherTimer是無(wú)法直接在console下運(yùn)行的,需要額外的東西。

下面文字來(lái)自http://stackoverflow.com/questions/19351473/dispatchertimer-doesnt-work-in-console的解釋

The console and unit test environment by default don't have a dispatcher to run your dispatcher timer.

You can still use Dispatcher.CurrentDispatcher to create a Dispatcher to run your code.



分享文章:c#之下如何做定時(shí)
URL鏈接:http://fisionsoft.com.cn/article/pojgej.html