-2

我需要重复以下 while 循环,直到单击气球提示。我怎样才能做到这一点?

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”指的是通知图标的名称)

4

1 回答 1

0

正如西蒙怀特黑德所建议的那样,使用标志,我已经能够解决问题。通过使用下面的代码,现在一切正常!

 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 的所有帮助!非常感谢。

于 2014-01-18T08:47:19.603 回答