Esempio n. 1
0
        protected override void OnShapeChanged(ShapeEventArgs e)
        {
            // Do any circle-specific processing here.

            // Call the base class event invocation method.
            base.OnShapeChanged(e);
        }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
        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);
        }
Esempio n. 5
0
        // ...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();
        }
Esempio n. 6
0
        //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);
            }
        }
Esempio n. 7
0
 /// <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);
     }
 }
Esempio n. 10
0
 protected override void OnShapeChanged(ShapeEventArgs e)
 {
     e.Date = DateTime.Now;
     base.OnShapeChanged(e);
 }