config4net

Config4Net manages multiple configurations (saves, loads, builds UI automatically and synchronizes from UI to underlying data).

var awesomeAppConfig = Config.Default.Get<AwesomeAppConfig>();
UiManager.Default.Build<IWindowContainer>(awesomeAppConfig).Show();

Config4Net manages multiple configurations (saves, loads, builds UI automatically and synchronizes from UI to underlying data).

ExampleApp

Getting Started

Define a config class.

class Person
{
    [Showable]
    public string Name { get; set; }

    [Showable]
    public int Age { get; set; }

    [Showable("Where are you now:")]
    public Address Address { get; set; }
}

Showable attribute: Annotates a property is a visible component that will be shown in the UI. A property without Showable attribute will be invisible in the UI.

Load config

Loads configuration from file if it already exists or creates new one.

var person = Config.Default.Get<Person>();

Config saves the configurations data to files when app’s closing automatically and loads these data again when the app starts. If the configuration type that is demanding but it does not exist, an instance of this configuration type will be created and registered to the Config .

Show config to UI

Loads built-in components that were implemented for native-winform.

new WinFormFlatformLoader().Load();

The Config4Net.UI just is an abstract layer, but there is an implementation is native-winform that uses built-in controls from WinForm to build the UI.

Show config to UI and enjoy ;)

UiManager.Default.Build<IWindowContainer>(person).Show();

The UI builds based on configuration type (class structure), each property in the config will be bound to a component and type of component depends on property type. The data from the configuration will be synchronized from/to the UI.


Full example: Program.cs

Install

NuGet

Config4Net.Core a lightweight version without UI components. See Nuget package

Install-Package Config4Net.Core -Version 1.0.1

Config4net.UI.WinForm a UI implementation for WinForm. See Nuget package

Install-Package Config4Net.UI.WinForm -Version 1.0.0

Standalone

The lastest version: v1.0.0

Authors

  • Tran Xuan Son - main developer - sontx

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Source

https://github.com/sontx/config4net


Copyright © 2022. All rights reserved.