HtmlConnectionShape.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace ClearSlideLibrary.HtmlController
  7. {
  8. class HtmlConnectionShape:HtmlPresentationElement
  9. {
  10. public HtmlConnectionShape(string id, int width, int height,
  11. int top, int left, bool invisible, bool animatable)
  12. {
  13. base.id = id;
  14. base.top = top;
  15. base.left = left;
  16. base.width = width;
  17. base.height = height;
  18. base.invisible = invisible;
  19. base.animatable = animatable;
  20. }
  21. public override string DrawElement()
  22. {
  23. StringBuilder connectionShapeBuilder = new StringBuilder();
  24. string style = invisible ? "DC0" : "DC1";
  25. //the object has animation.
  26. if (animatable)
  27. {
  28. connectionShapeBuilder.Append("<div id=\"" + id + "\" style=\"top:" + top.ToString() + "px;left:" + left.ToString() +
  29. "px;height:" + height.ToString() + "px;width:" + width.ToString() + "px;\">");
  30. connectionShapeBuilder.Append("<div class=\"" + style + "\" id=\"" + id + "c" + "\">");
  31. connectionShapeBuilder.Append("<img />");
  32. connectionShapeBuilder.Append("</div>");
  33. connectionShapeBuilder.Append("</div>");
  34. }
  35. else
  36. {
  37. connectionShapeBuilder.Append("<div id=\"" + id + "\" style=\"top:" + top.ToString() + "px;left:" + left.ToString() +
  38. "px;height:" + height.ToString() + "px;width:" + width.ToString() + "px;\">");
  39. connectionShapeBuilder.Append("<img/>");
  40. connectionShapeBuilder.Append("</div>");
  41. }
  42. return connectionShapeBuilder.ToString();
  43. }
  44. public override string ToString()
  45. {
  46. Console.WriteLine("The top is:" + top);
  47. Console.WriteLine("The left is:" + left);
  48. Console.WriteLine("The width is:" + width);
  49. Console.WriteLine("The height is:" + height);
  50. return string.Format("[{0}, {1}, {2}, {3}]", top, left, width, height);
  51. }
  52. }
  53. }