Ejemplo n.º 1
0
        private void OnEditItemClick(object sender, RoutedEventArgs e)
        {
            if (ViewModel.WorkspaceViewModel.Zoom > MINIMUM_ZOOM_DIRECT_NODE_EDIT)
            {
                Panel.SetZIndex(noteTextBox, 1);
                ViewModel.IsOnEditMode = true;
                noteTextBox.Focus();
                noteTextBox.SelectAll();
                return;
            }

            // Setup a binding with the edit window's text field
            var dynamoViewModel = ViewModel.WorkspaceViewModel.DynamoViewModel;

            editWindow = new EditWindow(dynamoViewModel, true)
            {
                Title = Dynamo.Wpf.Properties.Resources.EditNoteWindowTitle
            };

            editWindow.EditTextBoxPreviewKeyDown += noteTextBox_PreviewKeyDown;
            editWindow.Closed += EditWindow_Closed;

            editWindow.BindToProperty(DataContext, new Binding("Text")
            {
                Mode   = BindingMode.TwoWay,
                Source = (DataContext as NoteViewModel),
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 2
0
        void ViewModel_RequestShowNodeRename(object sender, NodeDialogEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

            e.Handled = true;

            var editWindow = new EditWindow(viewModel.DynamoViewModel, false, true)
            {
                DataContext = ViewModel,
                Title       = Dynamo.Wpf.Properties.Resources.EditNodeWindowTitle
            };

            editWindow.Owner = Window.GetWindow(this);

            editWindow.BindToProperty(null, new Binding("NickName")
            {
                Mode = BindingMode.TwoWay,
                NotifyOnValidationError = false,
                Source = ViewModel,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 3
0
        private void editItem_Click(object sender, RoutedEventArgs e)
        {
            // Setup a binding with the edit window's text field
            var editWindow = new EditWindow(true);

            editWindow.BindToProperty(DataContext, new Binding("Text")
            {
                Mode   = BindingMode.TwoWay,
                Source = (DataContext as NoteViewModel),
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 4
0
        public override void editWindowItem_Click(object sender, RoutedEventArgs e)
        {
            var editWindow = new EditWindow {
                DataContext = this
            };

            editWindow.BindToProperty(null, new System.Windows.Data.Binding("Value")
            {
                Mode      = BindingMode.TwoWay,
                Converter = new StringDisplay(),
                NotifyOnValidationError = false,
                Source = this,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 5
0
        void ViewModel_RequestShowNodeRename(object sender, EventArgs e)
        {
            var editWindow = new EditWindow
            {
                DataContext = ViewModel,
                Title       = "Edit Node Name"
            };

            editWindow.BindToProperty(null, new Binding("NickName")
            {
                Mode = BindingMode.TwoWay,
                NotifyOnValidationError = false,
                Source = ViewModel,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 6
0
        private void OnEditItemClick(object sender, RoutedEventArgs e)
        {
            // Setup a binding with the edit window's text field
            var dynamoViewModel = ViewModel.WorkspaceViewModel.DynamoViewModel;
            var editWindow      = new EditWindow(dynamoViewModel, true)
            {
                Title = Dynamo.Wpf.Properties.Resources.EditNoteWindowTitle
            };

            editWindow.BindToProperty(DataContext, new Binding("Text")
            {
                Mode   = BindingMode.TwoWay,
                Source = (DataContext as NoteViewModel),
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 7
0
        private void editWindowItem_Click(object sender, RoutedEventArgs e)
        {
            var editWindow = new EditWindow()
            {
                DataContext = this
            };

            editWindow.BindToProperty(null, new System.Windows.Data.Binding("Value")
            {
                Mode                    = BindingMode.TwoWay,
                Converter               = new MeasureConverter(),
                ConverterParameter      = _measure,
                NotifyOnValidationError = false,
                Source                  = this,
                UpdateSourceTrigger     = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 8
0
        public void editWindowItem_Click(object sender, RoutedEventArgs e)
        {
            var editWindow = new EditWindow(_dynamoViewModel)
            {
                DataContext = _nodeModel
            };

            editWindow.BindToProperty(
                null,
                new Binding("Secret")
            {
                Mode      = BindingMode.OneWayToSource,
                Converter = new StringDisplay(),
                NotifyOnValidationError = false,
                Source = _nodeModel,
                UpdateSourceTrigger = UpdateSourceTrigger.LostFocus
            });
            editWindow.ShowDialog();
        }
Ejemplo n.º 9
0
        private void editWindowItem_Click(object sender, RoutedEventArgs e)
        {
            var viewModel  = this.dynamoViewModel;
            var editWindow = new EditWindow(viewModel)
            {
                DataContext = this.mesBaseModel
            };

            editWindow.BindToProperty(null, new Binding("Value")
            {
                Mode                    = BindingMode.TwoWay,
                Converter               = new MeasureConverter(),
                ConverterParameter      = this.mesBaseModel.Measure,
                NotifyOnValidationError = false,
                Source                  = this.mesBaseModel,
                UpdateSourceTrigger     = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 10
0
        public override void editWindowItem_Click(object sender, RoutedEventArgs e)
        {
            var viewModel  = GetDynamoViewModelFromMenuItem(sender as MenuItem);
            var editWindow = new EditWindow(viewModel)
            {
                DataContext = this
            };

            editWindow.BindToProperty(
                null,
                new Binding("Value")
            {
                Mode      = BindingMode.TwoWay,
                Converter = new StringDisplay(),
                NotifyOnValidationError = false,
                Source = this,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            editWindow.ShowDialog();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles the OnMouseLeftButtonDown event of the AnnotationView control.
        /// Selects the models inside the group
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
        private void AnnotationView_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (GroupTextBlock.IsVisible ||
                (!GroupTextBlock.IsVisible && !GroupTextBox.IsVisible))
            {
                ViewModel.Select();
            }

            //When Textbox is visible,clear the selection. That way, models will not be added to
            //dragged nodes one more time. Ref: MAGN-7321
            if (GroupTextBlock.IsVisible && e.ClickCount >= 2)
            {
                DynamoSelection.Instance.ClearSelection();
                //Set the panning mode to false if a group is in editing mode.
                if (ViewModel.WorkspaceViewModel.IsPanning)
                {
                    ViewModel.WorkspaceViewModel.DynamoViewModel.TogglePan(null);
                }
                e.Handled = true;
            }

            //When the Zoom * Fontsized factor is less than 7, then
            //show the edit window
            if (!GroupTextBlock.IsVisible && e.ClickCount >= 2)
            {
                var editWindow = new EditWindow(ViewModel.WorkspaceViewModel.DynamoViewModel, true)
                {
                    Title = Dynamo.Wpf.Properties.Resources.EditAnnotationTitle
                };
                editWindow.BindToProperty(DataContext, new Binding("AnnotationText")
                {
                    Mode   = BindingMode.TwoWay,
                    Source = (DataContext as AnnotationViewModel),
                    UpdateSourceTrigger = UpdateSourceTrigger.Explicit
                });

                editWindow.ShowDialog();
                e.Handled = true;
            }
        }