Class NetworkViewModel
The viewmodel for node networks.
Inheritance
Implements
Inherited Members
Namespace: NodeNetwork.ViewModels
Assembly: NodeNetwork.dll
Syntax
public class NetworkViewModel : ReactiveObject, IReactiveNotifyPropertyChanged<IReactiveObject>, IHandleObservableErrors, IReactiveObject, INotifyPropertyChanged, INotifyPropertyChanging, IEnableLogger
Constructors
| Improve this Doc View SourceNetworkViewModel()
Declaration
public NetworkViewModel()
Properties
| Improve this Doc View SourceConnectionFactory
The function that is used to create connection viewmodels when the user creates connections in the network view. By default, this function creates a ConnectionViewModel.
Declaration
public Func<NodeInputViewModel, NodeOutputViewModel, ConnectionViewModel> ConnectionFactory { get; set; }
Property Value
Type | Description |
---|---|
System.Func<NodeInputViewModel, NodeOutputViewModel, ConnectionViewModel> |
Connections
The list of connections in this network.
Declaration
public ISourceList<ConnectionViewModel> Connections { get; }
Property Value
Type | Description |
---|---|
DynamicData.ISourceList<ConnectionViewModel> |
ConnectionsUpdated
This observable pushes a notification when a connection was added to/removed from the network, and the relevant endpoints have been updated.
Declaration
public IObservable<Unit> ConnectionsUpdated { get; }
Property Value
Type | Description |
---|---|
System.IObservable<System.Reactive.Unit> |
Remarks
Observing the Connections list directly will trigger the same notifications, but before the endpoints have had a chance to update and so they may be in an invalid state.
CutLine
The viewmodel of the cutline used in this network view.
Declaration
public CutLineViewModel CutLine { get; }
Property Value
Type | Description |
---|---|
CutLineViewModel |
DeleteSelectedNodes
Deletes the nodes in SelectedNodes that are user-removable.
Declaration
public ReactiveCommand<Unit, Unit> DeleteSelectedNodes { get; }
Property Value
Type | Description |
---|---|
ReactiveUI.ReactiveCommand<System.Reactive.Unit, System.Reactive.Unit> |
DragOffset
The drag offset of the initial view position used in this network view. Default value is (0, 0).
Declaration
public Point DragOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Point |
IsReadOnly
If true, the network and its contents (nodes, connections, input/output editors, ...) cannot be modified by the user.
Declaration
public bool IsReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LatestValidation
The validation of the current state of the network. This property is automatically updated when UpdateValidation runs.
Declaration
public NetworkValidationResult LatestValidation { get; }
Property Value
Type | Description |
---|---|
NetworkValidationResult |
MaxZoomLevel
The maximum zoom level used in this network view. Default value is 2.5.
Declaration
public double MaxZoomLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
MinZoomLevel
The minimum zoom level used in this network view. Default value is 0.15.
Declaration
public double MinZoomLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
NetworkChanged
This observable pushes a notification whenever any functional changes are made to the network. Purely esthetical changes, such as the collapsing of nodes, do not trigger this observable.
Declaration
public IObservable<Unit> NetworkChanged { get; }
Property Value
Type | Description |
---|---|
System.IObservable<System.Reactive.Unit> |
Nodes
The list of nodes in this network.
Declaration
public ISourceList<NodeViewModel> Nodes { get; }
Property Value
Type | Description |
---|---|
DynamicData.ISourceList<NodeViewModel> |
OnPendingConnectionDropped
Declaration
public Action OnPendingConnectionDropped { get; set; }
Property Value
Type | Description |
---|---|
System.Action |
PendingConnection
The connection that is currently being build by the user. This connection is visually displayed in the UI, but is not an actual functional connection. This is used when the user drags from an endpoint to create a new connection.
Declaration
public PendingConnectionViewModel PendingConnection { get; set; }
Property Value
Type | Description |
---|---|
PendingConnectionViewModel |
PendingNode
The viewmodel of the node that is not part of the network, but is displayed as a node that can be added. This property is used to display a new node when the user drags a node viewmodel over the network view.
Declaration
public NodeViewModel PendingNode { get; set; }
Property Value
Type | Description |
---|---|
NodeViewModel |
SelectedNodes
A list of nodes that are currently selected in the UI. The contents of this list is equal to the nodes in Nodes where the Selected property is true.
Declaration
public IObservableList<NodeViewModel> SelectedNodes { get; }
Property Value
Type | Description |
---|---|
DynamicData.IObservableList<NodeViewModel> |
SelectionRectangle
The viewmodel for the selection rectangle used in this network view.
Declaration
public SelectionRectangleViewModel SelectionRectangle { get; }
Property Value
Type | Description |
---|---|
SelectionRectangleViewModel |
UpdateValidation
Runs the Validator function and stores the result in LatestValidation.
Declaration
public ReactiveCommand<Unit, NetworkValidationResult> UpdateValidation { get; }
Property Value
Type | Description |
---|---|
ReactiveUI.ReactiveCommand<System.Reactive.Unit, NetworkValidationResult> |
Validation
Observable that produces the latest NetworkValidationResult every time the network is validated.
Declaration
public IObservable<NetworkValidationResult> Validation { get; }
Property Value
Type | Description |
---|---|
System.IObservable<NetworkValidationResult> |
Validator
Function that is used to check if the network is valid or not. To run the validation, use the UpdateValidation command.
Declaration
public Func<NetworkViewModel, NetworkValidationResult> Validator { get; set; }
Property Value
Type | Description |
---|---|
System.Func<NetworkViewModel, NetworkValidationResult> |
ZoomFactor
Scale of the view. Larger means more zoomed in. Default value is 1.
Declaration
public double ZoomFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceClearSelection()
Clears SelectedNodes, setting the IsSelected property of all the nodes to false.
Declaration
public void ClearSelection()
FinishCut()
Stops the current cut in the CutLine viewmodel and applies the changes.
Declaration
public void FinishCut()
FinishRectangleSelection()
Stops the current selection in RectangleSelection and applies the changes.
Declaration
public void FinishRectangleSelection()
RemovePendingConnection()
Sets PendingConnection to null.
Declaration
public void RemovePendingConnection()
StartCut()
Starts a cut in the CutLine viewmodel.
Declaration
public void StartCut()
StartRectangleSelection()
Starts a selection in RectangleSelection
Declaration
public void StartRectangleSelection()