Page 1 of 1
Derivate StiMainMenuService
Posted: Tue Jan 15, 2008 5:02 am
by Jean-Philippe Roques
Hi,
I would like to create a StiMainMenuService derivate to override the InvokeReportNew method. I've created my derivated service, register it and disable original StiMainMenuService, but the designer don't use my derivate.
How can I force designer to use my own MainMenuService instead the original StiMainMenuService ?
Thanks,
Jean-Philippe
Derivate StiMainMenuService
Posted: Tue Jan 15, 2008 5:13 pm
by Vital
You need disable original service by this code:
Code: Select all
StiMainMenuService service = StiMainMenuService.GetService().ServiceEnabled = false;
After then you need add your own service with this code:
Code: Select all
StiConfig.Services.Add(new MyOwnService());
p.s. For also you can try use static event:
Thank you.
Derivate StiMainMenuService
Posted: Wed Jan 16, 2008 3:40 am
by Jean-Philippe Roques
I already do this :
Code: Select all
StiMainMenuService.GetService().ServiceEnabled = false;
StiConfig.Services.Add(new MyMainMenuService());
StiConfig.Save();
If after this code, I try to get MyMainMenuService by the code below it's returned null
Code: Select all
StiConfig.Services.GetService(typeof(MyMainMenuService))
But if i watch in Services collection, MyMainMenuService is in and StiMainMenuService is well disabled.
Also, If I launch designer after that and choose File > New report, 'InvokeReportNew' overriden method is not called
Derivate StiMainMenuService
Posted: Wed Jan 16, 2008 5:11 am
by Jean-Philippe Roques
Finally, I have tried to used CreatingReport and it works how i needed. I also see the savingReport event. With this two events , I can act on "File > New report" and "File > Save as" without derivate StiMainMenuService.
Thanks for helping,
Jean-Philippe