Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApp1
- {
- class Symaphor
- {
- int _currentstate = 0;
- /*
- 0 - красный
- 1 - зелёный
- */
- public delegate void SemaphorStateHandler(string mes);
- public event SemaphorStateHandler TimerSet;
- public Symaphor()
- {
- _currentstate = 0;
- }
- public void SetSemaphor()
- {
- if (_currentstate == 0)
- _currentstate = 1;
- else
- _currentstate = 0;
- if (TimerSet != null)
- {
- if (_currentstate == 1)
- TimerSet("Красный");
- else
- TimerSet("Зелёный");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement