-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathIntLiteralNode.cs
41 lines (36 loc) · 1.24 KB
/
IntLiteralNode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using DynamicData;
using ExampleCodeGenApp.Model;
using ExampleCodeGenApp.Model.Compiler;
using ExampleCodeGenApp.ViewModels.Editors;
using ExampleCodeGenApp.Views;
using NodeNetwork.Toolkit.ValueNode;
using NodeNetwork.ViewModels;
using ReactiveUI;
namespace ExampleCodeGenApp.ViewModels.Nodes
{
public class IntLiteralNode : CodeGenNodeViewModel
{
static IntLiteralNode()
{
Splat.Locator.CurrentMutable.Register(() => new CodeGenNodeView(), typeof(IViewFor<IntLiteralNode>));
}
public IntegerValueEditorViewModel ValueEditor { get; } = new IntegerValueEditorViewModel();
public ValueNodeOutputViewModel<ITypedExpression<int>> Output { get; }
public IntLiteralNode() : base(NodeType.Literal)
{
this.Name = "Integer";
Output = new CodeGenOutputViewModel<ITypedExpression<int>>(PortType.Integer)
{
Editor = ValueEditor,
Value = ValueEditor.ValueChanged.Select(v => new IntLiteral{Value = v ?? 0})
};
this.EditableOutputs().Add(Output);
}
}
}