Code Monkey home page Code Monkey logo

count-down-timer-with-action-delegate's Introduction

Count Down Timer with Action<> Delegate.

Intermediate level task for practice events.

Estimated time to complete the task - 1h.

The task requires .NET 6 SDK installed.

Task description

  • You need to implement the Timer class for simulating a countdown clock. The Timer has the ability to send out messages with the information about Started, Tick and Stopped events to other types subscribed to the events. Use Action<> delegates as event handler delegates. Don't use the .NET System. Timer classes for the Timer implementation.

  • The Timer class should have the following functionality:

    • When an object of the Timer class is constructed it has to be assigned:
      • Name (not a null or an empty string, otherwise the exception ArgumentException should be thrown);
      • Number of ticks (the number has to be greater than 0; otherwise, the exception ArgumentException should be thrown).
    • After the Timer has been created it should be called to Run. In response to Run, the Timer fires the Started event. The event should contain the information about the Timer's Name and the Number of ticks to be fired.
    • After firing the Started event, the Timer starts firing Tick events with the information abount the Timer's name and the number of ticks left to fire. There should be delays between the Tick events. To emulate the delays between the Tick events, it is recommended to use the Thread.Sleep method.
    • After all Tick events have been fired, the Timer has to fire Stopped event, the event should contain the Timer's name information.
  • You need to complete the implementation of the CountDownNotifier class. This class consumes events from the Timer. The implementation logic must check that when the object of CountDownNotifier class is created, the null is not passed as a parameter insted of the Timer object.

  • Provide the implementation of the Factory methods (see Factory method theory) to create objects of the Timer and CountDownNotifier classes.

count-down-timer-with-action-delegate's People

Contributors

anzhelikakravchuk avatar mkrtich91 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.