我需要以下while循环重复,直到单击balloontip。我怎样才能做到这一点?
while(/*Here, I want the loop to end when the Norm.BalloonTipClicked occurs*/)
{
Norm.ShowBalloonTip(10000);
System.Threading.Thread.Sleep(10000);
`enter code here`
System.Threading.Thread.Sleep(60000);
}
(正如您可能意识到的那样,'Norm'指的是通知图标的名称)
答案 0 :(得分:0)
使用标志,正如Simon Whitehead所建议的那样,我已经能够解决问题。通过使用以下代码,现在一切正常!
bool for3 = false;
for (; ; )
{
Norm.ShowBalloonTip(10000);
System.Threading.Thread.Sleep(10000);
Application.DoEvents();
if (loopVariable)
for3 = true;
if (for3) break;
System.Threading.Thread.Sleep(60000);
}
private static bool loopVariable = false;
void Norm_BalloonTipClicked(object sender, EventArgs e)
{
loopVariable = true;
}
感谢Simon Whitehead的所有帮助!非常感谢。