62,046
社区成员
发帖
与我相关
我的任务
分享
protected void Button1_Click(object sender, EventArgs e)
{
doService ds = new doService(this.TextBox1.Text,"2","3");
Thread ts = new Thread(new ThreadStart(ds.SentMsg));
ts.Start();
}
public class doService
{
public string IbcID { get; set; }
public string TimeSpan { get; set; }
public string OrderID { get; set; }
public doService(string ibcid, string timespan, string orderid)
{
IbcID = ibcid;
TimeSpan = timespan;
OrderID = orderid;
}
public void SentMsg()
{
bool loop = true;
int i = 0;
while (loop)
{
i++;
string ok = IbcID + "_" + TimeSpan + "_" + OrderID;
System.IO.File.WriteAllText("d:\\" + IbcID + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt", ok);
if (i == 10) { loop = false; }
Thread.Sleep(2000);
}
}
}