public MWindow() { try { InitializeComponent(); Closing += new CancelEventHandler(MWindow_Closing); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); dt.Interval = TimeSpan.FromSeconds(1); dt.Tick += new EventHandler(dt_Tick); foldingManager = FoldingManager.Install(textEditor.TextArea); foldingStrategy = new XmlFoldingStrategy(); textEditor.TextChanged += new EventHandler(textEditor_TextChanged); if (App.StartUpCommand != "" && App.StartUpCommand != null) { openFile(App.StartUpCommand); } KeyGesture renderKeyGesture = new KeyGesture(Key.F5); KeyBinding renderCmdKeybinding = new KeyBinding(Commands.Render, renderKeyGesture); this.InputBindings.Add(renderCmdKeybinding); status.Text = "Ready!"; } catch (Exception e) { MessageBox.Show(e.Message); } }
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.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)); _searchHandler = new SearchInputHandler(textEditor.TextArea); textEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(_searchHandler); }
public XmlMessageView() { InitializeComponent(); foldingManager = FoldingManager.Install(document.TextArea); foldingStrategy = new XmlFoldingStrategy(); SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display); document.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy(); }
public APITestDialog() { InitializeComponent(); foldingManager = FoldingManager.Install(xmlViewer.TextArea); foldingStrategy = new XmlFoldingStrategy(); LoadAPICalls(); }
public void SetFolding() { if (Syntax == "XML") { SyntaxHighlighting = HighlightingManager.Instance.GetDefinition(Syntax); _xmlFoldingStrategy = new XmlFoldingStrategy(); _foldingManager = FoldingManager.Install(TextArea); UpdateFolding(); } }
public RenderToy() { InitializeComponent(); Loaded += new RoutedEventHandler(RenderToy_Loaded); gscreen = new GameScreen(screen.Handle); dt.Interval = TimeSpan.FromSeconds(1); dt.Start(); dt.Tick += new EventHandler(dt_Tick); status.Text = Variables.StatusString + Variables.LoadingString; foldingManager = FoldingManager.Install(textEditor.TextArea); foldingStrategy = new XmlFoldingStrategy(); textEditor.TextChanged += new EventHandler(textEditor_TextChanged); screen.SizeChanged += new SizeChangedEventHandler(screen_SizeChanged); }
public XMLFoldingStrategy() { xmlFolding_ = new XmlFoldingStrategy(); }
public FileConverterOutput() { 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.IsReadOnly = true; textEditor.ShowLineNumbers = true; _foldingManager = FoldingManager.Install(textEditor.TextArea); _foldingStrategy = new XmlFoldingStrategy(); _wpfSettings = new WpfDrawingSettings(); _wpfSettings.CultureInfo = _wpfSettings.NeutralCultureInfo; _fileReader = new FileSvgReader(_wpfSettings); _fileReader.SaveXaml = false; _fileReader.SaveZaml = false; mouseHandlingMode = MouseHandlingMode.None; _worker = new BackgroundWorker(); _worker.WorkerReportsProgress = true; _worker.WorkerSupportsCancellation = true; _worker.DoWork += new DoWorkEventHandler(OnWorkerDoWork); _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnWorkerCompleted); _worker.ProgressChanged += new ProgressChangedEventHandler(OnWorkerProgressChanged); }
private void HighlightingComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (TextEditor.SyntaxHighlighting == null) foldingStrategy = null; else { switch (TextEditor.SyntaxHighlighting.Name) { case "XML": foldingStrategy = new XmlFoldingStrategy(); TextEditor.TextArea.IndentationStrategy = new DefaultIndentationStrategy(); break; case "C#": case "C++": case "PHP": case "Java": TextEditor.TextArea.IndentationStrategy = new CSharpIndentationStrategy(TextEditor.Options); foldingStrategy = new BraceFoldingStrategy(); break; default: TextEditor.TextArea.IndentationStrategy = new DefaultIndentationStrategy(); foldingStrategy = null; break; } } if (foldingStrategy != null) { if (foldingManager == null) foldingManager = FoldingManager.Install(TextEditor.TextArea); UpdateFoldings(); } else { if (foldingManager == null) return; FoldingManager.Uninstall(foldingManager); foldingManager = null; } }
private void InitializeFolding() { _folderManager = FoldingManager.Install(_textEditor.TextArea); _foldingStrategy = new XmlFoldingStrategy(); }
private void SetLanguage(string fileSystemPath) { switch ((Path.GetExtension(fileSystemPath) ?? "").ToUpperInvariant()) { case ".XML": _textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML"); _foldingManager = FoldingManager.Install(_textEditor.TextArea); _foldingStrategy = new XmlFoldingStrategy(); _foldingStrategy.UpdateFoldings(_foldingManager, _textEditor.Document); break; case ".SH": _textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("TeX"); break; case ".PROP": _textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("TeX"); break; case ".SMALI": _textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("Java"); break; } }
public void LoadDocument(string documentFileName) { if (textEditor == null || String.IsNullOrEmpty(documentFileName)) { return; } this.UnloadDocument(); 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); }
private void UpdateFolds() { var editorOptions = Options as EditorOptions; var flag = editorOptions != null && editorOptions.EnableFolding; if (SyntaxHighlighting == null) { _foldingStrategy = null; } if (File.Exists(Filename)) { if (Path.GetExtension(Filename) == ".xml" || Path.GetExtension(Filename) == ".cfg") { _foldingStrategy = new XmlFoldingStrategy(); } else { if (FileLanguage != null) { _foldingStrategy = FileLanguage.FoldingStrategy; } } if (_foldingStrategy != null && flag) { if (_foldingManager == null) { _foldingManager = FoldingManager.Install(TextArea); } var xmlStrategy = _foldingStrategy as XmlFoldingStrategy; if (xmlStrategy != null) { xmlStrategy.UpdateFoldings(_foldingManager, Document); } else { ((AbstractFoldingStrategy)_foldingStrategy).UpdateFoldings(_foldingManager, Document); } RegisterFoldTitles(); } else { if (_foldingManager != null) { FoldingManager.Uninstall(_foldingManager); _foldingManager = null; } } } }
protected void updateFoldings() { if(foldingManager == null) { Log.Debug("foldingManager is null"); return; } switch(schema) { case ColorSchema.MSBuildTargets: { if(xmlFoldingStrategy == null) { xmlFoldingStrategy = new XmlFoldingStrategy(); } xmlFoldingStrategy.UpdateFoldings(foldingManager, _.Document); return; } case ColorSchema.InterpreterMode: case ColorSchema.ScriptMode: case ColorSchema.SBEScript: case ColorSchema.CSharpLang: { if(braceFoldingStrategy == null) { braceFoldingStrategy = new BraceFoldingStrategy(); } braceFoldingStrategy.UpdateFoldings(foldingManager, _.Document); return; } } foldingManager.Clear(); }
void HighlightingComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (textEditor.SyntaxHighlighting == null) { foldingStrategy = null; } else { switch (textEditor.SyntaxHighlighting.Name) { case "XML": foldingStrategy = new XmlFoldingStrategy(); textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy(); break; case "C#": case "C++": case "PHP": case "Java": textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(textEditor.Options); foldingStrategy = new BraceFoldingStrategy(); break; default: textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy(); foldingStrategy = null; break; } } if (foldingStrategy != null) { if (foldingManager == null) foldingManager = FoldingManager.Install(textEditor.TextArea); UpdateFoldings(); } else { if (foldingManager != null) { FoldingManager.Uninstall(foldingManager); foldingManager = null; } } }
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; } }
private void init() { foldingStrategy = new XmlFoldingStrategy(); textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy(); 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; }
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; }