ReactiveMarbles.ObservableEvents.SourceGenerator
1.3.1
dotnet add package ReactiveMarbles.ObservableEvents.SourceGenerator --version 1.3.1
NuGet\Install-Package ReactiveMarbles.ObservableEvents.SourceGenerator -Version 1.3.1
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" />
paket add ReactiveMarbles.ObservableEvents.SourceGenerator --version 1.3.1
#r "nuget: ReactiveMarbles.ObservableEvents.SourceGenerator, 1.3.1"
// Install ReactiveMarbles.ObservableEvents.SourceGenerator as a Cake Addin #addin nuget:?package=ReactiveMarbles.ObservableEvents.SourceGenerator&version=1.3.1 // Install ReactiveMarbles.ObservableEvents.SourceGenerator as a Cake Tool #tool nuget:?package=ReactiveMarbles.ObservableEvents.SourceGenerator&version=1.3.1
<a href="https://github.com/reactivemarbles/observableevents"> <img width="150" src="./images/logo.png"/> </a>
Observable Event Generator
This project is a .NET source generator which produces IObservable<T>
for events contained within a object including all base classes. ObservableEvents
generator will convert events within an assembly and create observable wrappers for them, it is based on Pharmacist and uses .NET Source Generator technology.
NuGet Packages
Make sure your project is using the newer PackageReference
inside your CSPROJ. The older style is buggy and should be moved away from regardless. See here for discussions how to upgrade.
Install the following packages to start using Observable Events.
Name | Platform | NuGet |
---|---|---|
ReactiveMarbles.ObservableEvents.SourceGenerator | Core - Libary |
Manual Installation
Include the following in your .csproj file
<PackageReference
Include="ReactiveMarbles.ObservableEvents.SourceGenerator"
Version="1.0.2"
PrivateAssets="all" />
The PrivateAssets
will prevent the ObservableEvents source generator from being inherited by other projects.
How to use
Instance Based
It injects a class for instance based events into your source code which will expose a extension method called Events()
. You need to include the namespace ReactiveMarbles.ObservableEvents
to access to the extension method. You can then use this to get IObservable<T>
instances from your events.
using ReactiveMarbles.ObservableEvents;
public void MyClass : INotifyPropertyChanged
{
// Assumes this belong in a class with a event called PropertyChanged.
public void RunEvents()
{
this.Events().PropertyChanged.Subscribe(x => Console.WriteLine($"The {x} property has changed"));
}
public event PropertyChangedEventHandler PropertyChanged;
}
Static Events
You must use include a attribute GenerateStaticEventObservables
on the assembly level for a particular class. This will generate a class RxEvents
in the same namespace as the specified class.
[assembly: GenerateStaticEventObservablesAttribute(typeof(StaticTest))]
public static class StaticTest
{
public static event EventHandler? TestChanged;
}
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on ReactiveMarbles.ObservableEvents.SourceGenerator:
Package | Downloads |
---|---|
Mutagen.Bethesda.WPF
A C# library for Mutagen/Bethesda related WPF controls and styling |
|
SignalRChatClient
An Extension of the Microsoft.AspNetCore.SignalR.Client library |
|
RxUIExt.WinUI
WinUI extensions and tools for RxUIExt. |
GitHub repositories (9)
Showing the top 5 popular GitHub repositories that depend on ReactiveMarbles.ObservableEvents.SourceGenerator:
Repository | Stars |
---|---|
gui-cs/Terminal.Gui
Cross Platform Terminal UI toolkit for .NET
|
|
HMBSbige/NatTypeTester
测试当前网络的 NAT 类型(STUN)
|
|
database64128/youtube-dl-wpf
A simple GUI wrapper for youtube-dl and yt-dlp.
|
|
HMBSbige/BilibiliLiveRecordDownLoader
Bilibili 直播录制
|
|
reactiveui/Camelotia
Cross-platform sample .NET GUI for cloud file management.
|