Пример #1
0
        private void Shape_ShapeChanged(object sender, ShapeEventArgs e)
        {
            Shape shape = (Shape)sender;

            Console.WriteLine($"Event fires. Shape area is {e.NewArea}");
            shape.Draw();
        }
Пример #2
0
        public void Update(double radius)
        {
            this.radius = radius;
            area        = CircleArea(radius);
            ShapeEventArgs args = new ShapeEventArgs(area);

            OnShapeChanged(args);
        }
Пример #3
0
        public void Update(double width, double height)
        {
            ShapeEventArgs args = new ShapeEventArgs(width * height);

            OnShapeChanged(args);
        }
Пример #4
0
 protected override void OnShapeChanged(ShapeEventArgs e)
 {
     base.OnShapeChanged(e);
 }
Пример #5
0
        protected virtual void OnShapeChanged(ShapeEventArgs e)
        {
            EventHandler <ShapeEventArgs> handler = ShapeChanged;

            handler?.Invoke(this, e);
        }