void InitializeSyntaxHighlightForVb(object sender, EventArgs e)
        {
            SyntaxHightlightInitializeHelper syntaxHightlightInitializator = new SyntaxHightlightInitializeHelper();

            syntaxHightlightInitializator.Initialize(codeEditorVb, CodeExampleDemoUtils.GetCodeExampleFileExtension(ExampleLanguage.VB));

            DisableRichEditFeatures(codeEditorVb);
        }
Beispiel #2
0
        protected CodeExample CreateSpreadsheetExample(string exampleGroup, string regionName, string exampleCode)
        {
            CodeExample result = new CodeExample();

            SetExampleCode(exampleCode, result);
            result.RegionName             = regionName;
            result.HumanReadableGroupName = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(exampleGroup);
            return(result);
        }
Beispiel #3
0
        protected virtual bool ValidateRegionName(string[] lines, ref string regionName)
        {
            string region      = lines[0];
            int    regionIndex = region.IndexOf(RegionStarts);

            if (regionIndex < 0)
            {
                regionName = String.Empty;
                return(false);
            }

            int keepHashMark = 0;

            regionName = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(region.Substring(regionIndex + RegionStarts.Length + keepHashMark));
            return(true);
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();
            string examplePath = "CodeExamples";
            Dictionary <string, FileInfo> examplesCS = CodeExampleDemoUtils.GatherExamplesFromProject(examplePath, ExampleLanguage.Csharp);
            Dictionary <string, FileInfo> examplesVB = CodeExampleDemoUtils.GatherExamplesFromProject(examplePath, ExampleLanguage.VB);

            DisableTabs(examplesCS.Count, examplesVB.Count);
            List <CodeExampleGroup> examples = CodeExampleDemoUtils.FindExamples(examplePath, examplesCS, examplesVB);

            RearrangeExamples(examples);
            ShowExamplesInTreeList(treeList1, examples);

            richEditControlCS.Loaded += richEditControlCS_Loaded;
            richEditControlVB.Loaded += richEditControlVB_Loaded;
            CurrentExampleLanguage    = CodeExampleDemoUtils.DetectExampleLanguage("SpreadsheetWPFPivotTableExamples");
            this.evaluator            = new SpreadsheetExampleEvaluatorByTimer();

            this.evaluator.QueryEvaluate   += OnExampleEvaluatorQueryEvaluate;
            this.evaluator.OnBeforeCompile += evaluator_OnBeforeCompile;
            this.evaluator.OnAfterCompile  += evaluator_OnAfterCompile;
        }
Beispiel #5
0
        private void OnNewExampleSelected(object sender, CurrentItemChangedEventArgs e)
        {
            CodeExample newExample = e.NewItem as CodeExample;
            CodeExample oldExample = e.OldItem as CodeExample;

            if (newExample == null)
            {
                return;
            }

            if (codeEditor == null)
            {
                return;
            }

            string exampleCode = codeEditor.ShowExample(oldExample, newExample);

            codeExampleNameLbl.Content = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(newExample.RegionName) + " example";

            CodeEvaluationEventArgs args = new CodeEvaluationEventArgs();

            InitializeCodeEvaluationEventArgs(args);
            evaluator.ForceCompile(args);
        }
Beispiel #6
0
 protected override string[] DeleteLeadingWhiteSpacesFromSourceCode(string[] lines)
 {
     string[] result = base.DeleteLeadingWhiteSpacesFromSourceCode(lines);
     return(CodeExampleDemoUtils.DeleteLeadingWhiteSpaces(result, "\t\t\t"));
 }
Beispiel #7
0
 protected virtual string[] DeleteLeadingWhiteSpacesFromSourceCode(string[] lines)
 {
     return(CodeExampleDemoUtils.DeleteLeadingWhiteSpaces(lines, "            "));
 }