ApeFree.ApeDialogs.DependencyInjection 1.1.0-alpha61112

This is a prerelease version of ApeFree.ApeDialogs.DependencyInjection.
dotnet add package ApeFree.ApeDialogs.DependencyInjection --version 1.1.0-alpha61112
                    
NuGet\Install-Package ApeFree.ApeDialogs.DependencyInjection -Version 1.1.0-alpha61112
                    
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="ApeFree.ApeDialogs.DependencyInjection" Version="1.1.0-alpha61112" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApeFree.ApeDialogs.DependencyInjection" Version="1.1.0-alpha61112" />
                    
Directory.Packages.props
<PackageReference Include="ApeFree.ApeDialogs.DependencyInjection" />
                    
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 ApeFree.ApeDialogs.DependencyInjection --version 1.1.0-alpha61112
                    
#r "nuget: ApeFree.ApeDialogs.DependencyInjection, 1.1.0-alpha61112"
                    
#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 ApeFree.ApeDialogs.DependencyInjection@1.1.0-alpha61112
                    
#: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=ApeFree.ApeDialogs.DependencyInjection&version=1.1.0-alpha61112&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ApeFree.ApeDialogs.DependencyInjection&version=1.1.0-alpha61112&prerelease
                    
Install as a Cake Tool

ApeFree.ApeDialogs.DependencyInjection

NuGet License

ApeFree.ApeDialogs.DependencyInjection 是 ApeFree.ApeDialogs 的 Microsoft.Extensions.DependencyInjection (IoC/DI) 集成扩展库。它为注册和注入 IDialogProvider<TContext> / DialogProvider<TContext> 提供了标准化、链式友好的扩展方法。

  • 目标框架:netstandard2.0、net8.0、net10.0

📦 安装

dotnet add package ApeFree.ApeDialogs.DependencyInjection

或在项目文件(.csproj)中添加引用:

<PackageReference Include="ApeFree.ApeDialogs.DependencyInjection" Version="1.1.0.0-alpha61112" />

🚀 快速上手

在应用启动时(如 Generic Host、Prism、MVVM Toolkit 或 WPF / WinForms 应用入口)将对话框提供程序注册进 IServiceCollection:

using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using ApeFree.ApeDialogs;
using ApeFree.ApeDialogs.Settings;
using ApeFree.ApeDialogs.WPF;        // 假设使用 WPF 实现
using ApeFree.ApeDialogs.WPF.Interop;

var services = new ServiceCollection();

// 方式一:按类型自动注册(由 DI 容器解析构造函数依赖,同时注册具体类型、基类与接口)
services.AddApeDialogs<IWin32Owner, ApeDialogsWpfProvider>();

// 方式二:直接注册已有实例
// services.AddApeDialogs(new ApeDialogsWpfProvider());

// 方式三:使用工厂委托注册
// services.AddApeDialogs<IWin32Owner, ApeDialogsWpfProvider>(sp => new ApeDialogsWpfProvider());

var serviceProvider = services.BuildServiceProvider();

// 在 ViewModel 或业务服务中注入使用
public class MainViewModel
{
    private readonly IDialogProvider<IWin32Owner> _dialogProvider;

    public MainViewModel(IDialogProvider<IWin32Owner> dialogProvider)
    {
        _dialogProvider = dialogProvider;
    }

    public async Task OnButtonClickAsync()
    {
        await _dialogProvider.ShowMessageDialogAsync(new MessageDialogSettings
        {
            Title = "提示",
            Content = "Hello from DI injected DialogProvider!",
        });
    }
}

📄 开源许可证

本项目基于 Apache-2.0 协议开源。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.1.0-alpha61112 49 11/12/2026