timer 定时器疑惑未解
2013-02-19 15:09
225 查看
存在问题,请各位指教。
1.这个是global.asax.cs中的
protected void Application_Start(Object sender, EventArgs e)
{
MakeIndexHtml s = new MakeIndexHtml();
Timer aTimer = new Timer(1000*60*5);
aTimer.Elapsed += new ElapsedEventHandler(s.btn_CeShiIndex_Click);
aTimer.Interval = 1000 * 60 *5;
aTimer.Enabled = true;
aTimer.AutoReset = true;
aTimer.Start();
}
2.同一命名空间下的
public void btn_CeShiIndex_Click(object sender, EventArgs e)
{
string templete_Index_Path = HttpRuntime.AppDomainAppPath + "Templates/Neo/C_index.html";
...
string Index_Path = System.Configuration.ConfigurationManager.AppSettings["MakeHtmlUrl"].ToString() + "/C_index.html";
XmlDocument xd = new XmlDocument();
xd.Load("http://news.youdao.com/top?ct=all&doctype=rss");
XmlNodeList xmlList = xd.SelectNodes("rss/channel/item/description");
yd++;
if (xmlList != null)
{
if (((IList)M3).Contains(model.TypeID))
{
if (model.TypeID == 10040103 && yd == 26)
{
xd.Load("http://news.youdao.com/top?ct=all&doctype=rss");
GetFenleiydCh(sb, xmlList);//这个是调用的方法
}}}}
3.读取xml的方法
protected void GetFenleiYD(StringBuilder sb, XmlNodeList xmlList)
{
...
GetYDFirstTitlefirst(sb, out a, xmlList, i);...}
同样的方法,获取图片timer就可以定时更新,但是这个就不能得到而且为空?
1.这个是global.asax.cs中的
protected void Application_Start(Object sender, EventArgs e)
{
MakeIndexHtml s = new MakeIndexHtml();
Timer aTimer = new Timer(1000*60*5);
aTimer.Elapsed += new ElapsedEventHandler(s.btn_CeShiIndex_Click);
aTimer.Interval = 1000 * 60 *5;
aTimer.Enabled = true;
aTimer.AutoReset = true;
aTimer.Start();
}
2.同一命名空间下的
public void btn_CeShiIndex_Click(object sender, EventArgs e)
{
string templete_Index_Path = HttpRuntime.AppDomainAppPath + "Templates/Neo/C_index.html";
...
string Index_Path = System.Configuration.ConfigurationManager.AppSettings["MakeHtmlUrl"].ToString() + "/C_index.html";
XmlDocument xd = new XmlDocument();
xd.Load("http://news.youdao.com/top?ct=all&doctype=rss");
XmlNodeList xmlList = xd.SelectNodes("rss/channel/item/description");
yd++;
if (xmlList != null)
{
if (((IList)M3).Contains(model.TypeID))
{
if (model.TypeID == 10040103 && yd == 26)
{
xd.Load("http://news.youdao.com/top?ct=all&doctype=rss");
GetFenleiydCh(sb, xmlList);//这个是调用的方法
}}}}
3.读取xml的方法
protected void GetFenleiYD(StringBuilder sb, XmlNodeList xmlList)
{
...
GetYDFirstTitlefirst(sb, out a, xmlList, i);...}
同样的方法,获取图片timer就可以定时更新,但是这个就不能得到而且为空?
相关文章推荐
- java中的定时器Timer
- Timer TimerTask 定时器线程
- Android定时器Timer的停止和重启实现代码
- 使用timer方法生成一个定时器,每隔一段时间输出一个随机数
- Android中定时器Timer和TimerTask的启动,停止,暂停,继续等操作实例
- Android中使用定时器TimerTask类介绍
- Java Web项目中定时器Timer的使用
- 浅析NS2中的定时器(Timer)(转)
- AT89S52之(定时器2)Timer2
- 定时任务实现Timer, TimeTask, ScheduledExecutorService及Spring定时器
- 线程同步和Timer定时器_12
- VC++ WM_TIMER 定时器使用方法
- C# Timer 定时器应用
- java spring实现定时器功能Timer
- CreateWaitableTimer和SetWaitableTimer函数(定时器)
- android 定时器 Timer 使用 及其遇到的问题
- 内核定时器timer_list使用
- 定时器timer(续)
- 定时器小结 setitimer/getitimer Or timer_settime/timer_gettime
- linux 内核定时器 timer_list详解