Exemplo n.º 1
0
 protected virtual void OnAgeChanging(AgeChangingEventArgs e)
 {
     if (AgeChanging != null)
     {
         AgeChanging(this, e);
     }
 }
Exemplo n.º 2
0
        private AgeChangingEventArgs OnAgeChangingForOut()
        {
            AgeChangingEventArgs args = new AgeChangingEventArgs();

            OnAgeChanging(args);

            return(args);
        }
Exemplo n.º 3
0
        private AgeChangingEventArgs OnAgeChanging(int currentAge, int newAge, bool cancel)
        {
            AgeChangingEventArgs args = new AgeChangingEventArgs(currentAge, newAge, cancel);

            OnAgeChanging(args);

            return(args);
        }
Exemplo n.º 4
0
        public void IncreaseAge()
        {
            int oldAge = Age;

            AgeChangingEventArgs args = new AgeChangingEventArgs();

            args.CurrentAge = Age;
            args.NewAge     = Age + 1;
            OnAgeChanging(args);
            if (args.Cancel)
            {
                return;
            }

            Age++;

            OnAgeChanged(oldAge, Age);
        }