|
|
|
|
Автор:
|
ckopn
|
|
Тема:
|
The name 'myTimer' does not exist in the current
|
|
Дата:
|
7/31/2006 1:33:00 PM
|
пишет ошибку в функции OnTimer -> Error 1 The name 'myTimer' does not exist in the current context D:\Visual Studio Projects\dontslouch\main.cs 31 25 dontslouch
там ведь стоят модификаторы доступа публик???
public class MessageBoxDontSlouch
{
public static void Main()
{
System.Timers.Timer myTimer = new System.Timers.Timer();
myTimer.Elapsed += new ElapsedEventHandler(OnTimer);
myTimer.Interval = 5000;
myTimer.Enabled = true;
myTimer.Start();
while(myTimer.Enabled=true);
myTimer.Stop();
}
public static void OnTimer(Object source, ElapsedEventArgs e)
{
DialogResult dr = MessageBox.Show("Сутулишься?", "Колличество: " ,MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question);
switch(dr)
{
case DialogResult.Yes:
if (myTimer.Interval > 5000)
myTimer.Interval = myTimer.Interval - 5000;
break;
case DialogResult.No:
myTimer.Interval = myTimer.Interval + 5000;
break;
case DialogResult.Cancel:
myTimer.Enabled = false;
break;
}
}
}
}
|
|
|
|