Page 1 of 1

Changes to StiConfig.Services.GetService

Posted: Sun Aug 14, 2016 8:57 am
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

Re: Changes to StiConfig.Services.GetService

Posted: Mon Aug 15, 2016 10:20 am
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.

Re: Changes to StiConfig.Services.GetService

Posted: Mon Aug 15, 2016 10:26 am
by PJoyeux
Ok, but

Code: Select all

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

Cheers,
Pascal

Re: Changes to StiConfig.Services.GetService

Posted: Tue Aug 16, 2016 3:15 pm
by HighAley
Hello, Pascal.

Yes, this expression should return the same.

Thank you.