Skip to content

Commit

Permalink
docs: review documentation (#87)
Browse files Browse the repository at this point in the history
changes:
- docs reviewed
- version bump to `3.1.x`
- package icon added

closes #80
  • Loading branch information
BoBoBaSs84 authored Apr 15, 2024
2 parents 1f4c2f2 + 8d61272 commit 8fdad76
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .filenesting.json

This file was deleted.

45 changes: 26 additions & 19 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<Project>

<PropertyGroup>
<PropertyGroup Label="Versioning">
<VersionMajor>3</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>0</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionMinor>1</VersionMinor>
<VersionPatch>$([System.DateTime]::UtcNow.ToString("MMdd"))</VersionPatch>
<VersionRevision>$([System.DateTime]::UtcNow.ToString("HHmm"))</VersionRevision>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch).$(VersionRevision)</VersionPrefix>
<VersionSuffix Condition="$(Configuration.Equals('Debug'))">Development</VersionSuffix>
<FileVersion>$(VersionMajor).$(VersionMinor).$(VersionPatch)</FileVersion>
</PropertyGroup>

<PropertyGroup>
<PropertyGroup Label="Technical">
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>recommended</AnalysisMode>
Expand All @@ -34,24 +36,28 @@
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="!$(MSBuildProjectName.EndsWith('Tests'))">
<Author>BoBoBaSs84</Author>
<Authors>$(Author)</Authors>
<Company>https://github.com/$(Author)</Company>
<Copyright>Copyright © $([System.DateTime]::UtcNow.Year) $(Author)</Copyright>
<Description>Contains relevant things for property one-way binding / two-way binding, for property change / changing notification and for collection change / changing notification.</Description>
<!--<PackageIcon>$(AssemblyName).png</PackageIcon>-->
<PackageId>$(AssemblyName)</PackageId>
<PackageTags>library;csharp;notification;common</PackageTags>
<PropertyGroup Condition="!$(MSBuildProjectName.EndsWith('Tests'))" Label="MetaData">
<Authors>BoBoBaSs84</Authors>
<Company>https://github.com/BoBoBaSs84</Company>
<Copyright>Copyright © $([System.DateTime]::UtcNow.Year) BoBoBaSs84</Copyright>
<Description>This package contains relevant abstractions and implementations for one- and two-way binding of properties, for notifications about changed properties, for notifications about changed collections and for the Relay Command Pattern for synchronous and asynchronous operations.</Description>
<Product>BB84.Notifications</Product>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/BoBoBaSs84/BB84.Notifications</RepositoryUrl>
<Title>BB84.Notifications</Title>
</PropertyGroup>

<PropertyGroup Condition="!$(MSBuildProjectName.EndsWith('Tests'))" Label="Package">
<PackageIcon>icon.png</PackageIcon>
<PackageId>BB84.Notifications</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/BoBoBaSs84/BB84.Notifications</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>https://github.com/BoBoBaSs84/BB84.Notifications/releases/tag/$(FileVersion)</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Product>$(AssemblyName)</Product>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/BoBoBaSs84/BB84.Notifications</RepositoryUrl>
<Title>$(AssemblyName)</Title>
<PackageTags>library;csharp;notification;common</PackageTags>
<PackageVersion>$(FileVersion)</PackageVersion>
</PropertyGroup>

<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
Expand All @@ -64,6 +70,7 @@
<ItemGroup Condition="!$(MSBuildProjectName.EndsWith('Tests'))">
<InternalsVisibleTo Include="$(AssemblyName)Tests" Key="00240000048000009400000006020000002400005253413100040000010001001d279f3822ca86e5157254452c9b0bda97bfeef3ed7964a8626318a1e46449adb0b62b7ca2f37b461ab2f28d0203344b11da76c5244331ff0a8629a258901534d0fb7d1cdfc6c048031874fced4f4c6a6d87991d4105e072adde2a965ccd440bbf8c3f90d6de6f8cfce47bd8908d9fdcdc08c617dc04616fc1dfcd290b4f4eec" />
<None Include="..\..\LICENSE" Pack="True" PackagePath="\" />
<None Include="..\..\icon.png" Pack="True" PackagePath="" />
<None Include="..\..\README.md" Pack="True" PackagePath="\" />
</ItemGroup>

Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
[![CI](https://github.com/BoBoBaSs84/BB84.Notifications/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/BoBoBaSs84/BB84.Notifications/actions/workflows/ci.yml)
[![Docs](https://github.com/BoBoBaSs84/BB84.Notifications/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/BoBoBaSs84/BB84.Notifications/actions/workflows/docs.yml)
[![CodeQL](https://github.com/BoBoBaSs84/BB84.Notifications/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/BoBoBaSs84/BB84.Notifications/actions/workflows/codeql.yml)
[![C#](https://img.shields.io/badge/12.0-239120?logo=csharp&logoColor=white&labelColor=gray)](https://github.com/BoBoBaSs84/BB84.Notifications)
[![Issues](https://img.shields.io/github/issues/BoBoBaSs84/BB84.Notifications)](https://github.com/BoBoBaSs84/BB84.Notifications/issues)
[![Commit](https://img.shields.io/github/last-commit/BoBoBaSs84/BB84.Notifications)](https://github.com/BoBoBaSs84/BB84.Notifications/commit/main)
[![License](https://img.shields.io/github/license/BoBoBaSs84/BB84.Notifications)](https://github.com/BoBoBaSs84/BB84.Notifications/blob/main/LICENSE)
[![NuGet](https://img.shields.io/nuget/v/BB84.Notifications.svg?logo=nuget&logoColor=white)](https://www.nuget.org/packages/BB84.Notifications)

# BB84.Notifications

Contains relevant things for property one-way binding / two-way binding, for property change / changing notification and for collection change / changing notification.
This repository contains relevant abstractions and implementations for one- and two-way binding of properties, for notifications about changed properties, for notifications about changed collections and for the Relay Command Pattern for synchronous and asynchronous operations.

## Usage

Depending on the application, there are several ways to skin a cat.

### The bindable property class and interfaces
### The notifiable property class and interface

Designed with one or two way binding in mind.

```csharp
public IBindableProperty<int> BindableInt { get; set; } = new BindableProperty<int>(default);
public INotifiableProperty<int> NotifiableInt { get; set; } = new NotifiableProperty<int>(default);
```

If the property is changed, the `PropertyChangingEventHandler` is triggered before the value changes and the `PropertyChangedEventHandler` is triggered after the value has changed.

- The `PropertyChangingEventHandler` contains via the `PropertyChangingEventArgs` the name of the property that is changing and when casted to `PropertyChangingEventArgs<T>` the old value of the property.
- The `PropertyChangedEventHandler` contains via the `PropertyChangedEventArgs` the name of the property that has changed and when casted to `PropertyChangedEventArgs<T>` the new value of the property.

Further implementation possibilities can be achieved with the help of the `IBindableProperty` interface.
Further implementation possibilities can be achieved with the help of the `INotifiableProperty<T>` interface.

### The notification property base class and interfaces
### The notifiable object base class and interface

Designed to handle changes at the class level and propagate them forward to the outside.
Designed to handle changes at the class level and propagate them.

```csharp
public sealed class TestClass : NotifyPropertyBase
public sealed class TestClass : NotifiableObject
{
private int _property;

Expand All @@ -51,14 +52,14 @@ If the property is changed, the `PropertyChangingEventHandler` is triggered befo
- The `PropertyChangingEventHandler` contains via the `PropertyChangingEventArgs` the name of the property that is changing and when casted to `PropertyChangingEventArgs<T>` the old value of the property.
- The `PropertyChangedEventHandler` contains via the `PropertyChangedEventArgs` the name of the property that has changed and when casted to `PropertyChangedEventArgs<T>` the new value of the property.

Further implementation possibilities can be achieved with the help of the `INotifyPropertyBase` interface.
Further implementation possibilities can be achieved with the help of the `INotifiableObject` interface.

### The notification collection base class and interfaces
### The notifiable collection base class and interface

The `NotifyCollectionBase` class provides methods to handle the change within a collection and propagate it to the outside.
The `NotifiableCollection` class provides methods to handle the change within a collection and propagate it to the outside.

```csharp
public sealed class MyStringCollection : NotifyCollectionBase, ICollection<string>
public sealed class MyStringCollection : NotifiableCollection, ICollection<string>
{
private readonly Collection<string> _collection;

Expand All @@ -74,7 +75,7 @@ Most of the implementation must be done despite the base class itself. The inten
- The `CollectionChangingEventHandler` contains via the `CollectionChangingEventArgs` the `CollectionChangeAction` and when casted to `CollectionChangingEventArgs<T>` the old value of the object.
- The `CollectionChangedEventHandler` contains via the `CollectionChangedEventArgs` the `CollectionChangeAction` and when casted to `CollectionChangedEventArgs<T>` the new value of the object.

Further implementation possibilities can be achieved with the interfaces `INotifyCollectionChanged` and `INotifyCollectionChanging`.
Further implementation possibilities can be achieved with the `INotifiableCollection` interface or the `INotifyCollectionChanged` and `INotifyCollectionChanging` interfaces.

### The notification attributes

Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8fdad76

Please sign in to comment.