Changes to StiConfig.Services.GetService

Stimulsoft Reports.WPF discussion
Post Reply
User avatar
PJoyeux
Posts: 160
Joined: Tue Nov 26, 2013 9:40 am
Location: Germany

Changes to StiConfig.Services.GetService

Post by PJoyeux »

Hi,

this is to let you know, that between 2014.05.19 and 2016.1.21 the function "StiConfig.Services.GetService()" must have changed the way it works.

The following line of code which worked under 2014.05.19 now returns null:

Code: Select all

StiWpfMainMenuService objService = (StiWpfMainMenuService)StiConfig.Services.GetService(typeof(StiWpfMainMenuService));
I found a solution by using the following code:

Code: Select all

StiWpfMainMenuService objService = StiWpfMainMenuService.GetService();
Just wanted to let you know that, although the first line is still syntactically correct and compiles just fine, it does not seem to have the same semantic. If it is now obsolete, it should be marked as such...

Thanks.

Regards,
Pascal
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Changes to StiConfig.Services.GetService

Post by HighAley »

Hello.

There was a code refactoring. The StiConfig is not used any more.
The Services are at StiOptions.Services now. So next code should work.

Code: Select all

StiWpfMainMenuService objService = (StiWpfMainMenuService)StiOptions.Services.GetService(typeof(StiWpfMainMenuService));
Thank you.
User avatar
PJoyeux
Posts: 160
Joined: Tue Nov 26, 2013 9:40 am
Location: Germany

Re: Changes to StiConfig.Services.GetService

Post by PJoyeux »

Ok, but

Code: Select all

StiWpfMainMenuService objService = StiWpfMainMenuService.GetService();
returns the same as your solution, right?

Cheers,
Pascal
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Changes to StiConfig.Services.GetService

Post by HighAley »

Hello, Pascal.

Yes, this expression should return the same.

Thank you.
Post Reply