port from perforce
This commit is contained in:
66
intromat/Intromat/ViewModels/CodeGenPortViewModel.cs
Normal file
66
intromat/Intromat/ViewModels/CodeGenPortViewModel.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
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<CodeGenPortViewModel>));
|
||||
}
|
||||
|
||||
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<bool> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user