예제 #1
0
        void Nodes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (var item in e.NewItems)
                {
                    if (item is NodeModel)
                    {
                        var node = item as NodeModel;

                        var nodeViewModel = new NodeViewModel(this, node);
                        nodeViewModel.SnapInputEvent += nodeViewModel_SnapInputEvent;
                        _nodes.Add(nodeViewModel);
                        Errors.Add(nodeViewModel.ErrorBubble);
                        nodeViewModel.UpdateBubbleContent();
                    }
                }
                break;

            case NotifyCollectionChangedAction.Reset:
                _nodes.Clear();
                Errors.Clear();
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (var item in e.OldItems)
                {
                    NodeViewModel nodeViewModel = _nodes.First(x => x.NodeLogic == item);
                    Errors.Remove(nodeViewModel.ErrorBubble);
                    _nodes.Remove(nodeViewModel);
                }
                break;
            }
        }
예제 #2
0
        void Model_NodeAdded(NodeModel node)
        {
            var nodeViewModel = new NodeViewModel(this, node);
            nodeViewModel.SnapInputEvent += nodeViewModel_SnapInputEvent;
            nodeViewModel.NodeLogic.Modified += OnNodeModified;
            _nodes.Add(nodeViewModel);
            Errors.Add(nodeViewModel.ErrorBubble);
            nodeViewModel.UpdateBubbleContent();

            PostNodeChangeActions();
        }
예제 #3
0
        void Nodes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (var item in e.NewItems)
                {
                    if (item is NodeModel)
                    {
                        var node = item as NodeModel;

                        var nodeViewModel = new NodeViewModel(this, node);
                        nodeViewModel.SnapInputEvent     += nodeViewModel_SnapInputEvent;
                        nodeViewModel.NodeLogic.Modified += OnNodeModified;
                        _nodes.Add(nodeViewModel);
                        Errors.Add(nodeViewModel.ErrorBubble);
                        nodeViewModel.UpdateBubbleContent();
                    }
                }
                break;

            case NotifyCollectionChangedAction.Reset:
                _nodes.Clear();
                Errors.Clear();
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (var item in e.OldItems)
                {
                    NodeViewModel nodeViewModel = _nodes.First(x => x.NodeLogic == item);
                    Errors.Remove(nodeViewModel.ErrorBubble);
                    _nodes.Remove(nodeViewModel);
                }
                break;
            }

            if (RunSettingsViewModel == null)
            {
                return;
            }

            CheckAndSetPeriodicRunCapability();
        }
예제 #4
0
        void Model_NodeAdded(NodeModel node)
        {
            var nodeViewModel = new NodeViewModel(this, node);
            nodeViewModel.SnapInputEvent += nodeViewModel_SnapInputEvent;
            nodeViewModel.NodeLogic.Modified += OnNodeModified;
            _nodes.Add(nodeViewModel);
            Errors.Add(nodeViewModel.ErrorBubble);
            nodeViewModel.UpdateBubbleContent();

            PostNodeChangeActions();
        }
예제 #5
0
        void Nodes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    foreach (var item in e.NewItems)
                    {
                        if (item is NodeModel)
                        {
                            var node = item as NodeModel;

                            var nodeViewModel = new NodeViewModel(this, node);
                            nodeViewModel.SnapInputEvent +=nodeViewModel_SnapInputEvent;  
                            nodeViewModel.NodeLogic.Modified +=OnNodeModified;
                            _nodes.Add(nodeViewModel);
                            Errors.Add(nodeViewModel.ErrorBubble);
                            nodeViewModel.UpdateBubbleContent();
                        }
                    }
                    break;
                case NotifyCollectionChangedAction.Reset:
                    _nodes.Clear();
                    Errors.Clear();
                    break;
                case NotifyCollectionChangedAction.Remove:
                    foreach (var item in e.OldItems)
                    {
                        NodeViewModel nodeViewModel = _nodes.First(x => x.NodeLogic == item);
                        Errors.Remove(nodeViewModel.ErrorBubble);
                        _nodes.Remove(nodeViewModel);

                    }
                    break;
            }

            if (RunSettingsViewModel == null) return;

            CheckAndSetPeriodicRunCapability();
        }