H
Haumersen
Thanks for taking time to read this question.
A little background:
I have implement a custom control called InTextLabel that inherits
Windows.Forms.Label. The InTextLabel is a control that will display
international text. The international text that is displayed comes
from a SQL database. The InTextLabel contains a property called
TranslationId which is passed to a singleton manager when the
InTextLabel asks for its text to display. An event is fired when an
operator changes languages and the InTextLabel queries a singleton
manager for its text.
This all was working great, then I decided to take it another step
further:
I needed to allow different applications to have controls with
duplicate TranslationIds but have different text associated with
them. In order to accomplish this I added an ApplicationId attribute
to my database table. Again everything was working good when I
hardcoded the application id in my singleton manager. To be effective
though, I need to have this application id be entered by a developer
in the development environment to avoid custom building the singleton
manager specifically for each application. Both the controls and the
singleton manager reside in their own dll.
Currently my solution is to have the developer enter an application id
and translation id in each control, which works but will be prone to
human error while entering an application id.
I have already tried adding a component to my singleton manager dll
that I could modify a property on called applicationid but it seems
like the development environment is instantiating a singleton manager
before the component is available in the editor. The development
environment is actually instantiating my InTextLabel control which
call the instance method of the singleton manager, therefore creating
a singleton manager and the property I change seems to be ignored.
I thought about a resource string but I need to know the namespace of
the application in my singleton manager at development time so that
wont work. I thought about using reflection for the application name
as the application id but the application name during development time
is not the compiled application's name.
Does anyone have any thoughts to help me avoid having a developer
enter the same application id ( just a unique id ) for every control
in the application?
Thanks for your help.
A little background:
I have implement a custom control called InTextLabel that inherits
Windows.Forms.Label. The InTextLabel is a control that will display
international text. The international text that is displayed comes
from a SQL database. The InTextLabel contains a property called
TranslationId which is passed to a singleton manager when the
InTextLabel asks for its text to display. An event is fired when an
operator changes languages and the InTextLabel queries a singleton
manager for its text.
This all was working great, then I decided to take it another step
further:
I needed to allow different applications to have controls with
duplicate TranslationIds but have different text associated with
them. In order to accomplish this I added an ApplicationId attribute
to my database table. Again everything was working good when I
hardcoded the application id in my singleton manager. To be effective
though, I need to have this application id be entered by a developer
in the development environment to avoid custom building the singleton
manager specifically for each application. Both the controls and the
singleton manager reside in their own dll.
Currently my solution is to have the developer enter an application id
and translation id in each control, which works but will be prone to
human error while entering an application id.
I have already tried adding a component to my singleton manager dll
that I could modify a property on called applicationid but it seems
like the development environment is instantiating a singleton manager
before the component is available in the editor. The development
environment is actually instantiating my InTextLabel control which
call the instance method of the singleton manager, therefore creating
a singleton manager and the property I change seems to be ignored.
I thought about a resource string but I need to know the namespace of
the application in my singleton manager at development time so that
wont work. I thought about using reflection for the application name
as the application id but the application name during development time
is not the compiled application's name.
Does anyone have any thoughts to help me avoid having a developer
enter the same application id ( just a unique id ) for every control
in the application?
Thanks for your help.