Giter Club home page Giter Club logo

simplemvvm's Introduction

SimpleMVVM

SimpleMVVM (as the name implies) framework is a simple and light implementation of the MVVM pattern. It started as learning process into the MVVM pattern but over time I've come to reuse of the components over and over. Hence, the rise of the framework.

Contributions

Currently, I am not accepting (nor expecting) any contributors. But if you want to help I would greatly appreciate feedbacks and bugs. To file abug please open an Issue. Alternatively you can clone the repo and initiate a pull request.

Status

The project is in progress, still in it's beta and not yet reliable.

Usage

Commands

SimpleMVVM has its own implementation of relay command that can be used to separate UI components from the logic that needs to be executed on command invocation. This enables testing of business logic separately while ensuring that the UI code is loosely coupled to business logic. SimpleMVVM's implentation of relay command takes two delagtes as parameters, the first executes the required logic and the other is a predicate to determines if a command is enabled or disabled.

    bool EnableCommandDelegate()
    {
        return true; // some logic that will determin the state of the command
    }

    void OpenWorkbookExecute()
    {
        // do command logic here
    }

    var command = new RelayCommand(CommandDelegate, EnableCommandDelegate);

You can then use the command in a view

    <MenuItem Header="Open" Command="{Binding OpenCommand}" />

IOC

SimpleMVVM bundles its own IOC container, an instance of which is accessible via a static accessor IocContainer.Instance. For the container to be able to resolve a service, an interface of the service and implementation has to be registered with IOC container prior to a resolve request. See example below

    // Register a file service
    IocContainer.Instance.Register<IFileService, FtpFileService>();

    // get an instance of the file service
    var fileService = IocContainer.Instance.Resolve<IFileService>();

TODO

  • Dynamically locate viewmodel for view and vice versa (base on some convention).
  • Dynamically bind control to properties based the names assigned to the controls.
  • Determin what the convention above will be.

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section.

Author

Yemi Kudaisi

License

This project is licensed under the MIT license. See the LICENSE file for more info.

simplemvvm's People

Contributors

yemikudaisi avatar

Stargazers

 avatar

Watchers

 avatar  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.