VeloxDev.Core 1.2.310

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package VeloxDev.Core --version 1.2.310
                    
NuGet\Install-Package VeloxDev.Core -Version 1.2.310
                    
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="VeloxDev.Core" Version="1.2.310" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VeloxDev.Core" Version="1.2.310" />
                    
Directory.Packages.props
<PackageReference Include="VeloxDev.Core" />
                    
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 VeloxDev.Core --version 1.2.310
                    
#r "nuget: VeloxDev.Core, 1.2.310"
                    
#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 VeloxDev.Core@1.2.310
                    
#: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=VeloxDev.Core&version=1.2.310
                    
Install as a Cake Addin
#tool nuget:?package=VeloxDev.Core&version=1.2.310
                    
Install as a Cake Tool

VeloxDev

GitHub

当您在 .NET 平台使用诸如 WPF / Avalonia 等框架开发带 UI 程序时,此项目可为一些功能提供更简单、更统一的代码实现

举个例子,VeloxDev 为 WPF / Avalonia 等框架提供了统一的 Fluent API 用以构建插值过渡,您将以几乎为零的学习成本掌握如何使用 C# 代码在多个平台加载插值过渡而无需关注 XAML


VeloxDev.Core

NuGet

VeloxDev.Core 是 VeloxDev 框架核心,包含一切必要的抽象并对其中跨平台不变的部分进行了抽象类实现。实际使用时无需安装此项目,而是安装相应平台的 VeloxDev.×××

如果您希望使用 VeloxDev.Core 对指定框架构建自定义的库,可以参考 VeloxDev 在 github 的 Wiki

Core

  • ⌈ TransitionSystem ⌋ , 使用Fluent API构建过渡效果 ✔
  • ⌈ AspectOriented ⌋ , 动态拦截/编辑属性、方法调用 ✔
  • ⌈ MonoBehaviour ⌋ , 实时帧刷新行为 ✔
  • ⌈ Visual Workflow Builder ⌋ ,拖拽式工作流构建器 ❌ 【 预计 V2 实装此项 】

Product

若您不想手动封装 VeloxDev.Core,可以直接选择下方列出的封装

VeloxDev.WPF NuGet

VeloxDev.Avalonia NuGet

VeloxDev.MAUI NuGet


API

使用完全一致的 API 在 WPF / Avalonia / MAUI 等框架中加载动画、实施AOP编程 ……

Ⅰ 过渡

WPF / Avalonia / MAUI 虽然各自使用不同的属性系统,但最终都会以标准CLR属性暴露给用户,基于这一特点,我们可以使用下述API来实现跨平台一致的动画创建

  • 线程安全 ✔
  • 缓动函数 ✔
  • 生命周期 ✔
  • 源生成器依赖 ❌
                var effect1 = new TransitionEffect()
                {
                    Duration = TimeSpan.FromSeconds(2),
                    LoopTime = 1,
                    EaseCalculator = Eases.Cubic.InOut,
                };

                effect1.Completed += (s, e) =>
                {
                    MessageBox.Show("Animation Completed");
                };

                var animation = Transition<Window>.Create()
                    .Property(w => w.Background, Brushes.Violet)
                    .Effect(effect1)
                    .Then()
                    .Property(w => w.Background, Brushes.Lime)
                    .Effect(effect1)
                    .Execute(this);

                // Transition<Window>.Execute(this);

Ⅱ AOP编程

对于公开可读写的属性或者公开可调用的方法,我们借助源生成器的力量即可对其动态代理,接着,这些属性或方法将能被我们拦截

但因其本质是对 DispatchProxy 的封装,此功能仅在 .NET5 + 项目可用

  • 完全依赖源生成器的写法
    public class ObservableAttribute : Attribute
    {

    }

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            Proxy.SetProxy(ProxyMembers.Setter, nameof(UID), // Setter 的 AOP
                null,
                (calls, result) =>
                {
                    var oldValue = UID;
                    var newValue = calls[0].ToString(); // 对于 Setter器,必定有一个参数 value
                    UID = newValue;
                    return Tuple.Create(oldValue, newValue); // 返回新值与旧值用于日志记录
                },
                (calls, result) =>
                {
                    var value = result as Tuple<string, string?>; // 接收上一个节点的返回值
                    MessageBox.Show($"值已更新 {value.Item1} → {value.Item2}"); // 编写日志
                    return null;
                });

            Proxy.SetProxy(ProxyMembers.Getter, nameof(Id), // Getter 的 AOP
                null,
                null,
                null);

            Proxy.SetProxy(ProxyMembers.Method,nameof(Do), // Method 的 AOP
                null,
                null,
                (calls, result) =>
                {
                    MessageBox.Show($"Do方法已执行过"); // 编写日志
                    return null;
                });
        }

        [AspectOriented]
        public string UID { get; set; } = "default";

        [AspectOriented]
        public void Do()
        {
            Proxy.UID = "newValue"; // 通过代理访问 UID 属性的 Setter
        }

        [Observable] // 若字段的某个特性包含 Observable 字样,则 AOP 接口会要求你实现其公开可读写属性 Id
        [AspectOriented]
        private int id = 3;

        public int Id
        {
            get => id;
            set => id = value;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Proxy.Do(); // 通过代理调用 Do 方法
        }
    }
  • 仅依靠动态生成的AOP接口
    public partial class MainPage : ContentPage, MainPage_MauiTest_Aop // 此处必须显式实现动态生成的AOP接口
    {
        [AspectOriented]
        public void Do()
        {

        }

        public MainPage()
        {
            InitializeComponent();

            var proxy = this.CreateProxy<MainPage_MauiTest_Aop>(); // 此处必须显式指定AOP接口

            proxy.SetProxy(ProxyMembers.Method, nameof(Do), null, null, (s, e) =>
            {
                Background = Brush.Violet;
                return null;
            });

            proxy.Do(); // 通过代理调用 Do 方法
        }
    }

Ⅲ MonoBehaviour

自动创建、维护一个实时循环任务,可以修改其 FPS 以控制刷新频率,示例中的 MonoBehaviour 不传入参数代表使用默认的 60 FPS

    [MonoBehaviour] // 默认 MonoBehaviour(60) 也就是 60 FPS
    public partial class MainWindow : Window
    {
        // 默认关闭,可以设置CanMonoBehaviour为true或false来开启或关闭 MonoBehaviour 功能
        
        partial void Start()
        {

        }
        partial void Update()
        {

        }
        partial void LateUpdate()
        {

        }
        partial void ExistMonoBehaviour()
        {
            
        }
    }
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 was computed.  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 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. 
.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 is compatible.  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.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net5.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on VeloxDev.Core:

Package Downloads
VeloxDev.WPF

VeloxDev.Core + WPF

VeloxDev.MAUI

VeloxDev.Core + MAUI

VeloxDev.Avalonia

VeloxDev.Core + Avalonia

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1-preview 91 7/28/2025
2.0.0-preview 87 7/28/2025
1.2.310 114 6/20/2025