using System; using System.Threading; using System.Threading.Tasks; namespace FastReport.Web { public class DesignerSettings { public static DesignerSettings Default => new DesignerSettings(); /// /// Gets or sets the locale of Designer /// public string Locale { get; set; } = ""; /// /// Enable code editor in the Report Designer /// public bool ScriptCode { get; set; } = false; /// /// Gets or sets the text of configuration of Online Designer /// public string Config { get; set; } = ""; /// /// Gets or sets path to the Report Designer /// public string Path { get; set; } = "/WebReportDesigner/index.html"; /// /// Callback method for saving an edited report by Online Designer /// Params: reportID, report file name, report, out - message /// /// /// /// webReport.Designer.SaveMethod = (string reportID, string filename, string report) => /// { /// string webRootPath = _hostingEnvironment.WebRootPath; /// string pathToSave = Path.Combine(webRootPath, filename); /// System.IO.File.WriteAllText(pathToSave, report); /// /// return "OK"; /// }; /// /// public Func SaveMethod { get; set; } /// /// Async callback method for saving an edited report by Online Designer /// /// ///webReport.Designer.SaveMethodAsync = async (reportID, filename, report, token) => ///{ /// string webRootPath = _hostingEnvironment.WebRootPath; /// /// string pathToSave = Path.Combine(webRootPath, "DesignedReports", "AsyncReports", filename); /// if (!Directory.Exists(pathToSave)) /// Directory.CreateDirectory(Path.GetDirectoryName(pathToSave)); /// /// await System.IO.File.WriteAllTextAsync(pathToSave, report, token); /// return "OK"; ///}; /// /// /// public Func> SaveMethodAsync { get; set; } /// /// Gets or sets path to a folder for save designed reports /// If value is empty then designer posts saved report in variable ReportFile on call the DesignerSaveCallBack // TODO /// public string SavePath { get; set; } = ""; /// /// Gets or sets path to callback page after Save from Designer /// [Obsolete("Designer.SaveCallBack is obsolete, please use Designer.SaveMethod instead.")] public string SaveCallBack { get; set; } = ""; } }