Loading EmptyTestPackage/EmptyTestPackage.csproj +21 −0 Original line number Diff line number Diff line Loading @@ -5,10 +5,31 @@ <LangVersion>14</LangVersion> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <NocubeName>EmptyTestPackage</NocubeName> <!-- 定义目标包路径(可选:支持多平台) --> <NocubePackagePath Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))"> $(APPDATA)\shRabbit\Nocube\Packages\$(NocubeName) </NocubePackagePath> <NocubePackagePath Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))"> $HOME/Library/Application Support/shRabbit/Nocube/Packages/$(NocubeName) </NocubePackagePath> <NocubePackagePath Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))"> $HOME/.config/shRabbit/Nocube/Packages/$(NocubeName) </NocubePackagePath> </PropertyGroup> <ItemGroup> <ProjectReference Include="..\Nocube.Common\Nocube.Common.csproj" /> </ItemGroup> <!-- 构建后自动复制到包目录 --> <Target Name="CopyToNocubePackages" AfterTargets="Build"> <MakeDir Directories="$(NocubePackagePath)" Condition="!Exists('$(NocubePackagePath)')"/> <Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="$(NocubePackagePath)" SkipUnchangedFiles="true"/> </Target> </Project> Nocube.Engine.Test/Packages/PackageLoaderTest.cs +13 −1 Original line number Diff line number Diff line Loading @@ -44,8 +44,20 @@ public class PackageLoaderTest public class Engine : IWorkspace { public IEngineContext Context { get; } = new Graphs.Engine(); public IEngineContext Context => new Context(Nodes); public string BasePath { get; } = ""; public List<Func<INode>> Nodes { get; } = []; } public class Context(List<Func<INode>> nodes) : IEngineContext { public IEnumerable<INode> GetNodes() { return nodes.Select(node => node()); } public CommonContext CommonContext { get; } public IConsole Console { get; } public ILogger Logger { get; } } } No newline at end of file Nocube.Engine/Nodes/NodeToControl.cs +3 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ public static class NodeIfToNode Header = pro.Name }; // 将原始的IProperty对象存储在连接器的DataContext中 node.DataContext = pro; // 选定一个颜色 // 如果有皮肤,使用自带的 var type = pro.ArrowType.FullName ?? "未知"; Loading Nocube.UI/App.axaml.cs +1 −29 Original line number Diff line number Diff line using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Data.Core; using Avalonia.Data.Core.Plugins; using System.Linq; using System.Reflection; using Avalonia.Markup.Xaml; using Nocube.Engine.Utilities; using Nocube.UI.ViewModels; using Nocube.UI.Views; namespace Nocube.UI; Loading @@ -15,8 +8,6 @@ public partial class App : Application { public override void Initialize() { Versions.Current = new Versions(Assembly.GetAssembly(typeof(App))!.GetName().Version!); AvaloniaXamlLoader.Load(this); } Loading @@ -24,28 +15,9 @@ public partial class App : Application { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { // Avoid duplicate validations from both Avalonia and the CommunityToolkit. // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins DisableAvaloniaDataAnnotationValidation(); desktop.MainWindow = new MainWindow { DataContext = new MainWindowViewModel(), }; desktop.MainWindow = new Views.MainWindow(); } base.OnFrameworkInitializationCompleted(); } private void DisableAvaloniaDataAnnotationValidation() { // Get an array of plugins to remove var dataValidationPluginsToRemove = BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray(); // remove each entry found foreach (var plugin in dataValidationPluginsToRemove) { BindingPlugins.DataValidators.Remove(plugin); } } } No newline at end of file Nocube.UI/Controls/Editors/NodeEditors/NodeEditor.axaml +19 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,24 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:node="clr-namespace:Nodify;assembly=Nodify" xmlns:viewModels="clr-namespace:Nocube.UI.ViewModels;assembly=Nocube.UI" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:DataType="viewModels:NodeEditorViewModel" x:Class="Nocube.UI.Controls.Editors.NodeEditors.NodeEditor"> <node:NodifyEditor x:Name="Editor" ItemsSource="{CompiledBinding UINodes}" Connections="{CompiledBinding Connections, Mode=TwoWay}" PendingConnection="{CompiledBinding PendingConnection, Mode=TwoWay}"> <node:NodifyEditor.ConnectionTemplate> <DataTemplate x:DataType="node:Connection"> <node:Connection Source="{CompiledBinding Source}" Target="{CompiledBinding Target}" /> </DataTemplate> </node:NodifyEditor.ConnectionTemplate> <node:NodifyEditor.PendingConnectionTemplate> <DataTemplate x:DataType="node:PendingConnection"> <node:Connection Source="{CompiledBinding Source}" Target="{CompiledBinding Target}" /> </DataTemplate> </node:NodifyEditor.PendingConnectionTemplate> </node:NodifyEditor> </UserControl> No newline at end of file Loading
EmptyTestPackage/EmptyTestPackage.csproj +21 −0 Original line number Diff line number Diff line Loading @@ -5,10 +5,31 @@ <LangVersion>14</LangVersion> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <NocubeName>EmptyTestPackage</NocubeName> <!-- 定义目标包路径(可选:支持多平台) --> <NocubePackagePath Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))"> $(APPDATA)\shRabbit\Nocube\Packages\$(NocubeName) </NocubePackagePath> <NocubePackagePath Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))"> $HOME/Library/Application Support/shRabbit/Nocube/Packages/$(NocubeName) </NocubePackagePath> <NocubePackagePath Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))"> $HOME/.config/shRabbit/Nocube/Packages/$(NocubeName) </NocubePackagePath> </PropertyGroup> <ItemGroup> <ProjectReference Include="..\Nocube.Common\Nocube.Common.csproj" /> </ItemGroup> <!-- 构建后自动复制到包目录 --> <Target Name="CopyToNocubePackages" AfterTargets="Build"> <MakeDir Directories="$(NocubePackagePath)" Condition="!Exists('$(NocubePackagePath)')"/> <Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="$(NocubePackagePath)" SkipUnchangedFiles="true"/> </Target> </Project>
Nocube.Engine.Test/Packages/PackageLoaderTest.cs +13 −1 Original line number Diff line number Diff line Loading @@ -44,8 +44,20 @@ public class PackageLoaderTest public class Engine : IWorkspace { public IEngineContext Context { get; } = new Graphs.Engine(); public IEngineContext Context => new Context(Nodes); public string BasePath { get; } = ""; public List<Func<INode>> Nodes { get; } = []; } public class Context(List<Func<INode>> nodes) : IEngineContext { public IEnumerable<INode> GetNodes() { return nodes.Select(node => node()); } public CommonContext CommonContext { get; } public IConsole Console { get; } public ILogger Logger { get; } } } No newline at end of file
Nocube.Engine/Nodes/NodeToControl.cs +3 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ public static class NodeIfToNode Header = pro.Name }; // 将原始的IProperty对象存储在连接器的DataContext中 node.DataContext = pro; // 选定一个颜色 // 如果有皮肤,使用自带的 var type = pro.ArrowType.FullName ?? "未知"; Loading
Nocube.UI/App.axaml.cs +1 −29 Original line number Diff line number Diff line using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Data.Core; using Avalonia.Data.Core.Plugins; using System.Linq; using System.Reflection; using Avalonia.Markup.Xaml; using Nocube.Engine.Utilities; using Nocube.UI.ViewModels; using Nocube.UI.Views; namespace Nocube.UI; Loading @@ -15,8 +8,6 @@ public partial class App : Application { public override void Initialize() { Versions.Current = new Versions(Assembly.GetAssembly(typeof(App))!.GetName().Version!); AvaloniaXamlLoader.Load(this); } Loading @@ -24,28 +15,9 @@ public partial class App : Application { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { // Avoid duplicate validations from both Avalonia and the CommunityToolkit. // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins DisableAvaloniaDataAnnotationValidation(); desktop.MainWindow = new MainWindow { DataContext = new MainWindowViewModel(), }; desktop.MainWindow = new Views.MainWindow(); } base.OnFrameworkInitializationCompleted(); } private void DisableAvaloniaDataAnnotationValidation() { // Get an array of plugins to remove var dataValidationPluginsToRemove = BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray(); // remove each entry found foreach (var plugin in dataValidationPluginsToRemove) { BindingPlugins.DataValidators.Remove(plugin); } } } No newline at end of file
Nocube.UI/Controls/Editors/NodeEditors/NodeEditor.axaml +19 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,24 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:node="clr-namespace:Nodify;assembly=Nodify" xmlns:viewModels="clr-namespace:Nocube.UI.ViewModels;assembly=Nocube.UI" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:DataType="viewModels:NodeEditorViewModel" x:Class="Nocube.UI.Controls.Editors.NodeEditors.NodeEditor"> <node:NodifyEditor x:Name="Editor" ItemsSource="{CompiledBinding UINodes}" Connections="{CompiledBinding Connections, Mode=TwoWay}" PendingConnection="{CompiledBinding PendingConnection, Mode=TwoWay}"> <node:NodifyEditor.ConnectionTemplate> <DataTemplate x:DataType="node:Connection"> <node:Connection Source="{CompiledBinding Source}" Target="{CompiledBinding Target}" /> </DataTemplate> </node:NodifyEditor.ConnectionTemplate> <node:NodifyEditor.PendingConnectionTemplate> <DataTemplate x:DataType="node:PendingConnection"> <node:Connection Source="{CompiledBinding Source}" Target="{CompiledBinding Target}" /> </DataTemplate> </node:NodifyEditor.PendingConnectionTemplate> </node:NodifyEditor> </UserControl> No newline at end of file