diff --git a/Examples/Nodify.Calculator/CreateFunctionDialog.xaml b/Examples/Nodify.Calculator/CreateFunctionDialog.xaml
index a6bcf0d..5a283c7 100644
--- a/Examples/Nodify.Calculator/CreateFunctionDialog.xaml
+++ b/Examples/Nodify.Calculator/CreateFunctionDialog.xaml
@@ -35,6 +35,15 @@
Background="#3E3E42" Foreground="White" RowBackground="#3E3E42"
AlternatingRowBackground="#333337" GridLinesVisibility="None"
HeadersVisibility="Column" BorderBrush="#555">
+
+
+
@@ -49,33 +58,22 @@
-
-
-
-
-
-
-
-
-
- string
- int
- double
- bool
- float
- decimal
- long
- DateTime
- object
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -90,6 +88,15 @@
Background="#3E3E42" Foreground="White" RowBackground="#3E3E42"
AlternatingRowBackground="#333337" GridLinesVisibility="None"
HeadersVisibility="Column" BorderBrush="#555">
+
+
+
@@ -104,33 +111,22 @@
-
-
-
-
-
-
-
-
-
- string
- int
- double
- bool
- float
- decimal
- long
- DateTime
- object
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Examples/Nodify.Calculator/CreateFunctionDialog.xaml.cs b/Examples/Nodify.Calculator/CreateFunctionDialog.xaml.cs
index c972a90..34d6785 100644
--- a/Examples/Nodify.Calculator/CreateFunctionDialog.xaml.cs
+++ b/Examples/Nodify.Calculator/CreateFunctionDialog.xaml.cs
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
using System.Windows;
namespace Nodify.Calculator
@@ -17,9 +19,12 @@ namespace Nodify.Calculator
public string DialogTitle => IsEditMode ? "Edit Function" : "Create New Function";
+ /// All available types for parameter dropdowns (system + custom models + List variants).
+ public List AvailableTypes { get; } = new List();
public CreateFunctionDialog()
{
+ BuildAvailableTypes();
InitializeComponent();
InputParamsGrid.ItemsSource = _inputs;
OutputParamsGrid.ItemsSource = _outputs;
@@ -38,6 +43,46 @@ namespace Nodify.Calculator
_outputs.Add(new FunctionParameterInfo { Name = p.Name, Type = p.Type });
}
+ private void BuildAvailableTypes()
+ {
+ // System / primitive types
+ var systemTypes = new[]
+ {
+ "string", "int", "double", "bool", "float",
+ "decimal", "long", "DateTime", "object"
+ };
+
+ AvailableTypes.AddRange(systemTypes);
+
+ // List<> wrappers for system types
+ foreach (var t in systemTypes)
+ AvailableTypes.Add($"List<{t}>");
+
+ // Custom model types from the project's CustomModels folder
+ try
+ {
+ var customModelDir = Path.Combine(ProjectManager.ProjectDirectory, "CustomModels");
+ if (Directory.Exists(customModelDir))
+ {
+ var modelNames = Directory.GetFiles(customModelDir, "*.cs")
+ .Select(f => Path.GetFileNameWithoutExtension(f))
+ .Where(n => !string.IsNullOrEmpty(n))
+ .OrderBy(n => n)
+ .ToList();
+
+ foreach (var model in modelNames)
+ {
+ AvailableTypes.Add(model);
+ AvailableTypes.Add($"List<{model}>");
+ }
+ }
+ }
+ catch
+ {
+ // If project directory is not set yet, just use system types
+ }
+ }
+
private void AddInput_Click(object sender, RoutedEventArgs e)
{
_inputs.Add(new FunctionParameterInfo { Name = $"param{_inputs.Count + 1}", Type = "string" });
diff --git a/Examples/Nodify.Calculator/FunctionOperationViewModel.cs b/Examples/Nodify.Calculator/FunctionOperationViewModel.cs
index 410e723..9aff25d 100644
--- a/Examples/Nodify.Calculator/FunctionOperationViewModel.cs
+++ b/Examples/Nodify.Calculator/FunctionOperationViewModel.cs
@@ -71,30 +71,40 @@ namespace Nodify.Calculator
// Add data output connectors to InnerBegin (these feed the inner flow with input values)
foreach (var inp in inputs)
{
+ var shape = GetShapeForType(inp.Type);
+ var color = ConnectorViewModel.GetColorForType(inp.Type);
+
InnerBegin.Output.Add(new ConnectorViewModel
{
Title = $"{inp.Name} ({inp.Type})",
- Shape = ConnectorShape.Circle,
+ Shape = shape,
IsInput = false,
- ConnectorColor = System.Drawing.Color.Gold
+ ConnectorColor = color,
+ DataType = inp.Type
});
// Also add an outer input connector on the function node
Input.Add(new ConnectorViewModel
{
Title = $"{inp.Name} ({inp.Type})",
- ConnectorColor = System.Drawing.Color.Gold
+ Shape = shape,
+ ConnectorColor = color,
+ DataType = inp.Type
});
}
// Add data input connectors to InnerEnd (these collect inner flow results)
foreach (var outp in outputs)
{
+ var shape = GetShapeForType(outp.Type);
+ var color = ConnectorViewModel.GetColorForType(outp.Type);
+
InnerEnd.Input.Add(new ConnectorViewModel
{
Title = $"{outp.Name} ({outp.Type})",
- Shape = ConnectorShape.Circle,
- ConnectorColor = System.Drawing.Color.Gold
+ Shape = shape,
+ ConnectorColor = color,
+ DataType = outp.Type
});
// Also add an outer output connector on the function node
@@ -102,11 +112,29 @@ namespace Nodify.Calculator
{
Title = $"{outp.Name} ({outp.Type})",
IsInput = false,
- ConnectorColor = System.Drawing.Color.Gold
+ Shape = shape,
+ ConnectorColor = color,
+ DataType = outp.Type
});
}
}
+ ///
+ /// Returns the appropriate connector shape based on the type name.
+ /// List/array types use Grid, custom model types use Square, primitives use Circle.
+ ///
+ private static ConnectorShape GetShapeForType(string typeName)
+ {
+ if (string.IsNullOrEmpty(typeName)) return ConnectorShape.Circle;
+ if (typeName.StartsWith("List<") && typeName.EndsWith(">"))
+ return ConnectorShape.Grid;
+ var primitives = new[] { "string", "int", "double", "bool", "float", "decimal", "long", "datetime", "object" };
+ if (primitives.Contains(typeName.ToLower()))
+ return ConnectorShape.Circle;
+ // Assume it's a custom model type
+ return ConnectorShape.Square;
+ }
+
protected override void OnInputValueChanged()
{
PropagateInputsToInner();