Exemplo n.º 1
0
 public FindReplaceViewModel(GherkinEditor editor, IAppSettings appSettings) :
     base(appSettings)
 {
     GherkinEditor = editor;
     m_SearchCondition.IsCaseSensitive  = m_AppSettings.LastStatus.IsCaseSensitiveInFind;
     m_SearchCondition.IsMatchWholeWord = m_AppSettings.LastStatus.IsMatchWholeWordInFind;
     m_SearchCondition.IsUseRegex       = m_AppSettings.LastStatus.IsUseRegexInFind;
     m_SearchCondition.IsUseWildcards   = m_AppSettings.LastStatus.IsUseWildcardsInFind;
 }
        private void UpdateEditorProperty(GherkinEditor editor, string propertyName, object value)
        {
            if (editor == null)
            {
                return;
            }

            System.Reflection.PropertyInfo prop = editor.GetType().GetProperty(propertyName);
            prop.SetValue(editor, value);
        }
        /// <summary>
        /// Call method by reflection
        /// Implementation note:
        /// Type thisType = <your object>.GetType();
        /// MethodInfo theMethod = thisType.GetMethod(<The Method Name>);
        /// theMethod.Invoke(this, <an object [] of parameters or null>);
        /// </summary>
        /// <param name="editor"></param>
        /// <param name="methodName"></param>
        private void UpdateEditor(GherkinEditor editor, string methodName)
        {
            if (editor == null)
            {
                return;
            }

            Type thisType = editor.GetType();

            System.Reflection.MethodInfo method = thisType.GetMethod(methodName);
            method.Invoke(editor, null);
        }
        public WorkAreaEditorViewModel(TextEditor editor, MultiFileOpener multiFilesOpener, IAppSettings appSettings)
        {
            m_WorkAreaEditor = new GherkinEditor(editor,
                                                 null, // subEditor,
                                                 editor.Document,
                                                 appSettings,
                                                 new FontFamily(appSettings.Fonts.FontFamilyName),
                                                 appSettings.Fonts.FontSize,
                                                 installElementGenerators: false);
            editor.Options.CopyFileToHandler = CopyFileTo;
            editor.Options.RequireControlModifierForHyperlinkClick = false;     // Directly open web browser for work area instead of using Ctrl key
            m_MultiFilesOpener = multiFilesOpener;
            m_AppSettings      = appSettings;

            m_WorkAreaEditor.TextEditor.Options.ContainOpenableFilePath = ContainOpenableFilePath;
            m_WorkAreaEditor.TextEditor.Options.FilePathClickedHandler  = OnFilePathClickedHandler;

            EventAggregator <WindowDeactivatedArg> .Instance.Event += OnWindowDeactivatedEvent;
        }
        public void InitializeEditorView(TextEditor mainEditor, TextEditor subEditor, TextEditor viewerEditor)
        {
            TextDocument document = mainEditor.Document;

            MainGherkinEditor = new GherkinEditor(mainEditor, viewerEditor, document, m_AppSettings, FontFamily, FontSize, installElementGenerators: false);
            mainEditor.TextArea.IsKeyboardFocusedChanged += OnMainEditorKeyboardFocusedChanged;

            SubGherkinEditor = new GherkinEditor(subEditor, null /*viewerEditor*/, document, m_AppSettings, FontFamily, FontSize, installElementGenerators: false);
            subEditor.TextArea.IsKeyboardFocusedChanged += OnSubEditorKeyboardFocusedChanged;

            ViewerGherkinEditor = new GherkinEditor(viewerEditor, null /*viewerEditor*/, document, m_AppSettings, FontFamily, FontSize, installElementGenerators: true);
            viewerEditor.TextArea.IsKeyboardFocusedChanged += OnViewerEditorKeyboardFocusedChanged;

            FoldingExecutor = new FoldingExecutor(MainGherkinEditor, SubGherkinEditor, ViewerGherkinEditor);
            Load(CurrentFilePath);

            EventAggregator <EditorViewInitializationCompleted> .Instance.Publish(this, new EditorViewInitializationCompleted());

            TextEditorLoadedEvent?.Invoke();
            mainEditor.TextArea.Caret.PositionChanged   += OnMainEditorCaretPositionChanged;
            viewerEditor.TextArea.Caret.PositionChanged += OnViewerEditorCaretPositionChanged;
        }
Exemplo n.º 6
0
 public FoldingExecutor(GherkinEditor mainEditor, GherkinEditor subEditor, GherkinEditor viewerEditor)
 {
     MainGherkinEditor   = mainEditor;
     SubGherkinEditor    = subEditor;
     ViewerGherkinEditor = viewerEditor;
 }