MiyabiMve 0.1.0

dotnet add package MiyabiMve --version 0.1.0
                    
NuGet\Install-Package MiyabiMve -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MiyabiMve" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MiyabiMve" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="MiyabiMve" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MiyabiMve --version 0.1.0
                    
#r "nuget: MiyabiMve, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MiyabiMve@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MiyabiMve&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=MiyabiMve&version=0.1.0
                    
Install as a Cake Tool

MiyabiMve

Avalonia integration layer for the MiyabiMve event bus. Provides base classes for Windows and UserControls with built-in event subscription and DI support.

NuGet

Install

dotnet add package MiyabiMve

Features

  • MiyabiWindowBase — base class for Avalonia Window with integrated EventBus
  • MiyabiUserControlBase — base class for Avalonia UserControl with integrated EventBus
  • Auto-cleanup — subscriptions are automatically disposed when the window closes or control unloads
  • UI thread helpers — UiInvoke() and UiInvokeAsync() for safe cross-thread updates
  • DI integration — AddMiyabiMve() extension method for IServiceCollection

Quick Start

1. Define an event

public record StatusChangedEvent : EventBase
{
    public string Status { get; init; } = string.Empty;
}

2. Create a window

public partial class MainWindow : MiyabiWindowBase
{
    public MainWindow(IEventBus eventBus) : base(eventBus)
    {
        InitializeComponent();
        Subscribe<StatusChangedEvent>(OnStatusChanged);
    }

    private void OnStatusChanged(StatusChangedEvent evt)
    {
        UiInvoke(() => StatusText.Text = evt.Status);
    }
}

3. Register services

// Program.cs
var services = new ServiceCollection();
services.AddTransient<MainWindow>();
services.AddMiyabiMve(typeof(App).Assembly);
var provider = services.BuildServiceProvider();

AppBuilder.Configure<App>()
    .AfterSetup(b => ((App)b.Instance!).ServiceProvider = provider)
    .StartWithClassicDesktopLifetime(args);

4. Resolve from DI

// App.axaml.cs
desktop.MainWindow = ServiceProvider.GetRequiredService<MainWindow>();

API

MiyabiWindowBase

Method Description
Publish(evt) Publish an event to all subscribers
PublishAsync(evt, ct) Publish asynchronously
Subscribe<T>(handler) Subscribe to an event (auto-disposed on close)
SubscribeAsync<T>(handler) Subscribe asynchronously
UiInvoke(action) Run on UI thread (sync)
UiInvokeAsync(action) Run on UI thread (async)

MiyabiUserControlBase

Same API as MiyabiWindowBase, but subscriptions are disposed on Unloaded instead of OnClosed.

AddMiyabiMve()

services.AddMiyabiMve(typeof(App).Assembly);
  • Registers IEventBus as singleton
  • Scans provided assemblies for IEventHandler<T> implementations
  • Registers handlers with transient lifetime via Scrutor

Requirements

  • .NET 10.0+
  • Avalonia 12.1+

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 113 7/20/2026