port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
using System;
using System.Reactive.Linq;
using Intromat.PersistentModel;
using Intromat.PersistentModel.Nodes;
using Intromat.Views;
using NodeNetwork.Toolkit.Group.AddEndpointDropPanel;
using NodeNetwork.ViewModels;
using ReactiveUI;
using Splat;
namespace Intromat.ViewModels.Nodes
{
public class GroupSubnetIONodeViewModel : CodeGenNodeViewModel
{
private CodeNodeGroupIOBinding? _ioBinding;
private bool _isEntranceNode;
static GroupSubnetIONodeViewModel()
{
Locator.CurrentMutable.Register(() => new GroupSubnetIONodeView(), typeof(IViewFor<GroupSubnetIONodeViewModel>));
}
public GroupSubnetIONodeViewModel()
: base(NodeType.Group)
{
this.WhenAnyValue(vm => vm.IsEntranceNode)
.StartWith(false)
.Subscribe(isEntrance => Name = isEntrance ? "Group Input" : "Group Output");
}
public NetworkViewModel? Subnet { get; set; }
public AddEndpointDropPanelViewModel? AddEndpointDropPanelVM { get; set; }
public bool IsEntranceNode
{
get => _isEntranceNode;
set => this.RaiseAndSetIfChanged(ref _isEntranceNode, value);
}
public CodeNodeGroupIOBinding? IOBinding
{
get => _ioBinding;
set
{
if (_ioBinding != null)
throw new InvalidOperationException("IOBinding is already set.");
_ioBinding = value;
AddEndpointDropPanelVM = new AddEndpointDropPanelViewModel(IsEntranceNode, !IsEntranceNode) { NodeGroupIOBinding = IOBinding };
}
}
public override NodeModelBase CreateModel()
{
return new GroupSubnetIOModel();
}
public override void LoadModel(NodeModelBase model)
{
base.LoadModel(model);
var groupSubnetIO = (GroupSubnetIOModel)model;
IsEntranceNode = groupSubnetIO.IsEntrance;
}
public override void SaveModel(NodeModelBase model)
{
base.SaveModel(model);
var groupSubnetIO = (GroupSubnetIOModel)model;
groupSubnetIO.IsEntrance = IsEntranceNode;
}
}
}