示例#1
0
        public override IEnumerable <NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset)
        {
            // clear existing foldings
            BraceFoldingStrategy bfs         = new BraceFoldingStrategy();
            List <NewFolding>    newFoldings = new List <NewFolding>(bfs.CreateNewFoldings(document, out firstErrorOffset));

            newFoldings      = GetFoldingRanges(document, newFoldings);
            firstErrorOffset = lastDetectedError;
            return(newFoldings);
        }
示例#2
0
        public override IEnumerable <NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset)
        {
            Logger.LogM("CSharpPragmaRegionFoldingStrategy", ".CreateNewFoldings(TextDocument,out int)");
            // clear existing foldings
            BraceFoldingStrategy bfs         = new BraceFoldingStrategy();
            List <NewFolding>    newFoldings = new List <NewFolding>(bfs.CreateNewFoldings(document, out firstErrorOffset));

            GetFoldingRanges(document, newFoldings);
            firstErrorOffset = lastDetectedError;
            return(newFoldings);
        }
        public MainWindow()
        {


            InitializeComponent();

            MainWindowViewModel.TempDir = Path.Combine(Path.GetTempPath(), "SharpNative");

            if (!Directory.Exists(MainWindowViewModel.TempDir))
            {
                Directory.CreateDirectory(MainWindowViewModel.TempDir);
            }


            //            Dispatcher.Invoke(() => Console.SetOut(new ControlWriter(Errors)));

            CompilerUtils.DeleteFilesByWildcards("Test*.exe", MainWindowViewModel.TempDir);

            ViewModel.Window = this;


            TextEditor.Text = ViewModel.SourceCode;
            TextEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering;
            TextEditor.TextArea.TextEntered += textEditor_TextArea_TextEntered;
            TextEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(TextEditor.Options);
            foldingStrategy = new BraceFoldingStrategy();

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


            if (foldingManager == null)
                foldingManager = FoldingManager.Install(TextEditor.TextArea);
            foldingStrategy.CreateNewFoldings(TextEditor.Document);

            TextEditor.Text = VisualCompilerConstants.InitialCode;
            CppFileList.SelectionChanged += (sender, args) =>
            {
                var list = (ListBox) sender;

                if (list.SelectedItem == null) 
                    return;
                
                var fileItem = (FileItem) list.SelectedItem;
				Output.Text = FileExtensions.ReadFile(fileItem.Location);
            };

        }