예제 #1
0
    public override void WriteHtml(System.Web.UI.HtmlTextWriter w)
    {
      /*
      //set code language
      if (Language == CompiledQuestion.LANGUAGE.CPP)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
      }
      else if (Language == CompiledQuestion.LANGUAGE.CS)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
      }
      else if (Language == CompiledQuestion.LANGUAGE.Delphi)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Delphi;
      }
      else if (Language == CompiledQuestion.LANGUAGE.Java)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Java;
      }
       * */

      //<div>
      w.AddAttribute(HtmlAttribute.Id, Name);
      w.AddAttribute(HtmlAttribute.Name, "advancedCompiledTest");
      w.AddStyleAttribute(HtmlStyleAttribute.Position, "absolute");
      HtmlSerializeHelper<HtmlCompiledTest>.WriteRootElementAttributes(w, this);
      w.RenderBeginTag(HtmlTag.Div);

      //var ls = LanguageToHighlight.ToString().ToLower();

      //<span name="BeforeCode">//there will be lector code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxBefore");
      w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxBefore.Height.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxBefore.Width.ToString());
      w.RenderBeginTag(HtmlTag.Span);
      //w.AddAttribute(HtmlAttribute.Class, ls);
      //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
      w.WriteFullBeginTag(string.Concat("pre><code"));
      w.Write((Control as AdvancedCompiledTest).TextBoxBefore.Text.HttpEncode());
      w.WriteFullBeginTag("/code></pre");
      w.RenderEndTag();
      //</span>

      //<textarea>//there will be user code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxUserCode");
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxUserCode.Width.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxUserCode.Height.ToString());
      w.RenderBeginTag(HtmlTextWriterTag.Textarea);
      w.RenderEndTag();
      //</textarea>

      //<span name="AfterCode">//there will be lector code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxAfter");
      w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxAfter.Height.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxAfter.Width.ToString());
      w.RenderBeginTag(HtmlTag.Span);
      //w.AddAttribute(HtmlAttribute.Class, ls);
      //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
      w.WriteFullBeginTag(string.Concat("pre><code"));
      w.Write((Control as AdvancedCompiledTest).TextBoxAfter.Text.HttpEncode());
      w.WriteFullBeginTag("/code></pre");
      w.RenderEndTag();
      //</span>

      w.RenderEndTag();
      //</div>
    }