コード例 #1
0
        private void OpenFile(string fileName)
        {
            var editor = new CodeTextEditor();
            editor.FontFamily = new FontFamily("Consolas");
            editor.FontSize = 12;
            editor.Completion = completion;
            editor.OpenFile(fileName);
            editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");

            var tabItem = new TabItem();
            tabItem.Content = editor;
            tabItem.Header = System.IO.Path.GetFileName(fileName);
            tabs.Items.Add(tabItem);

        }
コード例 #2
0
ファイル: PageViewModel.cs プロジェクト: gilgame/SEWorkbench
        private void BuildEditor()
        {
            CodeTextEditor editor = new CodeTextEditor();

            try
            {
                editor.OpenFile(ProjectItem.Path);

                editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
                editor.Margin = new Thickness(0, 6, 0, 6);

                editor.IsReadOnly = _IsReadOnly;

                editor.TextChanged += Editor_TextChanged;
                editor.TextArea.GotFocus += Editor_GotFocus;

                editor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(editor.TextArea));

                Content = editor;

                UpdateEditorConfig();
            }
            catch (Exception ex)
            {
                string message = String.Format("Unable to open file '{0}'", editor.FileName);
                Services.MessageBox.ShowError(message, ex);
            }
        }