예제 #1
0
        public void SimulateTimer(int timer)
        {
            if (timer <= 0)
            {
                throw new ArgumentException();
            }

            ImitationWatchEventArgs e = new ImitationWatchEventArgs(timer);

            e.RunTimer();

            EndTimer(e);
        }
예제 #2
0
 private void SubscriberMsg(Object sender, ImitationWatchEventArgs e)
 {
     Console.WriteLine($"I am SubscriberTwo and I waited an answer for {e.Timer} seconds!");
 }
예제 #3
0
        private void EndTimer(ImitationWatchEventArgs e)
        {
            ImitationWatchEventHandler alertSubscribers = Volatile.Read(ref TimeIsOver);

            alertSubscribers?.Invoke(this, e);
        }