Using Localizations in the DesignerFx

This sample project shows how to localize the flahs designer and add localization options to the toolbar. To select localization is enough to set the path to the localization XML file as the value of the Localization option. To add locatization options to the toolbar of the flash designer is enough to set the path to the localization XML files directory.

First, you need to add the StiMvcDesignerFx component to the view page. Also you need to pass the object of the StiMvcDesignerFxOptions type to the constructor. The minimum required options are two actions - GetReport and DesignerEvent, which are located in the Actions options group. It is desirable to define the PreviewReport action, which is necessary to preview the report.

@using Stimulsoft.Report.Mvc;

...

@Html.Stimulsoft().StiMvcDesignerFx(new StiMvcDesignerFxOptions()
{
Actions =
{
GetReport = "GetReport",
PreviewReport = "PreviewReport",
DesignerEvent = "DesignerEvent"
},

// Necessary to get a list of available localization files
LocalizationDirectory = Server.MapPath("~/Content/Localizations"),

Localization = Server.MapPath("~/Content/Localizations/de.xml")
})


In the options above we define several actions, and we need to add it in the controller.

The GetReport action loads the report template and returns answer to the client part of the flash designer using the GetReportResult() static method. In the parameters of this method, the report object should be passed.

public ActionResult GetReport()
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt"));

return StiMvcDesignerFx.GetReportResult(report);
}


The PreviewReport action will be invoked when you open the preview report tab in the flash designer. In this action, you can get the report object and perform any action, for example connect to data. To prepare the answer for the client you should use the PreviewReportResult() static method. In the parameters of this method, the report object should be passed.

public ActionResult PreviewReport()
{
DataSet data = new DataSet("Demo");
data.ReadXml(Server.MapPath("~/Content/Data/Demo.xml"));

StiReport report = StiMvcDesignerFx.GetReportObject();
report.RegData(data);

return StiMvcDesignerFx.PreviewReportResult(report);
}


The DesignerEvent action handles some flash designer events (work with the data dictionary, get report template code and component images, etc.) and returns the answer to the client using the DesignerEventResult() static method.

public ActionResult DesignerEvent()
{
return StiMvcDesignerFx.DesignerEventResult();
}


Using Localizations in the DesignerFx