当前位置: 首页>>代码示例>>C#>>正文


C# Folding.FoldingManager类代码示例

本文整理汇总了C#中ICSharpCode.AvalonEdit.Folding.FoldingManager的典型用法代码示例。如果您正苦于以下问题:C# FoldingManager类的具体用法?C# FoldingManager怎么用?C# FoldingManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FoldingManager类属于ICSharpCode.AvalonEdit.Folding命名空间,在下文中一共展示了FoldingManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InstallFoldingManager

		public void InstallFoldingManager()
		{
			var textEditorAdapter = textEditor as AvalonEditTextEditorAdapter;
			if (textEditorAdapter != null) {
				foldingManager = FoldingManager.Install(textEditorAdapter.TextEditor.TextArea);
			}
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:7,代码来源:TextEditorWithParseInformationFolding.cs

示例2: MWindow

 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);
     }
 }
开发者ID:JointJBA,项目名称:DisqueEngine,代码行数:27,代码来源:MWindow.xaml.cs

示例3: XamlPage

        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);
        }
开发者ID:jogibear9988,项目名称:SharpVectors,代码行数:28,代码来源:XamlPage.xaml.cs

示例4: MainForm

        public MainForm() {
            InitializeComponent();

            // 初始化编辑器。
            codeEditor = new ICSharpCode.AvalonEdit.TextEditor();
            codeEditorHost.Child = codeEditor;

            codeEditor.FontFamily = new System.Windows.Media.FontFamily("Consolas");
            codeEditor.FontSize = 14;
            codeEditor.ShowLineNumbers = true;
            codeEditor.SyntaxHighlighting = syntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".js");
            codeEditor.WordWrap = true;

            foldingManager = FoldingManager.Install(codeEditor.TextArea);
            codeEditor.TextChanged += codeEditor_TextChanged;

            //codeEditor.TextArea.AddHandler(System.Windows.DataObject.PastingEvent, new System.Windows.DataObjectPastingEventHandler(codeEditor_Paste));

            textMarkerService = new TextMarkerService(codeEditor);
            TextView textView = codeEditor.TextArea.TextView;
            textView.BackgroundRenderers.Add(textMarkerService);
            textView.LineTransformers.Add(textMarkerService);
            textView.Services.AddService(typeof(TextMarkerService), textMarkerService);
            textView.MouseHover += MouseHover;
            textView.MouseHoverStopped += codeEditorMouseHoverStopped;

            textView.MouseHover += MouseHover;
            textView.MouseHoverStopped += codeEditorMouseHoverStopped;
            textView.VisualLinesChanged += VisualLinesChanged;

        }
开发者ID:xuld,项目名称:JsonFormator,代码行数:31,代码来源:MainForm.cs

示例5: AvalonEditor

		/// <summary>
		/// Initializes a new instance of the <see cref="AvalonEditor"/> class.
		/// </summary>
		/// <exception cref="System.InvalidOperationException">Failed to load syntax definition</exception>
		public AvalonEditor()
		{
			_foldingManager = FoldingManager.Install(TextArea);
			_folding = new XmlFoldingStrategy();

			_htmlIndent = new HtmlIndentationStrategy();
			_defaultIndent = new DefaultIndentationStrategy();

			AutoIndent = true;
			AutoIndentAmount = 1;

			ShowLineNumbers = true;

			// Load our HTML highlighting
			using (var s = typeof(AvalonEditor).Assembly.GetManifestResourceStream(typeof(AvalonEditor), "HtmlHighlighting.xml"))
			{
				if (s == null)
					throw new InvalidOperationException("Failed to load syntax definition");
				using (var r = XmlReader.Create(s))
				{
					var highlightingDefinition = HighlightingLoader.Load(r, HighlightingManager.Instance);

					SyntaxHighlighting = highlightingDefinition;
				}
			}

            IsDirty = false;

            Task.Factory.StartNew(FoldingUpdateLoop);
		}
开发者ID:andrebelanger,项目名称:HTMLEditor,代码行数:34,代码来源:AvalonEditor.cs

示例6: FoldingManagerAdapter

 public FoldingManagerAdapter(ITextEditor textEditor)
 {
     AvalonEditTextEditorAdapter adaptor = textEditor as AvalonEditTextEditorAdapter;
     if (adaptor != null) {
         this.foldingManager = FoldingManager.Install(adaptor.TextEditor.TextArea);
     }
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:FoldingManagerAdapter.cs

示例7: Dispose

 public void Dispose()
 {
     if (foldingManager != null) {
         FoldingManager.Uninstall(foldingManager);
         foldingManager = null;
     }
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:FoldingManagerAdapter.cs

示例8: ResetFoldingManager

 public void ResetFoldingManager()
 {
   if (_foldingManager != null)
     FoldingManager.Uninstall(_foldingManager);
   _foldingManager = FoldingManager.Install(this.editor.TextArea);
   UpdateFoldings();
 }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:7,代码来源:EditorWpf.xaml.cs

示例9: FoldingSection

 internal FoldingSection(FoldingManager manager, int startOffset, int endOffset)
 {
     Debug.Assert(manager != null);
     this.manager = manager;
     this.StartOffset = startOffset;
     this.Length = endOffset - startOffset;
 }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:7,代码来源:FoldingSection.cs

示例10: XmlMessageView

 public XmlMessageView()
 {
     InitializeComponent();
     foldingManager = FoldingManager.Install(document.TextArea);
     foldingStrategy = new XmlFoldingStrategy();
     SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
     document.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
 }
开发者ID:Particular,项目名称:ServiceInsight,代码行数:8,代码来源:XmlMessageView.xaml.cs

示例11: JsonMessageView

 public JsonMessageView()
 {
     InitializeComponent();
     foldingManager = FoldingManager.Install(document.TextArea);
     foldingStrategy = new BraceFoldingStrategy();
     SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
     document.TextArea.IndentationStrategy = new DefaultIndentationStrategy();
 }
开发者ID:AlexRhees,项目名称:ServiceInsight,代码行数:8,代码来源:JsonMessageView.xaml.cs

示例12: DocumentDialog

 public DocumentDialog(string value)
 {
     InitializeComponent();
     this.jsonEditor.Text = value;
     this.jsonEditor.TextChanged += Te_TextChanged;
     foldingManager = FoldingManager.Install(this.jsonEditor.TextArea);
     foldingStrategy = new BraceFoldingStrategy();
     foldingStrategy.UpdateFoldings(foldingManager, jsonEditor.Document);
 }
开发者ID:alekkowalczyk,项目名称:a7DocumentDbStudio,代码行数:9,代码来源:DocumentDialog.xaml.cs

示例13: APITestDialog

        public APITestDialog()
        {
            InitializeComponent();

             foldingManager = FoldingManager.Install(xmlViewer.TextArea);
             foldingStrategy = new XmlFoldingStrategy();

             LoadAPICalls();
        }
开发者ID:Joeeigel,项目名称:eve-net,代码行数:9,代码来源:APITestDialog.xaml.cs

示例14: SetFolding

        /// <summary>
        /// Determine whether or not highlighting can be
        /// suppported by a particular folding strategy.
        /// </summary>
        /// <param name="syntaxHighlighting"></param>
        public void SetFolding(IHighlightingDefinition syntaxHighlighting)
        {
            if (syntaxHighlighting == null)
              {
            this.mFoldingStrategy = null;
              }
              else
              {
            switch (syntaxHighlighting.Name)
            {
              case "XML":
              case "HTML":
            mFoldingStrategy = new XmlFoldingStrategy() { ShowAttributesWhenFolded = true };
            this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
            break;
              case "C#":
            this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(this.Options);
            mFoldingStrategy = new CSharpBraceFoldingStrategy();
            break;
              case "C++":
              case "PHP":
              case "Java":
            this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(this.Options);
            mFoldingStrategy = new CSharpBraceFoldingStrategy();
            break;
              case "VBNET":
            this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(this.Options);
            mFoldingStrategy = new VBNetFoldingStrategy();
            break;
              default:
            this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
            mFoldingStrategy = null;
            break;
            }

            if (mFoldingStrategy != null)
            {
              if (this.Document != null)
              {
            if (mFoldingManager == null)
              mFoldingManager = FoldingManager.Install(this.TextArea);

            this.mFoldingStrategy.UpdateFoldings(mFoldingManager, this.Document);
              }
              else
            this.mInstallFoldingManager = true;
            }
            else
            {
              if (mFoldingManager != null)
              {
            FoldingManager.Uninstall(mFoldingManager);
            mFoldingManager = null;
              }
            }
              }
        }
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:62,代码来源:EdiTextEditor_Folding.cs

示例15: TextEditorControl

        public TextEditorControl(string name, int index)
        {
            InitializeComponent();

            FileName = name;
            FileIndex = index;

            var foldingUpdateTimer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(2)};
            foldingUpdateTimer.Tick += FoldingUpdateTimerTick;
            foldingUpdateTimer.Start();

            if (File.Exists(@"Highlighter\CustomHighlighting.xshd"))
            {
                var fileStream = new FileStream(@"Highlighter\CustomHighlighting.xshd", FileMode.Open, FileAccess.Read);
                using (var reader = new XmlTextReader(fileStream))
                {
                    textEditor.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
                }
                fileStream.Close();
            }

            textEditor.TextArea.IndentationStrategy =
                new CSharpIndentationStrategy(textEditor.Options);
            _foldingStrategy = new BEFoldingStrategy();

            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;
                }
            }

            textEditor.Text = "# Welcome to lpSolver (Linear Programming Solver)!" + Environment.NewLine;
            textEditor.Text += "lpmodel ModelName" + FileIndex.ToString() + " \n{" + Environment.NewLine;
            textEditor.Text += string.Format("\t# TODO : Objectives {0}{0}", Environment.NewLine + "\t");

            textEditor.Text += "min 10*x + 20*y" + Environment.NewLine;
            textEditor.Text += "\tsubject to:" + Environment.NewLine;
            textEditor.Text += "\tx + y > 10;" + Environment.NewLine;
            textEditor.Text += "\t0<x;" + Environment.NewLine;
            textEditor.Text += "\t0<y;" + Environment.NewLine;
            textEditor.Text += Environment.NewLine + "\t";
            textEditor.Text += Environment.NewLine;
            textEditor.Text += "};" + Environment.NewLine;
            textEditor.Text += "# __EOF" + Environment.NewLine;

            textEditor.ShowLineNumbers = true;
            FileUrl = string.Empty;
        }
开发者ID:taesiri,项目名称:lpSolver,代码行数:57,代码来源:TextEditorControl.xaml.cs


注:本文中的ICSharpCode.AvalonEdit.Folding.FoldingManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。