예제 #1
0
 void InitializeState(EditorPositionState state)
 {
     textEditorControl.TextEditor.ScrollToVerticalOffset(state.VerticalOffset);
     textEditorControl.TextEditor.ScrollToHorizontalOffset(state.HorizontalOffset);
     textEditorControl.TextEditor.TextArea.Caret.Position    = state.TextViewPosition;
     textEditorControl.TextEditor.TextArea.Caret.DesiredXPos = state.DesiredXPos;
 }
예제 #2
0
 void TextEditor_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     textEditorControl.TextEditor.IsVisibleChanged -= TextEditor_IsVisibleChanged;
     if (cachedEditorPositionState == null)
     {
         return;
     }
     InitializeState(cachedEditorPositionState);
     cachedEditorPositionState = null;
 }
예제 #3
0
 void TextEditor_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     textEditorControl.TextEditor.IsVisibleChanged -= TextEditor_IsVisibleChanged;
     if (cachedEditorPositionState == null)
         return;
     InitializeState(cachedEditorPositionState);
     cachedEditorPositionState = null;
 }
예제 #4
0
 void InitializeState(EditorPositionState state)
 {
     textEditorControl.TextEditor.ScrollToVerticalOffset(state.VerticalOffset);
     textEditorControl.TextEditor.ScrollToHorizontalOffset(state.HorizontalOffset);
     textEditorControl.TextEditor.TextArea.Caret.Position = state.TextViewPosition;
     textEditorControl.TextEditor.TextArea.Caret.DesiredXPos = state.DesiredXPos;
 }
예제 #5
0
        public void Deserialize(object obj)
        {
            var state = obj as EditorPositionState;
            if (state == null)
                return;

            // It can't scroll until it's gotten its scrollviewer
            if (textEditorControl.TextEditor.Template == null) {
                bool start = cachedEditorPositionState == null;
                cachedEditorPositionState = state;
                if (start) {
                    textEditorControl.TextEditor.IsVisibleChanged -= TextEditor_IsVisibleChanged;
                    textEditorControl.TextEditor.IsVisibleChanged += TextEditor_IsVisibleChanged;
                }
            }
            else
                InitializeState(state);
        }