コード例 #1
0
 private void ActivateNode(Node_ViewModel node)
 {
     ActiveNode = node;
     ActiveNodeRelationships = new RelationView_ViewModel {
         SourceNode = node, SelectedEndNode = null
     };
 }
コード例 #2
0
 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);
 }
コード例 #3
0
        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;
                }
            }
        }
コード例 #4
0
 private async void SetStartNode()
 {
     _startNode = new Node_ViewModel(await _rel.GetStartNode());
     RaisePropertyChanged("StartNode");
 }
コード例 #5
0
 private async void SetEndNode()
 {
     _endNode = new Node_ViewModel(await _rel.GetEndNode());
     RaisePropertyChanged("EndNode");
 }
コード例 #6
0
 private bool ActivateNodeEnabled(Node_ViewModel node)
 {
     return(node != null);
 }
コード例 #7
0
 public RelationView_ViewModel()
 {
     SelectedEndNode      = new Node_ViewModel();
     SourceNode           = new Node_ViewModel();
     SelectedRelationship = new Relationship_ViewModel("alpha");
 }