private void Shape_ShapeChanged(object sender, ShapeEventArgs e) { Shape shape = (Shape)sender; Console.WriteLine($"Event fires. Shape area is {e.NewArea}"); shape.Draw(); }
public void Update(double radius) { this.radius = radius; area = CircleArea(radius); ShapeEventArgs args = new ShapeEventArgs(area); OnShapeChanged(args); }
public void Update(double width, double height) { ShapeEventArgs args = new ShapeEventArgs(width * height); OnShapeChanged(args); }
protected override void OnShapeChanged(ShapeEventArgs e) { base.OnShapeChanged(e); }
protected virtual void OnShapeChanged(ShapeEventArgs e) { EventHandler <ShapeEventArgs> handler = ShapeChanged; handler?.Invoke(this, e); }