private void ActivateNode(Node_ViewModel node) { ActiveNode = node; ActiveNodeRelationships = new RelationView_ViewModel { SourceNode = node, SelectedEndNode = null }; }
public Browser_ViewModel() { if (IsInDesignMode) { NodeId = 50; ActiveNode = new Node_ViewModel(); ActiveNodeRelationships = new RelationView_ViewModel(); } else { _db = new GraphDatabase("http://localhost:7474").Authenticate("neo4j", "foobarbaz"); } LoadNodeWithIdCommand = new RelayCommand(LoadNodeWithId, LoadNodeWithIdEnabled); IncrementNodeIdCommand = new RelayCommand(IncrementNodeId, IncrementNodeIdEnabled); DecrementNodeIdCommand = new RelayCommand(DecrementNodeId, DecrementNodeIdEnabled); ActivateNodeCommand = new RelayCommand <Node_ViewModel>(ActivateNode, ActivateNodeEnabled); }
private async void LoadNodeWithId() { int tries = 10; bool itFailed = true; while (itFailed && tries-- > 0) { itFailed = false; try { var node = await _db.GetNodeWithId(NodeId); var nodeVm = new Node_ViewModel(node); ActivateNode(nodeVm); } catch (GraphDatabaseException) { NodeId++; itFailed = true; } } }
private async void SetStartNode() { _startNode = new Node_ViewModel(await _rel.GetStartNode()); RaisePropertyChanged("StartNode"); }
private async void SetEndNode() { _endNode = new Node_ViewModel(await _rel.GetEndNode()); RaisePropertyChanged("EndNode"); }
private bool ActivateNodeEnabled(Node_ViewModel node) { return(node != null); }
public RelationView_ViewModel() { SelectedEndNode = new Node_ViewModel(); SourceNode = new Node_ViewModel(); SelectedRelationship = new Relationship_ViewModel("alpha"); }