Ejemplo n.º 1
0
        public void Add(int x)
        {
            // agrega
            _total += x;

            // update display
            var posLeft = Console.CursorLeft;
            var posTop  = Console.CursorTop;

            Console.SetCursorPosition(0, 0);
            Console.WriteLine($"{_total} / {_threshold}");
            Console.SetCursorPosition(posLeft, posTop);

            // test threshold
            if (_total >= _threshold)
            {
                var args = new ThresholdReachedEventArgs
                {
                    Threshold   = _threshold,
                    TimeReached = DateTime.Now
                };
                OnThresholdReached(args);
            }
        }
Ejemplo n.º 2
0
 protected virtual void OnThresholdReached(ThresholdReachedEventArgs e)
 {
     ThresholdReached?.Invoke(this, e);
 }