G
Guest
Hi,
I have a BaseClass-DerivedClass Instance-Issue.
Classes: (Framework)
Stegosoft.Settings.SerializationClass
Stegosoft.Stegosuite.Common.UIStrings (Inherits
Stegosoft.Settings.SerializationClass)
Stegosoft.Windows.Forms.UIForm
Stegosoft.Windows.Forms.UIFormWithCommandManager (Inherits
Stegosoft.Windows.Forms.UIForm)
And many more Derived forms
Application:
References all assemblies
Has forms derived from UIForm, UIFormWithCommandManager, UIF.....
At start-up the Application creates a new Instance of UIStrings. (Friend
scope mUIStrings)
The properties are serialized and remain unchanged for the rest of the
Apps-Life.
UIForm and UIFormWithCommandManager use Properties of UIString (the
Application itself too).
Now the Issue:
SerializationClass has some Shared Methods
Every time a form gets instanciated, it creates an instance of UIStrings
Since SerializationClass has some Shared Methods, the class doesn't get
disposed at the end of the Form's lifecycle.
Besides that, all properties of every instance are the same, so I don't need
new instances.
So basically: my BaseForm needs to use the Instance of a Class which is
instanciated in a derived class or a containg application.
I could pass the Instance through the BaseForms' constructor or a property,
but I don't want to do that.
Isn't there another way to acchieve this?
TIA,
Michael
I have a BaseClass-DerivedClass Instance-Issue.
Classes: (Framework)
Stegosoft.Settings.SerializationClass
Stegosoft.Stegosuite.Common.UIStrings (Inherits
Stegosoft.Settings.SerializationClass)
Stegosoft.Windows.Forms.UIForm
Stegosoft.Windows.Forms.UIFormWithCommandManager (Inherits
Stegosoft.Windows.Forms.UIForm)
And many more Derived forms
Application:
References all assemblies
Has forms derived from UIForm, UIFormWithCommandManager, UIF.....
At start-up the Application creates a new Instance of UIStrings. (Friend
scope mUIStrings)
The properties are serialized and remain unchanged for the rest of the
Apps-Life.
UIForm and UIFormWithCommandManager use Properties of UIString (the
Application itself too).
Now the Issue:
SerializationClass has some Shared Methods
Every time a form gets instanciated, it creates an instance of UIStrings
Since SerializationClass has some Shared Methods, the class doesn't get
disposed at the end of the Form's lifecycle.
Besides that, all properties of every instance are the same, so I don't need
new instances.
So basically: my BaseForm needs to use the Instance of a Class which is
instanciated in a derived class or a containg application.
I could pass the Instance through the BaseForms' constructor or a property,
but I don't want to do that.
Isn't there another way to acchieve this?
TIA,
Michael