using System; using Intromat.Views; using NodeNetwork.ViewModels; using ReactiveUI; using Splat; namespace Intromat.ViewModels { public enum EPortType { None, Execution, Integer, String, Boolean, Float, Texture, Mesh, } public class CodeGenPortViewModel : PortViewModel { private EPortType _portType; private bool _isPortVisible; static CodeGenPortViewModel() { Locator.CurrentMutable.Register(() => new CodeGenPortView(), typeof(IViewFor)); } public CodeGenPortViewModel() { IsPortVisibleChanged = this.WhenAnyValue(vm => vm.IsPortVisible); } public EPortType PortType { get => _portType; set => this.RaiseAndSetIfChanged(ref _portType, value); } public bool IsPortVisible { get => _isPortVisible; set => this.RaiseAndSetIfChanged(ref _isPortVisible, value); } public IObservable IsPortVisibleChanged { get; } public override void OnDragFromPort() { var document = ((CodeGenNetworkViewModel)Parent.Parent.Parent).Document; var undoRedo = document.MainViewModel.UndoRedo; undoRedo.PushGroup(document); base.OnDragFromPort(); } public override void OnDropOnPort() { var document = ((CodeGenNetworkViewModel)Parent.Parent.Parent).Document; var undoRedo = document.MainViewModel.UndoRedo; base.OnDropOnPort(); undoRedo.PopGroup(); } } }