コード例 #1
0
ファイル: AvalonPlugin.cs プロジェクト: AkshayVats/SuperShell
 public IShellInputControl GenerateShellInput()
 {
     var avalon = new CodeTextEditor();
     if (_completion == null) _editors.Add(new WeakReference<CodeTextEditor>(avalon));
     else avalon.Completion = _completion;
     avalon.FileName = "Repl.csx";
     return avalon;
 }
コード例 #2
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);

        }
コード例 #3
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);
            }
        }
コード例 #4
0
ファイル: EditorViewModel.cs プロジェクト: nutrino/CShell
        protected override void OnViewLoaded(object view)
        {
            editorView = (EditorView)view;
            textEditor = editorView.textEditor;
            if(System.IO.File.Exists(path))
                textEditor.Load(path);
            textEditor.Document.FileName = path;
            originalText = textEditor.Text;

            textEditor.TextChanged += delegate
            {
                IsDirty = string.Compare(originalText, textEditor.Text) != 0;
            };

            //some other settings
            textEditor.ShowLineNumbers = true;
            textEditor.SyntaxHighlighting = GetHighlighting(Path.GetExtension(path));

            if (CShell.Shell.Workspace != null && CShell.Shell.Workspace.ScriptingEngine.CodeCompletion != null)
                textEditor.Completion = CShell.Shell.Workspace.ScriptingEngine.CodeCompletion;

            //debug to see what commands are available in the editor
            //var c = textEditor.TextArea.CommandBindings;
            //foreach (System.Windows.Input.CommandBinding cmd in c)
            //{
            //    var rcmd = cmd.Command as RoutedCommand;
            //    if(rcmd != null)
            //    {
            //        Debug.Print(rcmd.Name + "  "+ rcmd.InputGestures.ToString());
            //    }
            //}
        }