Underdog.Core
1.0.4
dotnet add package Underdog.Core --version 1.0.4
NuGet\Install-Package Underdog.Core -Version 1.0.4
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="Underdog.Core" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Underdog.Core --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Underdog.Core, 1.0.4"
#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.
// Install Underdog.Core as a Cake Addin #addin nuget:?package=Underdog.Core&version=1.0.4 // Install Underdog.Core as a Cake Tool #tool nuget:?package=Underdog.Core&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Underdog.Core
基于Prism的wpf框架
鸣谢
根据这个修改来的
开发信息
- NET8 + VS2022
- WPF
支持功能
- 移植了Prism框架中的模块化、mvvm、region、dialog
- 支持NET8及以上版本
快速使用
安装包
dotnet add package Underdog.Core --version 1.0.4
dotnet add package Underdog.Wpf --version 1.0.5
1.创建Program.cs
文件
public class Program
{
public static IHost? AppHost { get; private set; }
public static IServiceProvider ServiceProvider => AppHost!.Services;
[System.STAThreadAttribute()]
public static void Main(string[] args)
{
var builder = Host.CreateDefaultBuilder(args)
// 注册模块
.ConfigureServices(ModularityExtension.AddModularity)
.ConfigureServices((hosting,context)=>
{
Assembly currentAssembly = Assembly.GetExecutingAssembly();
services.AddSingleton<App>();
services.AddScoped<MainWindow>();
services.AddScoped<MainWindowViewModel>();
services.AddRegion(); // 添加区域
services.AddDialog(); // 添加Dialog
services.AddMvvm(); // 添加MVVM
// 添加视图扫描器,由于region的name需要传完整视图文件所在程序集的完全限定名,提供视图扫描器获取名称
services.AddRegionViewScanner(currentAssembly);
services.AddViewsAndViewModels(currentAssembly);
});
AppHost = builder.Build();
AppHost.UseRegion<MainWindow>();
// 注册区域
// var regionManager = AppHost.Services.GetService<IRegionManager>();
// regionManager?.RegisterViewWithRegion("ContentRegion", typeof(ViewA));
// regionManager?.RegisterViewWithRegion("ContentRegion", typeof(ViewB));
// 启用模块化
AppHost.UseModularity();
AppHost.Run();
}
}
2.修改.csproj文件,指定启动对象为Program
<PropertyGroup>
<StartupObject>YourNamespace.Program</StartupObject>
</PropertyGroup>
3.修改App.xaml
删除 StartupUri="MainWindow.xaml" 属性
4.启动程序
MVVM
Dialog
Region
Modularity
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- CommunityToolkit.Mvvm (>= 8.2.2)
- Microsoft.Extensions.DependencyInjection.NamedService (>= 8.0.0-preview.7.23407.5)
- Microsoft.Extensions.Hosting (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Underdog.Core:
Package | Downloads |
---|---|
Underdog.Wpf
a wpf framework based on net core |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.4 | 79 | 8/12/2024 |
更改模块化功能,通过配置文件注册模块或通过代码直接注册模块(二选一)