public Form1()
        {
            InitializeComponent();
            InitializeRichEditControl();

            string examplePath = CodeExampleDemoUtils.GetExamplePath("CodeExamples");

            Dictionary <string, FileInfo> examplesCS = CodeExampleDemoUtils.GatherExamplesFromProject(examplePath, ExampleLanguage.Csharp);
            Dictionary <string, FileInfo> examplesVB = CodeExampleDemoUtils.GatherExamplesFromProject(examplePath, ExampleLanguage.VB);

            DisableTabs(examplesCS.Count, examplesVB.Count);
            this.examples = CodeExampleDemoUtils.FindExamples(examplePath, examplesCS, examplesVB);
            ShowExamplesInTreeList(treeList1, examples);

            this.codeEditor        = new ExampleCodeEditor(richEditControlCS, richEditControlVB, richEditControlCSClass, richEditControlVBClass);
            CurrentExampleLanguage = CodeExampleDemoUtils.DetectExampleLanguage("SpreadsheetControl_API_Part03");
            this.evaluator         = new RichEditExampleEvaluatorByTimer();

            this.evaluator.QueryEvaluate             += OnExampleEvaluatorQueryEvaluate;
            this.evaluator.OnBeforeCompile           += evaluator_OnBeforeCompile;
            this.evaluator.OnAfterCompile            += evaluator_OnAfterCompile;
            this.xtraTabControl1.SelectedPageChanged += xtraTabControl1_SelectedPageChanged;

            ShowFirstExample("Data Validation Actions");
        }
コード例 #2
0
        protected virtual bool ValidateRegionName(string[] lines, ref string regionName)
        {
            int keepHashMark = 0; // "#example" if value is -1 or "example" if value will be 0

            string region      = lines[0];
            int    regionIndex = region.IndexOf(RegionHelperStartPattern);

            if (regionIndex == 0)
            {
                isHelper   = true;
                regionName = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(region.Substring(regionIndex + RegionHelperStartPattern.Length + keepHashMark));
            }

            if (regionIndex < 0)
            {
                isHelper    = false;
                regionIndex = region.IndexOf(RegionStartPattern);
                if (regionIndex < 0)
                {
                    regionName = String.Empty;
                    return(false);
                }
                regionName = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(region.Substring(regionIndex + RegionStartPattern.Length + keepHashMark));
            }
            return(true);
        }
コード例 #3
0
        private void InitializeSyntaxHighlightForVBClass(object sender, EventArgs e)
        {
            SyntaxHightlightInitializeHelper syntaxHightlightInitializator = new SyntaxHightlightInitializeHelper();

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

            DisableRichEditFeatures(codeEditorVbClass);
        }
コード例 #4
0
        protected CodeExample CreateRichEditExample(string exampleGroup, string regionName, string exampleCode)
        {
            CodeExample result = new CodeExample();

            SetExampleCode(exampleCode, result);
            result.RegionName             = regionName;
            result.HumanReadableGroupName = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(exampleGroup);
            return(result);
        }
        void OnNewExampleSelected(object sender, FocusedNodeChangedEventArgs e)
        {
            CodeExample newExample = (sender as TreeList).GetDataRecordByNode(e.Node) as CodeExample;
            CodeExample oldExample = (sender as TreeList).GetDataRecordByNode(e.OldNode) as CodeExample;

            if (newExample == null)
            {
                return;
            }

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

            codeExampleNameLbl.Text = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(newExample.RegionName) + " example";
            CodeEvaluationEventArgs args = new CodeEvaluationEventArgs();

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