Пример #1
0
        private void SyntaxModeCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Language language = (Language)_syntaxModeCombo.SelectedItem;

            if (_foldingManager != null)
            {
                _foldingManager.Clear();
                FoldingManager.Uninstall(_foldingManager);
            }

            string scopeName = _registryOptions.GetScopeByLanguageId(language.Id);

            _textMateInstallation.SetGrammar(null);
            _textEditor.Document = new TextDocument(ResourceLoader.LoadSampleFile(scopeName));
            _textMateInstallation.SetGrammar(scopeName);

            if (language.Id == "xml")
            {
                _foldingManager = FoldingManager.Install(_textEditor.TextArea);

                var strategy = new XmlFoldingStrategy();
                strategy.UpdateFoldings(_foldingManager, _textEditor.Document);
                return;
            }
        }
        public EditorView(ITextMarkerService textMarkerService)
        {
            _textMarkerService = textMarkerService;

            InitializeComponent();

            ErrorsRow.Height = new GridLength(0);

            var rowStyle = new Style(typeof(DataGridRow), (Style)FindResource("MetroDataGridRow"));

            rowStyle.Setters.Add(new EventSetter(MouseDoubleClickEvent,
                                                 new MouseButtonEventHandler(OnErrorsGridMouseDoubleClick)));
            ErrorsGrid.RowStyle = rowStyle;

            _foldingManager  = FoldingManager.Install(TextEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            TextEditor.TextChanged += (sender, args) =>
            {
                _foldingStrategy.UpdateFoldings(_foldingManager, TextEditor.Document);
            };

            _textMarkerService.SetTextEditor(TextEditor);

            var textView = TextEditor.TextArea.TextView;

            textView.BackgroundRenderers.Add(_textMarkerService);
            textView.LineTransformers.Add(_textMarkerService);
            textView.Services.AddService(typeof(ITextMarkerService), _textMarkerService);

            textView.MouseHover         += MouseHover;
            textView.MouseHoverStopped  += TextEditorMouseHoverStopped;
            textView.VisualLinesChanged += VisualLinesChanged;
        }
Пример #3
0
        private void init()
        {
            foldingStrategy = new XmlFoldingStrategy();
            textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
            foldingManager = FoldingManager.Install(textEditor.TextArea);

            if (foldingStrategy != null)
            {
                if (foldingManager == null)
                {
                    foldingManager = FoldingManager.Install(textEditor.TextArea);
                }
                foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
            }
            else
            {
                if (foldingManager != null)
                {
                    FoldingManager.Uninstall(foldingManager);
                    foldingManager = null;
                }
            }

            DispatcherTimer foldingUpdateTimer = new DispatcherTimer();

            foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
            foldingUpdateTimer.Tick    += foldingUpdateTimer_Tick;
            foldingUpdateTimer.Start();

            RawlerLib.UIData.UISyncContext = UISyncContext;
        }
Пример #4
0
        public SvgPage()
        {
            InitializeComponent();

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;

            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks      = true;
                options.EnableEmailHyperlinks = true;
                //options.ShowSpaces = true;
                //options.ShowTabs = true;
                //options.ShowEndOfLine = true;
            }

            textEditor.ShowLineNumbers = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            textEditor.CommandBindings.Add(new CommandBinding(
                                               ApplicationCommands.Print, OnPrint, OnCanExecuteTextEditorCommand));
            textEditor.CommandBindings.Add(new CommandBinding(
                                               ApplicationCommands.PrintPreview, OnPrintPreview, OnCanExecuteTextEditorCommand));

            SearchPanel.Install(textEditor);
        }
Пример #5
0
        public XamlPage()
        {
            InitializeComponent();

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;

            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks      = true;
                options.EnableEmailHyperlinks = true;
                options.EnableVirtualSpace    = false;
                options.HighlightCurrentLine  = true;
                //options.ShowSpaces               = true;
                //options.ShowTabs                 = true;
                //options.ShowEndOfLine            = true;
            }
            textEditor.ShowLineNumbers = true;

            textEditor.IsReadOnly = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            _searchPanel = SearchPanel.Install(textEditor);

            this.Loaded      += OnPageLoaded;
            this.SizeChanged += OnPageSizeChanged;
        }
        public void SetText(string text)
        {
            Text            = text;
            textEditor.Text = text;

            if (text.Length > 200 && !text.Contains("\n"))
            {
                wordWrap.IsChecked = true;
            }

            bool looksLikeXml = Utilities.LooksLikeXml(text);

            if (looksLikeXml && !IsXml)
            {
                IsXml = true;

                var highlighting = HighlightingManager.Instance.GetDefinition("XML");
                highlighting.GetNamedColor("XmlTag").Foreground = new SimpleHighlightingBrush(Color.FromRgb(163, 21, 21));
                textEditor.SyntaxHighlighting = highlighting;

                var foldingManager  = FoldingManager.Install(textEditor.TextArea);
                var foldingStrategy = new XmlFoldingStrategy();
                foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
            }
            else if (!looksLikeXml && IsXml)
            {
                IsXml = false;

                textEditor.SyntaxHighlighting = null;
            }
        }
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            // Configure XML folding strategy:
            this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
            var xmlFoldingStrategy = new XmlFoldingStrategy();
            var xmlFoldingManager  = FoldingManager.Install(this.TextArea);

            try
            {
                xmlFoldingStrategy.UpdateFoldings(xmlFoldingManager, this.Document);
            }
            catch (XmlException)
            {
                // Nothing
            }

            if (this.Model != null)
            {
                // This may be the case when the designer in VS wants to render the view
                this.Model.Tick += (object sender, EventArgs args) =>
                {
                    try
                    {
                        xmlFoldingStrategy.UpdateFoldings(xmlFoldingManager, this.Document);
                    }
                    catch (XmlException)
                    {
                        // Nothing. The text in the result does not have to be an XML document.
                    }
                };
            }
        }
Пример #8
0
        /// <summary>
        /// Prepares preview control by registering syntax highlighting and foldings
        /// </summary>
        public void Setup()
        {
            IHighlightingDefinition customHighlighting;
            string resourceName = Assembly.GetExecutingAssembly().GetManifestResourceNames().Single(str => str.EndsWith("sql.xshd", StringComparison.InvariantCultureIgnoreCase));

            using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
            {
                if (s == null)
                {
                    throw new InvalidOperationException("Could not find embedded resource");
                }
                using (XmlReader reader = new XmlTextReader(s))
                {
                    customHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
                }
            }
            // and register it in the HighlightingManager
            HighlightingManager.Instance.RegisterHighlighting("Custom Highlighting", new string[] { ".cool" }, customHighlighting);

            _editor.SyntaxHighlighting = customHighlighting;

            // folding
            var mgr   = FoldingManager.Install(_editor.TextArea);
            var strat = new XmlFoldingStrategy();

            strat.UpdateFoldings(mgr, _editor.Document);
        }
Пример #9
0
        public MainWindow()
        {
            _mainViewModel = new MainViewModel();
            DataContext    = _mainViewModel;
            InitializeComponent();
            LoadOldSettings();
            _sourceXmlFoldingManager  = FoldingManager.Install(SourceXml.TextArea);
            _sourceXsltFoldingManager = FoldingManager.Install(SourceXslt.TextArea);
            _outputXmlFoldingManager  = FoldingManager.Install(OutputXml.TextArea);

            SearchPanel.Install(SourceXml);
            SearchPanel.Install(OutputXml);
            SearchPanel.Install(SourceXslt);

            _strategy = new XmlFoldingStrategy();
            UpdateFolding();

            _mainViewModel.OnTransformFinished += delegate { UpdateFolding(); };

            SourceXslt.TextArea.TextEntering += TextEditor_TextArea_TextEntering;
            SourceXslt.TextArea.TextEntered  += TextEditor_TextArea_TextEntered;
            SourceXml.TextArea.TextEntered   += (a, b) =>
            {
                try
                {
                    var xpath = GetXmlXPath(true);
                    TextBlockXPath.Text = xpath;
                }
                catch (Exception)
                {
                    TextBlockXPath.Text = "Error getting XPath";
                }
            };
        }
Пример #10
0
 public CIMViewerAnnoControl()
 {
     InitializeComponent();
     _foldingManager = FoldingManager.Install(this.AvalonTextEditor.TextArea);
     _xmlFolding     = new XmlFoldingStrategy();
     (this.Content as FrameworkElement).DataContext = this;
 }
Пример #11
0
        public void LoadDocument(string documentFileName)
        {
            if (textEditor == null || string.IsNullOrWhiteSpace(documentFileName))
            {
                return;
            }

            string fileExt = Path.GetExtension(documentFileName);

            if (string.Equals(fileExt, ".zaml", StringComparison.OrdinalIgnoreCase))
            {
                using (FileStream fileStream = File.OpenRead(documentFileName))
                {
                    using (GZipStream zipStream =
                               new GZipStream(fileStream, CompressionMode.Decompress))
                    {
                        // Text Editor does not work with this stream, so we read the data to memory stream...
                        MemoryStream memoryStream = new MemoryStream();
                        // Use this method is used to read all bytes from a stream.
                        int    totalCount = 0;
                        int    bufferSize = 512;
                        byte[] buffer     = new byte[bufferSize];
                        while (true)
                        {
                            int bytesRead = zipStream.Read(buffer, 0, bufferSize);
                            if (bytesRead == 0)
                            {
                                break;
                            }
                            else
                            {
                                memoryStream.Write(buffer, 0, bytesRead);
                            }
                            totalCount += bytesRead;
                        }

                        if (totalCount > 0)
                        {
                            memoryStream.Position = 0;
                        }

                        textEditor.Load(memoryStream);

                        memoryStream.Close();
                    }
                }
            }
            else
            {
                textEditor.Load(documentFileName);
            }

            if (_foldingManager == null || _foldingStrategy == null)
            {
                _foldingManager  = FoldingManager.Install(textEditor.TextArea);
                _foldingStrategy = new XmlFoldingStrategy();
            }

            _foldingStrategy.UpdateFoldings(_foldingManager, textEditor.Document);
        }
Пример #12
0
        public SvgPage()
        {
            InitializeComponent();

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;

            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks      = true;
                options.EnableEmailHyperlinks = true;
                //options.ShowSpaces = true;
                //options.ShowTabs = true;
                //options.ShowEndOfLine = true;
            }

            textEditor.ShowLineNumbers = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            _searchHandler = new SearchInputHandler(textEditor.TextArea);
            textEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(_searchHandler);
        }
        public CIMViewer()
        {
            InitializeComponent();

            _foldingManager = FoldingManager.Install(this.AvalonTextEditor.TextArea);
            _xmlFolding     = new XmlFoldingStrategy();
            //http://blog.jerrynixon.com/2013/07/solved-two-way-binding-inside-user.html
            (this.Content as FrameworkElement).DataContext = this;
            //this.AvalonTextEditor.DataContext = this;

            ////http://stackoverflow.com/questions/13344982/does-avalonedit-texteditor-has-quick-search-replace-functionality
            //this.AvalonTextEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(
            //    new SearchInputHandler(this.AvalonTextEditor.TextArea));
            SearchPanel.Install(this.AvalonTextEditor);
            this.Loaded += (s, e) =>
            {
                try
                {
                    this.AvalonTextEditor.ContextMenu.SetValue(CIMViewer.TextEditorProperty,
                                                               this.AvalonTextEditor);
                }
                catch (System.Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Exception: {0}", ex.ToString());
                }
            };
        }
Пример #14
0
        internal void EnableFolding(bool enableFolding)
        {
            if (enableFolding)
            {
                switch (innerType)
                {
                case Enumerations.WebResourceType.Script:
                case Enumerations.WebResourceType.Css:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    foldingManager.UpdateFoldings(CreateBraceFoldings(textEditor.Document), -1);
                }
                break;

                case Enumerations.WebResourceType.WebPage:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    htmlFoldingStrategy = new HtmlFoldingStrategy();
                    htmlFoldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
                }
                break;

                case Enumerations.WebResourceType.Data:
                case Enumerations.WebResourceType.Xsl:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    xmlFoldingStrategy = new XmlFoldingStrategy();
                    xmlFoldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
                }
                break;
                }

                FoldingEnabled = true;
            }
            else
            {
                if (foldingManager != null)
                {
                    foldingManager.Clear();
                }

                FoldingEnabled = false;
            }
        }
 public MyCustomDecryptionView()
 {
     InitializeComponent();
     foldingManager  = FoldingManager.Install(document.TextArea);
     foldingStrategy = new XmlFoldingStrategy();
     SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
     document.TextArea.IndentationStrategy = new DefaultIndentationStrategy();
 }
 public XmlMessageView()
 {
     InitializeComponent();
     foldingManager  = FoldingManager.Install(document.TextArea);
     foldingStrategy = new XmlFoldingStrategy();
     SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
     document.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
 }
 private void UpdateFoldings()
 {
     if (_foldingManager == null || _foldingStrategy == null)
     {
         _foldingManager  = FoldingManager.Install(textEditor.TextArea);
         _foldingStrategy = new XmlFoldingStrategy();
     }
     _foldingStrategy.UpdateFoldings(_foldingManager, textEditor.Document);
 }
 public Preview()
 {
     InitializeComponent();
     TextViewer.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#");
     TextViewer.IsReadOnly         = true;
     DataContext     = ItemList;
     foldingManager  = FoldingManager.Install(TextViewer.TextArea);
     foldingStrategy = new XmlFoldingStrategy();
 }
Пример #19
0
        private void SetupEditor()
        {
            text.ShowLineNumbers = true;

            SearchPanel.Install(text);

            foldingManager  = FoldingManager.Install(text.TextArea);
            foldingStrategy = new XmlFoldingStrategy();
        }
Пример #20
0
        private void OnTextChanged(object sender, EventArgs e)
        {
            if (myFoldingManager == null)
            {
                myFoldingManager  = FoldingManager.Install(myTextEditor.TextArea);
                myFoldingStrategy = new XmlFoldingStrategy();
            }

            myFoldingStrategy.UpdateFoldings(myFoldingManager, myTextEditor.Document);
        }
Пример #21
0
 public void SetFolding()
 {
     if (Syntax == "XML")
     {
         SyntaxHighlighting  = HighlightingManager.Instance.GetDefinition(Syntax);
         _xmlFoldingStrategy = new XmlFoldingStrategy();
         _foldingManager     = FoldingManager.Install(TextArea);
         UpdateFolding();
     }
 }
Пример #22
0
        public MiniXamlPage()
        {
            InitializeComponent();
            DataContext = this;
            var foldingManager  = FoldingManager.Install(textEditor.TextArea);
            var foldingStrategy = new XmlFoldingStrategy();

            foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
            textEditor.Options.HighlightCurrentLine = true;
            textEditor.ShowLineNumbers = true;
        }
Пример #23
0
        public TextEditorEx()
        {
            _foldingStrategy = new XmlFoldingStrategy()
            {
                ShowAttributesWhenFolded = true
            };

            _timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(Math.Max(1, Delay))
            };
            _timer.Tick += _timer_Tick;
        }
Пример #24
0
        static public void GetStrategyFromName2(this TextEditor editor, IEditorContext control)
        {
            FoldingManager.Uninstall(control.FoldingManager);
            AbstractFoldingStrategy NewFoldingStrategy     = null;
            IIndentationStrategy    NewIndentationStrategy = null;

            if (editor.SyntaxHighlighting == null)
            {
            }                                                    //control.FoldingStrategy = null;
            else
            {
                switch (editor.SyntaxHighlighting.Name)
                {
                case "XML":
                    NewFoldingStrategy     = new XmlFoldingStrategy();
                    NewIndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
                    break;

                case "C#":
                case "C++":
                case "PHP":
                case "Java":
                    NewFoldingStrategy     = new CSharpPragmaRegionFoldingStrategy();
                    NewIndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy();
                    break;

                default:
                    NewFoldingStrategy     = new CSharpPragmaRegionFoldingStrategy();
                    NewIndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
                    break;
                }
            }
            //control.FoldingStrategy is not assigned
            //control.FoldingStrategy,editor.TextArea.IndentationStrategy
            if (NewFoldingStrategy != null)
            {
                control.FoldingStrategy = NewFoldingStrategy;
                if (control.FoldingManager == null)
                {
                    control.FoldingManager = FoldingManager.Install(editor.TextArea);
                }

                control.FoldingStrategy.UpdateFoldings(control.FoldingManager, editor.Document);
            }
            else
            {
                if (control.FoldingManager != null)
                {
                    FoldingManager.Uninstall(control.FoldingManager);
                    control.FoldingManager = null;
                }
            }
        }
Пример #25
0
        public DrawingPage()
        {
            InitializeComponent();

            _saveXaml                = true;
            _wpfSettings             = new WpfDrawingSettings();
            _wpfSettings.CultureInfo = _wpfSettings.NeutralCultureInfo;

            _fileReader          = new FileSvgReader(_wpfSettings);
            _fileReader.SaveXaml = _saveXaml;
            _fileReader.SaveZaml = false;

            _mouseHandlingMode = ZoomPanMouseHandlingMode.SelectPoint;

            //string workDir = Path.Combine(Path.GetDirectoryName(
            //    System.Reflection.Assembly.GetExecutingAssembly().Location), TemporalDirName);
            string workDir = Path.Combine(Path.GetFullPath("..\\"), TemporalDirName);

            _workingDir = new DirectoryInfo(workDir);

            _embeddedImages = new List <EmbeddedImageSerializerArgs>();

            _embeddedImageVisitor = new EmbeddedImageSerializerVisitor(true);
            _wpfSettings.Visitors.ImageVisitor = _embeddedImageVisitor;

            _embeddedImageVisitor.ImageCreated += OnEmbeddedImageCreated;

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;

            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks      = true;
                options.EnableEmailHyperlinks = true;
                options.EnableVirtualSpace    = false;
                options.HighlightCurrentLine  = true;
                options.ShowSpaces            = true;
                options.ShowTabs      = true;
                options.ShowEndOfLine = true;
            }

            textEditor.ShowLineNumbers = true;
            textEditor.WordWrap        = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            this.Loaded      += OnPageLoaded;
            this.Unloaded    += OnPageUnloaded;
            this.SizeChanged += OnPageSizeChanged;
        }
Пример #26
0
 public void LoadData()
 {
     if (!_previouslyLoaded)
     {
         _textDocument       = new TextDocument();
         TextEditor.Document = _textDocument;
         _foldingManager     = FoldingManager.Install(TextEditor.TextArea);
         _foldingStrategy    = new XmlFoldingStrategy();
     }
     _textDocument.Text = _documentManager.Document.ToString();
     _foldingStrategy.UpdateFoldings(_foldingManager, TextEditor.Document);
     _previouslyLoaded = true;
 }
Пример #27
0
        private void CreateFoldingStrategy(string filePath)
        {
            GherkinFoldingStrategy = null;
            XmlFoldingStrategy     = null;

            if (GherkinUtil.IsFeatureFile(filePath))
            {
                GherkinFoldingStrategy = new GherkinFoldingStrategy();
            }
            else if (IsXMLFile(filePath))
            {
                XmlFoldingStrategy = new XmlFoldingStrategy();
            }
        }
Пример #28
0
        /// <summary>
        /// 窗体载入3
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            Visible = true;

            eleCodeBox.Child = codebox;
            eleConsole.Child = console;

            // Fast search
            SearchPanel.Install(codebox.TextArea);
            SearchPanel.Install(console.TextArea);

            // Syntax rule
            int i = 1;

            while (i <= 2)
            {
                string   name     = Assembly.GetExecutingAssembly().GetName().Name + (i == 1 ? ".Python.xshd" : ".Console.xshd");
                Assembly assembly = Assembly.GetExecutingAssembly();
                using (Stream s = assembly.GetManifestResourceStream(name))
                {
                    using (XmlTextReader reader = new XmlTextReader(s))
                    {
                        var xshd = HighlightingLoader.LoadXshd(reader);
                        (i == 1 ? codebox : console).SyntaxHighlighting = HighlightingLoader.Load(xshd, HighlightingManager.Instance);
                    }
                }
                i++;
            }

            // 在构造函数中
            codebox.TextArea.TextEntering += codebox_TextArea_TextEntering;
            codebox.TextArea.TextEntered  += codebox_TextArea_TextEntered;

            foldingManager  = FoldingManager.Install(codebox.TextArea);
            foldingStrategy = new XmlFoldingStrategy();
            foldingStrategy.UpdateFoldings(foldingManager, codebox.Document);

            #region 多线程
            Thread ThreadTimingEvent = new Thread(timingEventEvent);
            ThreadTimingEvent.Start();
            ThreadTimingEvent.IsBackground = true;
            #endregion

            codebox.KeyUp += new System.Windows.Input.KeyEventHandler(run_KeyUp);
            console.KeyUp += new System.Windows.Input.KeyEventHandler(run_KeyUp);

            // 获取 python 编译环境地址, 缓存到 CommonSymbolSet 类的 PythonPyCodeTargetPath & PythonLocationTargetPath 变量
            PyCode.CommonSymbolSet.PythonPyCodeTargetPath   = PyCodeConfig.Config.readConfiguration(Application.StartupPath + @"\Important\Configuration\Preferences.ini", "path", "python-use-pycode");
            PyCode.CommonSymbolSet.PythonLocationTargetPath = PyCodeConfig.Config.readConfiguration(Application.StartupPath + @"\Important\Configuration\Preferences.ini", "path", "python-use-location");
        }
Пример #29
0
        private static void EditorTextChanged(object sender, EventArgs e)
        {
            var ed = sender as TextEditor;

            if (ed != null)
            {
                XmlFoldingStrategy fs = ed.Attached().FoldingStrategy;
                FoldingManager     fm = ed.Attached().FoldingManager;
                if (fs != null && fm != null)
                {
                    fs.UpdateFoldings(fm, ed.Document);
                }
            }
        }
Пример #30
0
        public ReportEditor()
        {
            //if (report == null) report = new PDFReport();
            InitializeComponent();

            foldingManager  = FoldingManager.Install(textEditor.TextArea);
            foldingStrategy = new XmlFoldingStrategy( );
            foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);

            DispatcherTimer foldingUpdateTimer = new DispatcherTimer();

            foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
            foldingUpdateTimer.Tick    += foldingUpdateTimer_Tick;
            foldingUpdateTimer.Start( );
        }
Пример #31
0
        public XMLDoc()
        { 
            InitializeComponent();

            SetTextEditorDefaultProperties();
            XmlFormattingStrategy strategy = new XmlFormattingStrategy();
            XmlFoldingStrategy folding = new XmlFoldingStrategy();

            txtEditCtl.Document.FormattingStrategy = (IFormattingStrategy)strategy;
            txtEditCtl.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("XML");
            txtEditCtl.Document.FoldingManager.FoldingStrategy = (IFoldingStrategy)folding;

            WireEvents();
            backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
        }
Пример #32
0
        public SQLDoc()
        { 
            InitializeComponent();

            SetTextEditorDefaultProperties();
            SetupMenuIemSelectCompare();

            SQLToolResourceSyntaxModeProvider provider = new SQLToolResourceSyntaxModeProvider();
            ICSharpCode.TextEditor.Document.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);
            txtEditCtl.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("SQL");

            // TODO: replace with SQL folding strategy
            XmlFoldingStrategy folding = new XmlFoldingStrategy();

            txtEditCtl.Document.FoldingManager.FoldingStrategy = (IFoldingStrategy)folding;

            WireEvents();
        }