Skip to content

Commit

Permalink
Added more documentation to CONTRIBUTING.md (#65)
Browse files Browse the repository at this point in the history
Co-authored-by: Etienne Baudoux <[email protected]>
  • Loading branch information
veler and Etienne Baudoux authored Nov 10, 2021
1 parent 68fe483 commit 684e36b
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,30 @@ You can contribute to DevToys app by:

DevToys is using [MEF](https://docs.microsoft.com/en-us/dotnet/framework/mef/) as dependency injection framework.
Every tools available (i.e Base64 Encoder/Decoder, JSON Formatter, Settings...) are dynamically discovered and instanciated through MEF. A tool is divided in 3 components:
1. `IToolProvider` and its metadata, which represents the tool as displayed in the main menu in the app. `IToolProvider` should be MEF exported.
2. `IToolViewModel`, which is a ViewModel as described by MVVM pattern in UWP. It doesn't have to be MEF exported but may be required depending on what the tool needs to work.
1. [IToolProvider](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/IToolProvider.cs) and its metadata, which represents the tool as displayed in the main menu in the app. `IToolProvider` should be MEF exported.
2. [IToolViewModel](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/IToolViewModel.cs), which is a ViewModel as described by [MVVM](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) pattern in UWP. It doesn't have to be MEF exported but may be required depending on what the tool needs to work.
3. A `Page` that represents the view of the tool.

The tool provider is instantiated when the app starts. The view and view models are instantiated when the user selects the tool in the main menu.

## IToolProvider metadata

Several attributes can be used when implementing an `IToolProvider`. They can be used in customize the behavior of the tool in DevToys without needing to implement a special logic for it.
You can find the attributes [here](https://github.com/veler/DevToys/tree/main/src/dev/impl/DevToys/Api/Tools). Here is a non-exhaustive list of attribute to use:
* [CompactOverlaySizeAttribute](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/CompactOverlaySizeAttribute.cs)
* [IsFooterItemAttribute](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/IsFooterItemAttribute.cs)
* [NameAttribute](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/NameAttribute.cs)
* [NotScrollableAttribute](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/NotScrollableAttribute.cs)
* [OrderAttribute](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/OrderAttribute.cs)
* [ProtocolNameAttribute](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/Api/Tools/ProtocolNameAttribute.cs)

## Sample

A good tool to take example on is `Json <> Yaml` converter.
* [The tool provider](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolProvider.cs)
* [The view model](https://github.com/veler/DevToys/blob/main/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolViewModel.cs)
* [The view](https://github.com/veler/DevToys/tree/main/src/dev/impl/DevToys/Views/Tools/JsonYaml)

## Code Style

1. DO use `PascalCase`:
Expand Down

0 comments on commit 684e36b

Please sign in to comment.