예제 #1
0
        private void EditTextBlockAtBlank()
        {
            if (SelectedPageViewModel == null)
            {
                return;
            }
            if (SelectedTextBlock == null)
            {
                return;
            }

            var viewModel = new CreateEditNameForTextBlockDialogViewModel("Редактирование текста", SelectedTextBlock.Text);
            var newName   = viewModel.Show();

            if (string.IsNullOrEmpty(newName))
            {
                return;
            }

            var textBlocks = new List <TextBlock>();

            foreach (var textBlock in SelectedPageViewModel.TextBlocks)
            {
                var text = textBlock == SelectedTextBlock ? newName : textBlock.Text;
                textBlocks.Add(new TextBlock(text, textBlock.X, textBlock.Y));
            }
            UndoRedoStack.ExecuteNewCommand(new ChangeTextBlockListCommand(SelectedPageViewModel, textBlocks));
        }
예제 #2
0
        public void PointSelected(double x, double y)
        {
            SelectPointMode = false;
            if (SelectedPageViewModel == null)
            {
                return;
            }

            var viewModel = new CreateEditNameForTextBlockDialogViewModel("Добавление текста", "");
            var name      = viewModel.Show();

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            x -= 2;
            y -= 5;

            var textBlocks = SelectedPageViewModel.TextBlocks.Select(i => (TextBlock)i.Clone()).ToList();

            textBlocks.Add(new TextBlock(name, (int)x, (int)y));
            UndoRedoStack.ExecuteNewCommand(new ChangeTextBlockListCommand(SelectedPageViewModel, textBlocks));
        }