protected override void OnShapeChanged(ShapeEventArgs e) { // Do any circle-specific processing here. // Call the base class event invocation method. base.OnShapeChanged(e); }
protected override void OnShapeChanged(ShapeEventArgs e) { // Do any circle-specific processing here e.Date = DateTime.Now; // Call the base class event invocation mathod base.OnShapeChanged(e); }
private static void HandleShapechanged(object sender, ShapeEventArgs e) { Shape s = (Shape)sender; // Diagnostic message for demonstration methods Console.WriteLine($"Received an event at {e.Date}. {s.Draw}. Shape area now: {e.NewArea}"); }
protected override void OnShapeChanged(ShapeEventArgs e) { // Do any circle-specific processing here. // Call the base class event invocation method. base.OnShapeChanged(e); }
// ...Other methods to draw, resize, etc. private void HandleShapeChanged(object sender, ShapeEventArgs e) { Shape s = (Shape)sender; // Diagnostic message for demonstration purposes. Console.WriteLine("Received event. Shape area is now {0}", e.NewArea); // Redraw the shape here. s.Draw(); }
//The event-invoking method that derived classes can override. protected virtual void OnShapeChanged(ShapeEventArgs e) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. EventHandler <ShapeEventArgs> handler = ShapeChanged; if (handler != null) { handler(this, e); } }
/// <summary> /// The event-invonking method that derived classes can override /// </summary> /// <param name="e">Event object</param> protected virtual void OnShapeChanged(ShapeEventArgs e) { ShapeChanged?.Invoke(this, e); }
// ...Other methods to draw, resize, etc. private void HandleShapeChanged(object sender, ShapeEventArgs e) { Shape s = (Shape)sender; // Diagnostic message for demonstration purposes. Console.WriteLine("Received event. Shape area is now {0}", e.NewArea); // Redraw the shape here. s.Draw(); }
//The event-invoking method that derived classes can override. protected virtual void OnShapeChanged(ShapeEventArgs e) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. EventHandler<ShapeEventArgs> handler = ShapeChanged; if (handler != null) { handler(this, e); } }
protected override void OnShapeChanged(ShapeEventArgs e) { e.Date = DateTime.Now; base.OnShapeChanged(e); }