Zeng.CoreLibrary.Toolkit
1.0.1
dotnet add package Zeng.CoreLibrary.Toolkit --version 1.0.1
NuGet\Install-Package Zeng.CoreLibrary.Toolkit -Version 1.0.1
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="Zeng.CoreLibrary.Toolkit" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zeng.CoreLibrary.Toolkit" Version="1.0.1" />
<PackageReference Include="Zeng.CoreLibrary.Toolkit" />
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 Zeng.CoreLibrary.Toolkit --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zeng.CoreLibrary.Toolkit, 1.0.1"
#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 Zeng.CoreLibrary.Toolkit@1.0.1
#: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=Zeng.CoreLibrary.Toolkit&version=1.0.1
#tool nuget:?package=Zeng.CoreLibrary.Toolkit&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CoreLibrary.Tookit
🔄️数据绑定服务
可以将一个INotifyPropertyChanged
对象的某个属性绑定到另一对象的相同类型的属性
如果绑定到不同类型的属性上需要设置自定义的IValueConverter
using DataBindingService service = new();
ViewModel viewModel = new();
View view = new();
service.Bind(
viewModel, nameof(ViewModel.Name),
view, nameof(View.Name));
viewModel.Name = "123";
viewModel.Name = "345";
service.UnBind(
viewModel, nameof(ViewModel.Name),
view, nameof(View.Name));
viewModel.Name = "123";
⚙️设置服务
提供了一套用于配置设置的服务。
示例:
// 创建设置服务
SettingService settingService = new();
// 初始化设置服务
settingService.BuildSettings(builder =>
{
builder
// 配置设置
.ConfigureSetting(
new(
"Number", // 设置键
new SettingValue( // 设置的值
100,
new SettingValueCommand( // 注入设置命令
(_, e) =>
{
Number = (int)e.NewValue;
}
)
)
)
);
}
这个示例创建了一个设置服务,并用Init
对其进行初始化。
通过调用builder
对象添加主题设置初始值,并设置选项发生改变时的的回调函数。
🌐本地化服务
using LocalizeService service = new();
service.SetLocalization(new CultureInfo("zh-cn"), "SubTitleUid", "副标题");
service.SetLocalization(new CultureInfo("en-us"), "SubTitleUid", "SubTitle");
SubTitle = service.Localize("SubTitleUid");
service.CurrentCultureChanged += (s,c) =>
{
SubTitle = s.Localize("SubTitleUid");
};
service.CurrentCultrue = new("en-us");
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. net9.0 is compatible. 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 was computed. 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.
-
net8.0
- MessagePack (>= 3.1.3)
- MessagePack.Annotations (>= 3.1.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.VisualStudio.Threading (>= 17.12.19)
- Serilog (>= 4.2.0)
- Zeng.CoreLibrary.Core (>= 1.0.1)
-
net9.0
- MessagePack (>= 3.1.3)
- MessagePack.Annotations (>= 3.1.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.VisualStudio.Threading (>= 17.12.19)
- Serilog (>= 4.2.0)
- Zeng.CoreLibrary.Core (>= 1.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Zeng.CoreLibrary.Toolkit:
Package | Downloads |
---|---|
Zeng.CoreLibrary.Toolkit.Avalonia
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.