C#中TIMER的运用
来源:互联网 发布:淘宝上的cpu散片 编辑:程序博客网 时间:2024/06/14 02:42
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
namespace ConsoleApplication5
{
public delegate void MyMessage(string Message);
class MyTimer
{
public event MyMessage Mymes;
public Timer time;
public MyTimer()
{
time = new Timer(100);
time.Elapsed+=new ElapsedEventHandler(Show);
}
public void Show(object sender, ElapsedEventArgs e)
{
Random r = new Random();
int i = r.Next(9);
if ((i == 5) && Mymes != null)
{
Mymes("I LOVE XUEER!!!");
}
}
public void TimeStart()
{
time.Start();
}
public void TimeEnd()
{
time.Stop();
}
public void Mytimelook(string s)
{
Console.WriteLine("time"+s);
}
}
class Dis
{
public void look(string s)
{
Console.WriteLine(s);
}
}
}
MyTimer mytime = new MyTimer();
Dis dis = new Dis();
mytime.Mymes+=new MyMessage(dis.look);
mytime.Mymes+=new MyMessage(mytime.Mytimelook);
mytime.TimeStart();
Console.ReadLine();
- C#中TIMER的运用
- VC++中计时器timer的运用
- C#中Timer的使用
- C#中委托的运用
- C#中Socket的运用
- C#中split的运用
- C#中XML的运用
- C#中Socket的运用
- C#中数据库的运用
- c#中operator的运用
- c#中timer和random的用法
- C#中timer类的用法
- C#中timer类的用法--转
- C#中timer类的用法
- C#中三个timer的区别
- C#中timer组件的使用
- C#中关于timer的简单问题
- C#中timer类的用法
- oracle 数据库里查看表空间使用状况
- ewebeditor漏洞解決方法
- 成就霸业的座右铭
- Oracle 创建索引分区
- yaffs文件系统的问题
- C#中TIMER的运用
- 加菲猫语录
- Win 98系统中VPN连接的设置
- 关于成本核算方法、步骤、成本分析
- 开张~
- 详细解说STL string
- sql第二课用transcat_sql来创建数据库的语句
- SNS催生新应用时代
- Ajax sys未定义问题