Exemplo n.º 1
0
		protected override void OnViewLoaded(object view)
		{
            editorView = (EditorView)view;
            textEditor = editorView.textEditor;
            if(System.IO.File.Exists(path))
                textEditor.OpenFile(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());
            //    }
            //}
		}
Exemplo n.º 2
0
        protected override void OnViewLoaded(object view)
        {
            editorView = (EditorView)view;
            textEditor = editorView.textEditor;
            if(System.IO.File.Exists(path))
                textEditor.OpenFile(path);
            originalText = textEditor.Text;

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

            //some other settings
            var extension = Path.GetExtension(path);
            extension = extension == null ? "" : extension.ToLower();
            textEditor.ShowLineNumbers = true;
            textEditor.SyntaxHighlighting = GetHighlighting(extension);

            if (workspace != null && workspace.ReplExecutor.DocumentCompletion != null && (extension == ".cs" || extension == ".csx"))
            {
                textEditor.Completion = workspace.ReplExecutor.DocumentCompletion;
                textEditor.ReplExecutor = workspace.ReplExecutor;
            }

            //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());
            //    }
            //}
        }