public ExportWithUnitsViewModel(ExportWithUnits model, NodeView nodeView)
 {
     exportWithUnitsModel = model;           
     nodeViewModel = nodeView.ViewModel;
     nodeModel = nodeView.ViewModel.NodeModel;
     model.PropertyChanged +=model_PropertyChanged;      
 }
 public PreviewControl(NodeViewModel nodeViewModel)
 {
     this.scheduler = nodeViewModel.DynamoViewModel.Model.Scheduler;
     this.nodeViewModel = nodeViewModel;
     InitializeComponent();
     Loaded += OnPreviewControlLoaded;
 }
Esempio n. 3
0
        public CodeBlockEditor(NodeViewModel nodeViewModel)
        {
            InitializeComponent();

            this.nodeViewModel = nodeViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;
            this.nodeModel = nodeViewModel.NodeModel as CodeBlockNodeModel;

            // Register text editing events
            this.InnerTextEditor.TextChanged += InnerTextEditor_TextChanged;
            this.InnerTextEditor.TextArea.LostFocus += TextArea_LostFocus;

            // the code block should not be in focus upon undo/redo actions on node
            if (this.nodeModel.ShouldFocus)
            {
                this.Loaded += (obj, args) => this.InnerTextEditor.TextArea.Focus();
            }

            // Register auto-completion callbacks
            this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering;
            this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered;

            InitializeSyntaxHighlighter();
        }
        public ParameterEditor(NodeViewModel nodeViewModel)
        {
            InitializeComponent();

            this.nodeViewModel = nodeViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;
            this.InnerTextEditor.TextArea.LostFocus += OnTextAreaLostFocus;
            this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering;
            this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered;

            InitializeSyntaxHighlighter();
        }
        /// <summary>
        /// Create CodeCOmpletionEditor with NodeViewModel
        /// </summary>
        /// <param name="nodeView"></param>
        public CodeCompletionEditor(NodeView nodeView)
        {
            InitializeComponent();

            nodeView.Unloaded += (obj, args) => IsDisposed = true;
            this.nodeViewModel = nodeView.ViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;
            this.InnerTextEditor.TextChanged += OnTextChanged;
            this.InnerTextEditor.TextArea.LostFocus += OnTextAreaLostFocus;
            this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering;
            this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered;

            CodeHighlightingRuleFactory.CreateHighlightingRules(InnerTextEditor, dynamoViewModel.EngineController);
        }
Esempio n. 6
0
        public CodeBlockEditor(NodeViewModel nodeViewModel)
        {
            InitializeComponent();

            this.nodeViewModel = nodeViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;

            // Register text editing events
            this.InnerTextEditor.TextChanged += InnerTextEditor_TextChanged;
            this.InnerTextEditor.TextArea.LostFocus += TextArea_LostFocus;
            this.Loaded += (obj, args) => this.InnerTextEditor.TextArea.Focus();

            InitializeSyntaxHighlighter();
        }
Esempio n. 7
0
 public PreviewControl(NodeViewModel nodeViewModel)
 {
     this.scheduler = nodeViewModel.DynamoViewModel.Model.Scheduler;
     this.nodeViewModel = nodeViewModel;
     InitializeComponent();
     Loaded += PreviewControl_Loaded;
     SizeChanged += UpdateMargin;
     Unloaded += PreviewControl_Unloaded;
     if (this.nodeViewModel.PreviewPinned)
     {
         StaysOpen = true;
         BindToDataSource();
         TransitionToState(State.Condensed);
         TransitionToState(State.Expanded);
     }
     else
     {
         StaysOpen = false;
     }
 }
        public CodeBlockEditor(NodeView nodeView): this()
        {
           
            this.nodeViewModel = nodeView.ViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;
            this.nodeModel = nodeViewModel.NodeModel as CodeBlockNodeModel;
            
            if (nodeModel == null)
            {
                throw new InvalidOperationException(
                    "Should not be used for nodes other than code block");
            }

            // Determines if this editor is created for a new code block node.
            // In cases like an undo/redo operation, the editor is created for 
            // an existing code block node.
            createdForNewCodeBlock = string.IsNullOrEmpty(nodeModel.Code);

            // Register text editing events            
            this.InnerTextEditor.TextChanged += InnerTextEditor_TextChanged;
            this.InnerTextEditor.TextArea.LostFocus += TextArea_LostFocus;
            nodeView.Unloaded += (obj, args) => isDisposed = true;

            // the code block should not be in focus upon undo/redo actions on node
            if (this.nodeModel.ShouldFocus)
            {
                this.Loaded += (obj, args) => this.InnerTextEditor.TextArea.Focus();
            }

            // Register auto-completion callbacks
            this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering;
            this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered;

            InitializeSyntaxHighlighter();
        }
Esempio n. 9
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);
                            _nodes.Add(nodeViewModel);
                            Errors.Add(nodeViewModel.ErrorBubble);
                        }
                    }
                    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;
            }
        }
Esempio n. 10
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();
        }
Esempio n. 11
0
 public ViewModelEventArgs(NodeViewModel vm)
 {
     ViewModel = vm;
 }
Esempio n. 12
0
 public PreviewControl(NodeViewModel nodeViewModel)
 {
     this.nodeViewModel = nodeViewModel;
     InitializeComponent();
     Loaded += OnPreviewControlLoaded;
 }
Esempio n. 13
0
 private void unsubscribeNodeEvents(NodeViewModel nodeViewModel)
 {
     nodeViewModel.SnapInputEvent     -= nodeViewModel_SnapInputEvent;
     nodeViewModel.NodeLogic.Modified -= OnNodeModified;
 }
Esempio n. 14
0
 public ConverterViewModel(DynamoConvert model,NodeView nodeView)
 {
     dynamoConvertModel = model;           
     nodeViewModel = nodeView.ViewModel;
     nodeModel = nodeView.ViewModel.NodeModel;
     model.PropertyChanged +=model_PropertyChanged;
     ToggleButtonClick = new DelegateCommand(OnToggleButtonClick, CanToggleButton);         
 }
Esempio n. 15
0
 public ViewModelEventArgs(NodeViewModel vm)
 {
     ViewModel = vm;
 }
Esempio n. 16
0
 public PortViewModel(NodeViewModel node, PortModel port)
 {
     _node = node;
     _port = port;
    
     _port.PropertyChanged += _port_PropertyChanged;
     _node.PropertyChanged += _node_PropertyChanged;          
 }
Esempio n. 17
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();
        }