Пример #1
0
        protected virtual void OnRaiseNeedsFoodEvent(HungryEventArgs e)
        {
            EventHandler <HungryEventArgs> handler = NeedsFoodEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #2
0
        public void OnRaiseIsHungryEvent()
        {
            EventHandler <HungryEventArgs> handler = IsHungryEvent;

            if (handler != null)
            {
                var e = new HungryEventArgs
                {
                    Message = _hungryMessage
                };

                handler(this, e);
            }
        }