public string ShowExample(CodeExample oldExample, CodeExample newExample) { InnerRichEditControl richEditControlCs = codeEditorCs.InnerControl; InnerRichEditControl richEditControlVb = codeEditorVb.InnerControl; if (oldExample != null) { //save edited example 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); }
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); }
protected abstract void SetExampleCode(string exampleCode, CodeExample newExample);
protected override void SetExampleCode(string code, CodeExample newExample) { newExample.CodeCS = code; }