Giter Club home page Giter Club logo

c-'s Introduction

c-sharp-event-system

This is a simple Event System and Event Dispatcher written in C# with DotNetCore 6.0.

Why did I built an Event System even though C# provides a built-in event system:

  • To understand how one would work.
  • To learn C# before my OOP III class (which is in C#).
  • As a reference for future work/game development.
  • As a challenge

This library is able to:

  • Create custom events which can include methods and values
  • Call methods from outer-scope with the Observer design pattern (Event System)
  • Manage event listener
  • Dispatch events to the correct callback

This library does not allow for:

  • Sorting events with filters
  • Clearing events of specific type
  • Events queuing
  • Delaying events

Which file does what:

  • EventSystem.cs class manages listeners.
  • EventDispatcher.cs dispatches events to the right callback for listener classes.
  • Event.cs is an abstract class every custom events needs to inherit from.
  • IEventListener is and interface every event listener class needs to implement.

How to use the library :

See the Calculator example in the App project. In this example, there's a basic calculator calling and event depending on the operator selected. Once the event is fired, the calculator will be notified. The dispatcher will call the right callback depending on the event type. See the DivisionEvent to see the impact of the EventSystem class, since the DivisionEvent also calls a function in the TestClass, to show how the subscribe system allows for multiple listeners for the same event type.

Contributing :

Feel free to contribute if you have refactors or ideas in mind.

The future of this little library :

I would like to add a queue system and a filter system. Though I don't think I'll comeback to this small project since school will takeover all my free time.

c-'s People

Stargazers

Smart BigGuru avatar Work Bee avatar H@DES avatar SD11892 avatar  avatar windev0609 avatar GotoHigh avatar  avatar Full Stack Developer avatar ✨Senior Software Engineer✨ avatar

Watchers

 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.