-
- IdanB-Forsight
- Posts: 12
- Joined:
Can i check if component is already registered at runtime ?
I have several components that use some custom control.
In every one of them i have on the CTOR a
RegisterComponent of the UserControl type it's depends on.
However if i have common control, it floods my logs with something like:
I'm in the process of cleaning up the log of any "false-positive" entries it may have.
I can i check at runtime whether I need to registerComponent or not ?
or prevent log entry in the case it's already registered...
In every one of them i have on the CTOR a
RegisterComponent of the UserControl type it's depends on.
However if i have common control, it floods my logs with something like:
Code: Select all
[NOESIS/E] /OverlayXaml_MessagesScreen;component/AssistantScreen.xaml(48,9): Component 'FSCommonUIControls.NS_SliderButtonUserControl.cSlideButtonUserControlView ()' already registeredI can i check at runtime whether I need to registerComponent or not ?
or prevent log entry in the case it's already registered...
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Can i check if component is already registered at runtime ?
You can use Noesis::Factory::IsComponentRegistered(...) for checking if a component is already registered.
Is it not possible for you to have a single function at application start where you register all your components?
Is it not possible for you to have a single function at application start where you register all your components?
-
- IdanB-Forsight
- Posts: 12
- Joined:
Re: Can i check if component is already registered at runtime ?
sadly i have different componenet that may (or mat not) be present,
and since each is idependent, i cannot perform it on begining.
Noesis::Factory::IsComponentRegistered isn't template.
How do i get from class name a Noesis::Symbol type ?
Do i have function for it ?
and since each is idependent, i cannot perform it on begining.
Noesis::Factory::IsComponentRegistered isn't template.
How do i get from class name a Noesis::Symbol type ?
Do i have function for it ?
Re: Can i check if component is already registered at runtime ?
If you have the Type, you can use GetTypeId().
If you only have a string, Symbol provides an explicit constructor that accepts a string:
If you only have a string, Symbol provides an explicit constructor that accepts a string:
Code: Select all
class Symbol
{
public:
Symbol();
explicit Symbol(const char* str);
-
- IdanB-Forsight
- Posts: 12
- Joined:
Re: Can i check if component is already registered at runtime ?
I have the C++ type.
How do I get from it the Noesis Type class wrapper ?
How do I get from it the Noesis Type class wrapper ?
Re: Can i check if component is already registered at runtime ?
If you have the type you can do:
If you have the instance you can do:
Code: Select all
const Type* type = TypeOf<Button>();
Symbol id = type->GetTypeId();
Code: Select all
Button* button;
const Type* type = button->GetClassType();
Symbol id = type->GetTypeId();
Who is online
Users browsing this forum: No registered users and 8 guests