示例#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);
        }