How to switch interface language of DesignerControl by code

Stimulsoft Reports.NET discussion
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

How to switch interface language of DesignerControl by code

Post by Fabio Pagano »

Same error.

This is the code:

Code: Select all

Dim MainMenuService As Stimulsoft.Report.Design.StiMainMenuService = Stimulsoft.Report.Design.StiMainMenuService.GetService

Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = AppDomain.CurrentDomain.BaseDirectory

        MainMenuService.SetLocalization("it.xml")
Note: I have changed your code from

Code: Select all

Dim designer As New StiDesigner
    Dim MainMenuService As StiMainMenuService = StiMainMenuService.GetService(designer)
to

Code: Select all

Dim MainMenuService As Stimulsoft.Report.Design.StiMainMenuService = Stimulsoft.Report.Design.StiMainMenuService.GetService
because with your code the following settings:

Code: Select all

MainMenuService.ShowFileReportNew = True
doens't work. With your code the error appeared anyway.

Note that i do the "report.load" before localization code (in your example it is after). I've postponed the two but the problem still exists.

That said, if in my application path i create a subdir called "Localization" and put "it.xml" file in it and i don't execute:

Code: Select all

Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = AppDomain.CurrentDomain.BaseDirectory

        MainMenuService.SetLocalization("it.xml")
in designer's "File / Select UI Language" i correctly see "Default" and "Italian" ("Default" is selected).

If i execute only

Code: Select all

Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = AppDomain.CurrentDomain.BaseDirectory

i only see "Default" (though in AppDomain.CurrentDomain.BaseDirectory i have the "it.xml" file).

May this be the problem that causes the error in line
MainMenuService.SetLocalization("it.xml")
?

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to switch interface language of DesignerControl by code

Post by Edward »

If you've created a folder Localization in you Directory, then the following code is enough for localization, hiding ReportNew button in the Designer and loading the report:

Code: Select all

Dim Report = New StiReport()
Report.Load("Report.mrt")

Dim MainMenuService As Stimulsoft.Report.Design.StiMainMenuService = StiMainMenuService.GetService()
MainMenuService.ShowFileReportNew = False

Dim designer As New StiDesigner()
MainMenuService = StiMainMenuService.GetService(designer)

        'this line is not necessary if you've created Localization folder
        'Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = My.Application.Info.DirectoryPath

MainMenuService.SetLocalization("it.xml")

designer.Report = report

designer.Show()

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

How to switch interface language of DesignerControl by code

Post by Fabio Pagano »

My problem is that i don't want to put the "it.xml" in "Localization" application subdir (that was only a test).

I need that localization file is in the application directory.

As above said, this code (taken by your previous post) raises an error:

Code: Select all

Dim designer As New Stimulsoft.Report.Design.StiDesigner
        MainMenuService = Stimulsoft.Report.Design.StiMainMenuService.GetService(designer)
        Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = My.Application.Info.DirectoryPath
        MainMenuService.SetLocalization("it.xml")
Note: i need to set the "DirectoryLocalization" property because "it.xml" file is not in "Localization" subdir.

The error is thrown by "SetLocalization" method and is:

Value cannot be null.
Parameter name: control

Stack trace (beginning):

System.ArgumentNullException was unhandled
Message="Value cannot be null.
Parameter name: control"
ParamName="control"
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.ToolTip.SetToolTipInternal(Control control, TipInfo info)
at System.Windows.Forms.ToolTip.SetToolTip(Control control, String caption)
at Stimulsoft.Report.Design.Toolbars.StiStandardToolbarService.Localize()
at Stimulsoft.Report.Design.StiDesigner.LocalizeToolbars()
at Stimulsoft.Report.Design.StiDesigner.LocalizeDesigner()
at Stimulsoft.Report.Design.StiMainMenuService.UpdateLocalization()
at Stimulsoft.Report.Design.StiMainMenuService.SetLocalization(String localizationFile)

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to switch interface language of DesignerControl by code

Post by Edward »

Sorry, we can't reproduce the exception on our side. The code

Code: Select all

Dim designer As New Stimulsoft.Report.Design.StiDesigner
        MainMenuService = Stimulsoft.Report.Design.StiMainMenuService.GetService(designer)
        Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = My.Application.Info.DirectoryPath
        MainMenuService.SetLocalization("it.xml")
working without exception ...

Please send test solution to Image if exception is still present in your project.

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to switch interface language of DesignerControl by code

Post by Edward »

All that you should to do to avoid an exception is to add to your project all dlls in to the ReferenciedAssemblies. After that Stimulsoft.Editor.dll and Stimulsoft.Compression.dll will be added to bin\debug folder and exception will disappear.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

How to switch interface language of DesignerControl by code

Post by Fabio Pagano »

I've sent you a message in ticket #210352.
joero
Posts: 3
Joined: Fri Aug 17, 2007 6:40 am

How to switch interface language of DesignerControl by code

Post by joero »

We have exactly the same problem here. So I'm also interested in the outcome of this bug report.

Referencing both Stimulsoft.Editor and Stimulsoft.Compression didn't fix this problem.

Thanks,
Jörg
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

How to switch interface language of DesignerControl by code

Post by Fabio Pagano »

Joero, for your convenience i post here the private message sent in the ticket. The problem is actually under examination by Stimulsoft.

---

I have solved, but in another way.

First i deleted dll from gac as you told me. Then i rebuilded the project and executed it from \bin dir. The problem was still there. Then i downloaded 29 august build, did not registered in gac but the problem was still there.

Then i deleted configuration files from C:\Documents and Settings\MyUserName\Local settings\Application data\Stimulsoft (DockingPanels.config, Stimulsoft.Report.Config, Stimulsoft.Report.Design.Config, Stimulsoft.Report.Settings) and the problem disappeared.

Probably in my tests i did something that "corrupted" those files.

But i've investigated more. In the sample project i sent you, if i add the lines:
----
MainMenuService = Stimulsoft.Report.Design.StiMainMenuService.GetService

MainMenuService.ShowSelectLanguage = False
----

a nullreference exception appears.

It seems that if the ShowSelectLanguage menu is not visible, then the "SetLocalization" method fails. (Just supposing...).

If i remove the line:

MainMenuService.ShowSelectLanguage = False

the error disappears.

My necessity is to set the Italian language (setting the "it.xml" file present in application dir) and do not make see in the designer the "select language" menu (i only need Italian).

Thanks
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to switch interface language of DesignerControl by code

Post by Edward »

Thank you for describing this issue.

The problem is fixed. Patch will be available in the official release version 2007.2.

Thank you.
joero
Posts: 3
Joined: Fri Aug 17, 2007 6:40 am

How to switch interface language of DesignerControl by code

Post by joero »

Thanks Fabio and Edward!

I'm looking forward to this release.
Post Reply