protected CodeExample CreateSchedulerExample(string exampleGroup, string regionName, string exampleCode)
        {
            CodeExample result = new CodeExample();

            SetExampleCode(exampleCode, result);
            result.RegionName             = regionName;
            result.HumanReadableGroupName = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(exampleGroup);
            return(result);
        }
 protected override void SetExampleCode(string code, CodeExample newExample)
 {
     if (isHelper)
     {
         newExample.CodeCsHelper = code;
     }
     else
     {
         newExample.CodeCS = code;
     }
 }
Exemplo n.º 3
0
        void treeList_VirtualTreeGetCellValue(object sender, VirtualTreeGetCellValueInfo args)
        {
            CodeExampleGroup group = args.Node as CodeExampleGroup;

            if (group != null)
            {
                args.CellData = group.Name;
            }

            CodeExample example = args.Node as CodeExample;

            if (example != null)
            {
                args.CellData = example.RegionName;
            }
        }
Exemplo n.º 4
0
        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);
        }
        public string ShowExample(CodeExample oldExample, CodeExample newExample)
        {
            InnerRichEditControl richEditControlCs      = codeEditorCs.InnerControl;
            InnerRichEditControl richEditControlVb      = codeEditorVb.InnerControl;
            InnerRichEditControl richEditControlCsClass = codeEditorCsClass.InnerControl;
            InnerRichEditControl richEditControlVbClass = codeEditorVbClass.InnerControl;

            if (oldExample != null)
            {
                //save edited example
                oldExample.CodeCS       = richEditControlCs.Text;
                oldExample.CodeVB       = richEditControlVb.Text;
                oldExample.CodeCsHelper = richEditControlCsClass.Text;
                oldExample.CodeVbHelper = richEditControlVbClass.Text;
            }
            string exampleCode = String.Empty;

            if (newExample != null)
            {
                try
                {
                    forceTextChangesCounter     = 4;
                    exampleCode                 = (CurrentExampleLanguage == ExampleLanguage.Csharp) ? newExample.CodeCS : newExample.CodeVB;
                    richEditControlCs.Text      = newExample.CodeCS;
                    richEditControlVb.Text      = newExample.CodeVB;
                    richEditControlCsClass.Text = newExample.CodeCsHelper;
                    richEditControlVbClass.Text = newExample.CodeVbHelper;

                    richEditTextChanged = false;
                }
                finally
                {
                    richEditTextChanged = true;
                }
            }
            return(exampleCode);
        }
 protected abstract void SetExampleCode(string exampleCode, CodeExample newExample);