45 using System.Collections.Generic;
108 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.FrameObjectDictionary");
112 Logger.Instance.LogFunctionEndDebug();
115 #endregion Constructors
156 object lvo_Return = null;
158 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.GetParentObjectByName",
"fpsFunctionalnameOfWindow", fpsParentObject);
161 Logger.Instance.
LogPrintDebug(this.LM.GetMessage(
"GetParentObjectByName",
"M1", fpsParentObject));
162 if (this.__FrameObjectDictionary.ContainsKey(fpsParentObject))
166 lvo_Return = this.__FrameObjectDictionary[fpsParentObject];
172 string lvsMessage = this.LM.GetMessage(
"GetParentObjectByName",
"OKWFrameObjectParentNotFoundException", fpsParentObject);
176 Logger.Instance.LogFunctionEndDebug();
211 object lvo_Return = null;
212 string lvs_ObjectName = fps_ParentObject +
"." + fps_ChildObject;
214 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.GetChildObjectByName",
"fps_ParentObject", fps_ParentObject,
"fps_ChildObject", fps_ChildObject);
217 Logger.Instance.
LogPrintDebug(this.LM.GetMessage(
"GetChildObjectByName",
"M1", fps_ChildObject, fps_ParentObject));
219 if (this.__FrameObjectDictionary.ContainsKey(lvs_ObjectName)) {
223 lvo_Return = this.__FrameObjectDictionary[lvs_ObjectName];
229 string lvsMessage = this.LM.GetMessage(
"GetChildObjectByName",
"OKWFrameObjectChildNotFoundException", lvs_ObjectName );
233 Logger.Instance.LogFunctionEndDebug();
256 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.Init");
262 Logger.Instance.
LogPrint(this.LM.GetMessage(
"Init",
"InitClear",
this.GetType().Name));
263 this.__FrameObjectDictionary.Clear();
269 Logger.Instance.LogFunctionEndDebug();
297 string @
namespace = "
OKW.Frames";
298 var lvLsReturn =
new List<Type>();
302 Assembly[] appAssemblies = AppDomain.CurrentDomain.GetAssemblies();
304 for (
int i = 0; i < appAssemblies.Length; i++) {
305 Logger.Instance.
LogPrint(
"-------------------------------------------------------------------------------------------");
306 Logger.Instance.
LogPrint(
string.Format(
"Assambly {0}: {1}\n", i, appAssemblies[i].FullName));
307 Logger.Instance.
LogPrint(
"-------------------------------------------------------------------------------------------");
309 Assembly myAssembly = appAssemblies[i];
310 myTypes = myAssembly.GetTypes();
312 var q = from t in myTypes
313 where t.IsClass && t.Namespace == @
namespace
316 foreach (Type t
in q) {
343 object lvTypeInstanceAsObject = null;
345 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.AddFrameInstancesToDictionary");
349 foreach (Type lvOKWGuiClass
in fpListOfOKWGuiTypes) {
356 if (!
string.IsNullOrEmpty(lvFunktionalname)) {
357 string lvsKey = lvFunktionalname;
358 System.Console.WriteLine(
"\n Window Frame: >>" + lvsKey +
"<<");
359 System.Console.WriteLine(
" Technisches Objekt: >>" + lvTypeInstanceAsObject.GetType().FullName +
"<<");
361 this.__FrameObjectDictionary.Add(lvFunktionalname, lvTypeInstanceAsObject);
363 Logger.Instance.
LogPrintDebug(this.LM.GetMessage(
"CreateInstanceByObjectName",
"InstanceWasCreated", lvTypeInstanceAsObject.GetType().FullName));
366 Scanfields(lvOKWGuiClass, lvTypeInstanceAsObject, lvFunktionalname);
370 Logger.Instance.LogFunctionEndDebug();
377 public void Scanfields(Type fpType,
object fpsWindowAsObject,
string fpsWindowName)
379 Type myType = fpType;
383 FieldInfo[] myFields = myType.GetFields(BindingFlags.Public | BindingFlags.Instance);
385 foreach (FieldInfo myField
in myFields) {
386 object[] myAttribute = myField.GetCustomAttributes(typeof(
OKWGUIAttribute),
false);
388 object lvoChildObjekt = fpsWindowAsObject.GetType().InvokeMember(
390 BindingFlags.GetField,
395 if (myAttribute.Length > 0) {
399 string lvsKey = fpsWindowName +
"." + myOKWGUI.FunctionalName;
400 System.Console.WriteLine(
"\n Child: >>" + lvsKey +
"<<");
401 System.Console.WriteLine(
" Technisches Objekt: >>" + lvoChildObjekt.GetType().FullName +
"<<");
403 __FrameObjectDictionary.Add(fpsWindowName +
"." + myOKWGUI.FunctionalName, lvoChildObjekt);
406 Scanfields(myField.FieldType, lvoChildObjekt, fpsWindowName);
408 Scanfields(myField.FieldType, lvoChildObjekt, fpsWindowName);
411 }
catch (Exception e) {
412 Console.WriteLine(
"Exception : {0}", e.Message);
423 string lvsReturn =
"";
425 Attribute[] attrs =
System.Attribute.GetCustomAttributes(fpObject.GetType());
428 foreach (
System.Attribute attr in attrs) {
430 OKWGUIAttribute a = (OKWGUIAttribute)attr;
431 lvsReturn = a.FunctionalName;
467 object lvo_Obj = null;
470 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.CreateInstanceByObjectName",
"fpParentClass", fpParentType.FullName);
473 lvo_Obj = Activator.CreateInstance(fpParentType, null);
475 Logger.Instance.
LogPrintDebug(this.LM.GetMessage(
"CreateInstanceByObjectName",
"InstanceWasCreated", lvo_Obj.GetType().FullName));
477 }
catch (TargetInvocationException e) {
485 Logger.Instance.LogFunctionEndDebug(lvo_Obj.GetType().FullName);
488 Logger.Instance.LogFunctionEndDebug();
521 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.CreateInstanceByObjectName",
"fps_ParentObject", fps_ParentObject,
"fps_ChildObject", fps_ChildObject);
523 object myParentObject = null;
524 object myChildObject = null;
533 if (myParentObject != null) {
547 Logger.Instance.LogFunctionEndDebug(myChildObject.GetType().FullName);
550 Logger.Instance.LogFunctionEndDebug();
554 return myChildObject;
578 object lvo_Return = null;
580 Logger.Instance.LogFunctionStartDebug(
"FrameObjectDictionary.GetChildObjectByName",
"fpo_ParentObject", fpo_ParentObject.ToString(),
"fps_ChildName", fps_ChildName);
583 FieldInfo fieldInfoObj = fpo_ParentObject.GetType().GetField(fps_ChildName);
586 Logger.Instance.
LogPrintDebug(this.LM.GetMessage(
"GetChildObjectByName",
"M1", fps_ChildName, fpo_ParentObject.GetType().Name));
587 if (fieldInfoObj == null) {
596 lvo_Return = fpo_ParentObject.GetType().InvokeMember(
598 BindingFlags.GetField,
604 Logger.Instance.LogFunctionEndDebug();
Attribute-Klasse OKWAttribute stellt für die Erstellung der GUIFrames aus den OKW-GUIKlassen zusätztl...
void LogPrint(string fps_Message)
LogPrint Function: Prints the values of expressions to the results file.
object GetChildObjectByName(object fpo_ParentObject, string fps_ChildName)
Holt sich einen öffentlichen Feld Wert über den Namen.
List< Type > GetListOfOKWGuiClasses()
Methode erstellt eine Liste alle OKWGUI-Rahmenklassen (frame class), die in der aktuell ausgeführten ...
object GetParentObjectByName(string fpsParentObject)
Die Methode liefert das Frame-Object des gegebenen Fensterobjektes zurück.
Verwaltet zentral die Frame-Klassen: Instanziert Frame-Klassen zu Frame-Objekten und liefert die Refe...
object __CreateInstanceByObjectName(string fps_ParentObject, string fps_ChildObject)
Erzeugt eine Instanz des OKW-Frame-Objekts.
object CreateInstanceByType(Type fpParentType)
Die Methode erzeugt eine Instanz der Rahmenklasse (frame class) mit dem in 'fps_ParentClassName' gege...
OKW.OKWFrameObjectChildNotFoundException wird ausgelöst, wenn die Frame-Definition eines Kind-Objekte...
Dictionary< string, object > __FrameObjectDictionary
Zentrale Liste, genauer Dictionary/Hash der aktuell benutzten Frame-Objekte.
LogMessenger liest Log-Meldungen sprachspezifisch für die im Konstruktor gegeben Klasse aus der Zugeh...
void LogPrintDebug(string fpsMessage)
Loggt eine Nachricht.
FrameObjectDictionary()
Konstuktor der Klasse. Es wird die Methode FrameObjectDictionary.Init() aufgerufen.
object GetChildObjectByName(string fps_ParentObject, string fps_ChildObject)
Die Methode liefert das Objekt des gegebenen Kindobjekttests zurück.
void Init()
Methode initialisiert diese Klasse.
void AddFrameInstancesToDictionary(List< Type > fpListOfOKWGuiTypes)
string GetFunktionlanameFromObjekt(object fpObject)
List dasAttribute Funktionalname das übergeben Objektes aus.