Пример #1
0
 void UpdateVerticalPanels(object sender, EventArgs e)
 {
     CheckboxesPanel.UpdateGrid();
     CommentsPanel.UpdateGrid();
     ErrorMarkersPanel.UpdateGrid();
     BookmarksPanel.UpdateGrid();
 }
Пример #2
0
        private void SetNewCodeFile()
        {
            CodeFile newFile = CurrentCodeFile;

            // Отписываемся от событий предыдущего документа
            if (_lastFile != null)
            {
                _lastFile.LastCaretOffset   = AvalonEditor.TextArea.Caret.Offset;
                _lastFile.TextChanged      -= UpdateErrorsMarkers;
                _lastFile.TextChanged      -= OnCurrentFileChanged;
                _lastFile.LineCountChanged -= UpdateVerticalPanels;
                _lastFile.Compiled         -= FileOnCompiled;
            }

            // Выделять ошибки уже не надо
            _colorizeErrorForPopUp.Error = null;

            if (newFile != null)
            {
                newFile.TextChanged      += UpdateErrorsMarkers;
                newFile.TextChanged      += OnCurrentFileChanged;
                newFile.LineCountChanged += UpdateVerticalPanels; // для обновления вертикальных панелей
                newFile.Compiled         += FileOnCompiled;

                // Обновим вертикальные панели
                CheckboxesPanel.UpdateCodeFile(CurrentCodeFile);
                CheckboxesPanel.UpdateGrid();

                CommentsPanel.UpdateCodeFile(CurrentCodeFile);
                CommentsPanel.UpdateGrid();

                ErrorMarkersPanel.UpdateCodeFile(CurrentCodeFile);
                ErrorMarkersPanel.UpdateGrid();

                BookmarksPanel.UpdateCodeFile(CurrentCodeFile);
                BookmarksPanel.UpdateGrid();

                AvalonEditor.DataContext           = newFile;
                AvalonEditor.TextArea.Caret.Offset = newFile.LastCaretOffset;
            }
            else
            {
                AvalonEditor.DataContext = null;
                //Document = null;
            }

            OnCurrentFileChanged(null, null);

            // Установим видимости контролов
            // /*tabControl1.Visibility = */AvalonEditor.Visibility = (newFile == null) ? Visibility.Hidden : Visibility.Visible;

            // Set new last file
            _lastFile = newFile;
        }