public string ShowExample(CodeExample oldExample, CodeExample newExample)
        {
            InnerRichEditControl richEditControlCs = codeEditorCs.InnerControl;
            InnerRichEditControl richEditControlVb = codeEditorVb.InnerControl;

            if (oldExample != null)
            {
                oldExample.CodeCS = richEditControlCs.Text;
                oldExample.CodeVB = richEditControlVb.Text;
            }
            string exampleCode = String.Empty;

            if (newExample != null)
            {
                try {
                    forceTextChangesCounter = 2;
                    exampleCode             = (CurrentExampleLanguage == ExampleLanguage.Csharp) ? newExample.CodeCS : newExample.CodeVB;
                    richEditControlCs.Text  = newExample.CodeCS;
                    richEditControlVb.Text  = newExample.CodeVB;

                    richEditTextChanged = false;
                }
                finally {
                    richEditTextChanged = true;
                }
            }
            return(exampleCode);
        }
Esempio n. 2
0
        static List <CodeExample> MergeExamples(List <CodeExample> findedExamplesCS, List <CodeExample> findedExamplesVB)
        {
            List <CodeExample> result = new List <CodeExample>();

            int count = findedExamplesCS.Count;

            for (int i = 0; i < count; i++)
            {
                CodeExample itemCS = findedExamplesCS[i];

                CodeExample itemVB = findedExamplesVB[i];
                if (itemCS.HumanReadableGroupName == itemVB.HumanReadableGroupName &&
                    itemCS.RegionName == itemVB.RegionName)
                {
                    CodeExample merged = new CodeExample();
                    merged.RegionName             = itemCS.RegionName;
                    merged.HumanReadableGroupName = itemCS.HumanReadableGroupName;
                    merged.CodeCS = itemCS.CodeCS;
                    merged.CodeVB = itemVB.CodeVB;
                    result.Add(merged);
                }
                else
                {
                    throw new InvalidOperationException();
                }
            }
            return(result);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
 protected override void SetExampleCode(string code, CodeExample newExample)
 {
     newExample.CodeCS = code;
 }
Esempio n. 5
0
 protected abstract void SetExampleCode(string exampleCode, CodeExample newExample);