FRXPageSettings.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using FastReport.Utils;
  3. namespace FastReport.Design.PageDesigners.Code
  4. {
  5. internal class FRXPageSettings
  6. {
  7. #region Fields
  8. private static bool FUseSpaces;
  9. private static bool enable;
  10. private static int FTabSize;
  11. #endregion
  12. #region Properties
  13. public static bool UseSpaces
  14. {
  15. get { return FUseSpaces; }
  16. set { FUseSpaces = value; }
  17. }
  18. public static bool Enable
  19. {
  20. get { return enable; }
  21. set { enable = value; }
  22. }
  23. public static int TabSize
  24. {
  25. get { return FTabSize; }
  26. set { FTabSize = value; }
  27. }
  28. #endregion
  29. #region Public Methods
  30. public static void SaveState()
  31. {
  32. XmlItem xi = Config.Root.FindItem("Designer").FindItem("FRXPage");
  33. xi.SetProp("UseSpaces", UseSpaces ? "1" : "0");
  34. xi.SetProp("Enable", Enable ? "1" : "0");
  35. xi.SetProp("TabSize", TabSize.ToString());
  36. }
  37. static FRXPageSettings()
  38. {
  39. XmlItem xi = Config.Root.FindItem("Designer").FindItem("FRXPage");
  40. UseSpaces = xi.GetProp("UseSpaces") != "0";
  41. Enable = xi.GetProp("Enable") == "1";
  42. string tabSize = xi.GetProp("TabSize");
  43. if (String.IsNullOrEmpty(tabSize))
  44. tabSize = "2";
  45. TabSize = int.Parse(tabSize);
  46. }
  47. #endregion
  48. }
  49. }