C#timer_tick 不执行问题

Gemini_大静静 Gemini_大静静 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
MainForm.cs
 private void buttonX18_Click(object sender, EventArgs e)
{
Card_Read();//二代证进入
}
public void Card_Read()
{
Int32 result;
Int32 port = 0;
UInt32 flag = 0;
try
{
result = Card.OpenCardReader(port, flag);
if (Convert.ToInt32(result) == 0)
{
timer1.Start();
}
else
{
General.meg("打开二代证读取器初始化失败!");
}
}
catch
{
General.meg("二代证读取器初始化失败!");
}

}
private void timer1_Tick(object sender, EventArgs e)
{
try
{
Int32 result;
string txt = "";
Card.PERSONINFOW info = new Card.PERSONINFOW();
//txt = Application.StartupPath + "\\imageNew.bmp";
result = Card.GetPersonMsgW(ref info, txt);
if (result == 0)
{
textBoxX4.Text = info.cardId;
buttonX3_Click(sender, e);
timer1.Stop();
Card.CloseCardReader();
}
}
catch
{
General.meg("二代证读取器故障!");
}
}

当我执行过addCustormForm.cs 中的timer11_Tick之后,在执行MainForm、cs的Card_Read,他本来应该执行MainForm.cs 下面的timer1_Tick,然而实际中却执行了addCustormForm.cs 中的timer11_Tick 这是为什么啊
...全文
评论 8
收藏 已收藏
分享
返回顶部
Gemini_大静静
C# 111,129 成员 642,538 内容