OpenKeyWord  Version: 426, Datum:
CurrentObject.cs
1 #region Header
2 /*
3  ==============================================================================
4  Author: Zoltan Hrabovszki <zh@openkeyword.de>
5 
6  Copyright © 2012, 2013, 2014, 2015 IT-Beratung Hrabovszki
7  www.OpenKeyWord.de
8  ==============================================================================
9 
10  This file is part of OpenKeyWord.
11 
12  OpenKeyWord is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  OpenKeyWord is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with OpenKeyWord. If not, see <http://www.gnu.org/licenses/>.
24 
25  Diese Datei ist Teil von OpenKeyWord.
26 
27  OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen
28  der GNU General Public License, wie von der Free Software Foundation,
29  Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
30  veröffentlichten Version, weiterverbreiten und/oder modifizieren.
31 
32  OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber
33  OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
34  Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
35  Siehe die GNU General Public License für weitere Details.
36 
37  Sie sollten eine Kopie der GNU General Public License zusammen mit
38  OpenKeyWord erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
39 */
40 #endregion Header
41 
42 namespace OKW
43 {
44  using System;
45  using System.Collections.Generic;
46  using System.Linq;
47  using System.Reflection;
48  using System.Text.RegularExpressions;
49 
50  using OKW;
51  using OKW.Log;
52 
75  public class CurrentObject : OKWSingeltonBase<CurrentObject>
76  {
77  #region Fields
78 
92  protected string cvsChildName = string.Empty;
93 
105  protected string cvsWindowName = string.Empty;
106 
116  //private static readonly CurrentObject instance = new CurrentObject();
117 
129  private object cvoObject = null;
130 
144  private string cvsObjectFunctionalName = string.Empty;
145 
159  private string cvsObjectName = string.Empty;
160 
176  private LogMessenger LM = null;
177 
188  private Logger Log = Logger.Instance;
189 
209 
210  #endregion Fields
211 
212  #region Constructors
213 
231  private CurrentObject()
232  {
233  this.LM = new LogMessenger(this.GetType().Name);
234  }
235 
236  #endregion Constructors
237 
238  #region Properties
239 
266  /*public static CurrentObject Instance
267  {
268  get
269  {
270  return instance;
271  }
272  }
273  */
274 
275  #endregion Properties
276 
277  #region Methods
278 
308  public void CallMethod(string fpsMethod)
309  {
310  this.Log.LogFunctionStartDebug("CallMethod", "string fpsMethod", fpsMethod);
311  try
312  {
313  Type myTypeObject = this.cvoObject.GetType();
314  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
315  BindingFlags.Public | BindingFlags.Instance,
316  null,
317  new Type[] {},
318  null);
319  // Existiert die Methode des Objektes?
320  if (myMethodInfo == null)
321  {
322  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
323  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
324  throw new OKWFrameObjectMethodNotFoundException(errorText);
325  }
326  else
327  {
328  // Ja, Methode via Invoke aufrufen
329  myMethodInfo.Invoke(this.cvoObject, null);
330  }
331  }
332  finally
333  {
334  this.Log.LogFunctionEndDebug();
335  }
336  return;
337  }
338 
370  public void CallMethod(string fpsMethod, List<string> fpLsParameter)
371  {
372  this.Log.LogFunctionStartDebug("CallMethod", "string fpsMethod", fpsMethod, "List<string> fplsParameter", fpLsParameter.ToString());
373  object[] lvoParameter = new object[1];
374  lvoParameter[0] = fpLsParameter;
375  try
376  {
377  Type myTypeObject = this.cvoObject.GetType();
378  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
379  BindingFlags.Public | BindingFlags.Instance,
380  null,
381  new Type[] { typeof(List<string>) },
382  null);
383  // Existiert die Methode des Objektes?
384  if (myMethodInfo == null)
385  {
386  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
387  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
388  throw new OKWFrameObjectMethodNotFoundException(errorText);
389  }
390  else
391  {
392  // Ja, Methode via Invoke aufrufen
393  myMethodInfo.Invoke(this.cvoObject, lvoParameter);
394  }
395  }
396  finally
397  {
398  this.Log.LogFunctionEndDebug();
399  }
400 
401  return;
402  }
403 
438  public void CallMethod(string fpsMethod, List<string> fpLsParameter_1, string fpsParameter_2)
439  {
440  this.Log.LogFunctionStartDebug("CallMethod", "string fpsMethod", fpsMethod, "List<string> fpLsParameter_1", fpLsParameter_1.ToString(), "string fpsParameter_2", fpsParameter_2);
441  object[] lvoParameter = new object[2];
442 
443  lvoParameter[0] = fpLsParameter_1; // Der letzte Parameter ist immer der zu übergebende Wert
444  lvoParameter[1] = fpsParameter_2; // Hier sind Kooerdinaten usw. zu finden
445  try
446  {
447  Type myTypeObject = this.cvoObject.GetType();
448  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
449  BindingFlags.Public | BindingFlags.Instance,
450  null,
451  new Type[] {typeof(List<string>), typeof(string)},
452  null);
453  // Existiert die Methode des Objektes?
454  if (myMethodInfo == null)
455  {
456  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
457  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
458  throw new OKWFrameObjectMethodNotFoundException(errorText);
459  }
460  else
461  {
462  // Ja: Methode via Invoke aufrufen
463  myMethodInfo.Invoke(this.cvoObject, lvoParameter);
464  }
465  }
466  finally
467  {
468  this.Log.LogFunctionEndDebug();
469  }
470 
471  return;
472  }
473 
503  public void CallMethod(string fpsMethod, string fpsParameter_1)
504  {
505  this.Log.LogFunctionStartDebug("CallMethod", "string fpsMethod", fpsMethod, "string fps_Parameter_1", fpsParameter_1);
506  object[] lvoParameter = new object[1];
507  lvoParameter[0] = fpsParameter_1; // Hier sind z.B. Kooerdinaten usw. zu finden
508  try
509  {
510  Type myTypeObject = this.cvoObject.GetType();
511  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
512  BindingFlags.Public | BindingFlags.Instance,
513  null,
514  new Type[] { typeof(string) },
515  null);
516  // Existiert die Methode des Objektes?
517  if (myMethodInfo == null)
518  {
519  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
520  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
521  throw new OKWFrameObjectMethodNotFoundException(errorText);
522  }
523  else
524  {
525  // Ja, Methode via Invoke aufrufen
526  myMethodInfo.Invoke(this.cvoObject, lvoParameter);
527  }
528  }
529  finally
530  {
531  this.Log.LogFunctionEndDebug();
532  }
533  return;
534  }
535 
570  public void CallMethod(string fpsMethod, string fpsParameter_1, string fpsParameter_2)
571  {
572  this.Log.LogFunctionStartDebug("CallMethod", "string fpsMethod", fpsMethod, "string fps_Parameter_1", fpsParameter_1, "string fps_Parameter_2", fpsParameter_2);
573  object[] lvoParameter = new object[2];
574  lvoParameter[0] = fpsParameter_1; // Hier sind z.B. Kooerdinaten usw. zu finden
575  lvoParameter[1] = fpsParameter_2; // Auch hier sind Kooerdinaten usw. zu finden
576  try
577  {
578  Type myTypeObject = this.cvoObject.GetType();
579  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
580  BindingFlags.Public | BindingFlags.Instance,
581  null,
582  new Type[] { typeof(string), typeof(string) },
583  null);
584  // Existiert die Methode des Objektes?
585  if (myMethodInfo == null)
586  {
587  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
588  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
589  throw new OKWFrameObjectMethodNotFoundException(errorText);
590  }
591  else
592  {
593  // Ja, Methode via Invoke aufrufen
594  myMethodInfo.Invoke(this.cvoObject, lvoParameter);
595  }
596  }
597  finally
598  {
599  this.Log.LogFunctionEndDebug();
600  }
601  return;
602  }
603 
641  public void CallMethod(string fpsMethod, string fpsParameter_1, string fpsParameter_2, string fpsParameter_3)
642  {
643  this.Log.LogFunctionStartDebug("CallMethod",
644  "string fpsMethod", fpsMethod,
645  "string fpsParameter_1", fpsParameter_1,
646  "string fpsParameter_2", fpsParameter_2,
647  "string fpsParameter_3", fpsParameter_3);
648  object[] lvoParameter = new object[3];
649  lvoParameter[0] = fpsParameter_1;
650  lvoParameter[1] = fpsParameter_2;
651  lvoParameter[2] = fpsParameter_3;
652  try
653  {
654  Type myTypeObject = this.cvoObject.GetType();
655  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
656  BindingFlags.Public | BindingFlags.Instance,
657  null,
658  new Type[] {typeof(string), typeof(string), typeof(string)},
659  null);
660  // Existiert die Methode des Objektes?
661  if (myMethodInfo == null)
662  {
663  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
664  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
665  throw new OKWFrameObjectMethodNotFoundException(errorText);
666  }
667  else
668  {
669  // Ja, Methode via Invoke aufrufen
670  myMethodInfo.Invoke(this.cvoObject, lvoParameter);
671  }
672  }
673  finally
674  {
675  this.Log.LogFunctionEndDebug();
676  }
677  return;
678  }
679 
717  public void CallMethod(string fpsMethod, string fpsParameter_1, string fpsParameter_2, List<string> fpLsValue)
718  {
719  this.Log.LogFunctionStartDebug("CallMethod",
720  "string fpsMethod", fpsMethod,
721  "string fpsParameter_1", fpsParameter_1,
722  "string fpsParameter_2", fpsParameter_2,
723  "string fpsLValue", "fpLsValue.ToString");
724  object[] lvoParameter = new object[3];
725  lvoParameter[0] = fpsParameter_1;
726  lvoParameter[1] = fpsParameter_2;
727  lvoParameter[2] = fpLsValue;
728  try
729  {
730  Type myTypeObject = this.cvoObject.GetType();
731  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
732  BindingFlags.Public | BindingFlags.Instance,
733  null,
734  new Type[] {typeof(string), typeof(string), typeof(List<string>)},
735  null);
736  // Existiert die Methode des Objektes?
737  if (myMethodInfo == null)
738  {
739  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
740  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
741  throw new OKWFrameObjectMethodNotFoundException(errorText);
742  }
743  else
744  {
745  // Ja, Methode via Invoke aufrufen
746  myMethodInfo.Invoke(this.cvoObject, lvoParameter);
747  }
748  }
749  finally
750  {
751  this.Log.LogFunctionEndDebug();
752  }
753  return;
754  }
755 
785  public bool CallMethodReturn_Boolean(string fpsMethod)
786  {
787  bool lvbReturn = false;
788  this.Log.LogFunctionStartDebug("CallMethodWithReturn",
789  "string fpsMethod", fpsMethod);
790  try
791  {
792  Type myTypeObject = this.cvoObject.GetType();
793  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
794  BindingFlags.Public | BindingFlags.Instance,
795  null,
796  new Type[] { },
797  null);
798  // Existiert die Methode des Objektes?
799  if (myMethodInfo == null)
800  {
801  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
802  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
803  throw new OKWFrameObjectMethodNotFoundException(errorText);
804  }
805  else
806  {
807  // Ja, Methode via Invoke aufrufen
808  lvbReturn = (bool)myMethodInfo.Invoke(this.cvoObject, null);
809  }
810  }
811  finally
812  {
813  this.Log.LogFunctionEndDebug(lvbReturn);
814  }
815  return lvbReturn;
816  }
817 
853  public bool CallMethodReturn_BooleanPb(string fpsMethod, bool fpbParameter_1)
854  {
855  bool lvbReturn = false;
856  object[] lvoParameter = new object[1];
857  lvoParameter[0] = fpbParameter_1;
858  this.Log.LogFunctionStartDebug("CallMethodReturn_BooleanPb",
859  "string fpsMethod", fpsMethod,
860  "bool fpsParameter_1", fpbParameter_1.ToString());
861  try
862  {
863  Type myTypeObject = this.cvoObject.GetType();
864  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
865  BindingFlags.Public | BindingFlags.Instance,
866  null,
867  new Type[] {typeof(bool)},
868  null);
869  // Existiert die Methode des Objektes?
870  if (myMethodInfo == null)
871  {
872  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
873  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
874  throw new OKWFrameObjectMethodNotFoundException(errorText);
875  }
876  else
877  {
878  // Ja, Methode via Invoke aufrufen
879  lvbReturn = (bool)myMethodInfo.Invoke(this.cvoObject, lvoParameter);
880  }
881  }
882  finally
883  {
884  this.Log.LogFunctionEndDebug(lvbReturn);
885  }
886  return lvbReturn;
887  }
888 
920  public int CallMethodReturn_Int(string fpsMethod)
921  {
922  int lviReturn = 0;
923  bool bOK = false;
924  this.Log.LogFunctionStartDebug("CallMethodReturn_Int",
925  "string fpsMethod", fpsMethod);
926  try
927  {
928  Type myTypeObject = this.cvoObject.GetType();
929  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
930  BindingFlags.Public | BindingFlags.Instance,
931  null,
932  new Type[] { },
933  null);
934  // Existiert die Methode des Objektes?
935  if (myMethodInfo == null)
936  {
937  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
938  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
939  throw new OKWFrameObjectMethodNotFoundException(errorText);
940  }
941  else
942  {
943  // Ja, Methode via Invoke aufrufen
944  lviReturn = (int)myMethodInfo.Invoke(this.cvoObject, null);
945  }
946  bOK = true;
947  }
948  finally
949  {
950  if (bOK)
951  {
952  this.Log.LogFunctionEndDebug(lviReturn.ToString());
953  }
954  else
955  {
956  this.Log.LogFunctionEndDebug();
957  }
958  }
959  return lviReturn;
960  }
961 
993  public List<string> CallMethodReturn_ListString(string fpsMethod)
994  {
995  List<string> lvLsReturn = new List<string>();
996  bool bOK = false;
997  this.Log.LogFunctionStartDebug("CallMethodReturn_ListString",
998  "string fpsMethod", fpsMethod);
999  try
1000  {
1001  Type myTypeObject = this.cvoObject.GetType();
1002  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
1003  BindingFlags.Public | BindingFlags.Instance,
1004  null,
1005  new Type[] { },
1006  null);
1007  // Existiert die Methode des Objektes?
1008  if (myMethodInfo == null)
1009  {
1010  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
1011  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
1012  throw new OKW.OKWFrameObjectMethodNotFoundException(errorText);
1013  }
1014  else
1015  {
1016  // Ja, Methode via Invoke aufrufen
1017  lvLsReturn = (List<string>)myMethodInfo.Invoke(this.cvoObject, null);
1018  }
1019  bOK = true;
1020  }
1021  finally
1022  {
1023  if (bOK)
1024  {
1025  this.Log.LogFunctionEndDebug(lvLsReturn);
1026  }
1027  else
1028  {
1029  this.Log.LogFunctionEndDebug();
1030  }
1031  }
1032  return lvLsReturn;
1033  }
1034 
1072  public List<string> CallMethodReturn_ListString(string fpsMethod, string fpsParam1, string fpsParam2)
1073  {
1074  List<string> lvLsReturn = new List<string>();
1075  object[] lvoParameter = new object[2];
1076  bool bOK = false;
1077  lvoParameter[0] = fpsParam1;
1078  lvoParameter[1] = fpsParam2;
1079  this.Log.LogFunctionStartDebug("CallMethodReturn_ListString",
1080  "string fpsMethod", fpsMethod,
1081  "string fpsParam1", fpsParam1,
1082  "string fpsParam2", fpsParam2);
1083  try
1084  {
1085  Type myTypeObject = this.cvoObject.GetType();
1086  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
1087  BindingFlags.Public | BindingFlags.Instance,
1088  null,
1089  new Type[] {typeof(string), typeof(string)},
1090  null);
1091  // Existiert die Methode des Objektes?
1092  if (myMethodInfo == null)
1093  {
1094  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
1095  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
1096  throw new OKW.OKWFrameObjectMethodNotFoundException(errorText);
1097  }
1098  else
1099  {
1100  // Ja, Methode via Invoke aufrufen
1101  lvLsReturn = (List<string>)myMethodInfo.Invoke(this.cvoObject, lvoParameter);
1102  }
1103  bOK = true;
1104  }
1105  finally
1106  {
1107  if (bOK)
1108  {
1109  this.Log.LogFunctionEndDebug(lvLsReturn);
1110  }
1111  else
1112  {
1113  this.Log.LogFunctionEndDebug();
1114  }
1115  }
1116  return lvLsReturn;
1117  }
1118 
1152  public List<string> CallMethodReturn_ListString(string fpsMethod, List<string> fpLsParameter_1)
1153  {
1154  List<string> lvLsReturn = new List<string>();
1155  object[] lvoParameter = new object[1];
1156  bool bOK = false;
1157  lvoParameter[0] = fpLsParameter_1;
1158  this.Log.LogFunctionStartDebug("CallMethodWithReturn",
1159  "string fpsMethod", fpsMethod,
1160  "List<string> fpLsParameter_1", fpLsParameter_1.ToString());
1161  try
1162  {
1163  Type myTypeObject = this.cvoObject.GetType();
1164  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
1165  BindingFlags.Public | BindingFlags.Instance,
1166  null,
1167  new Type[] {typeof(List<string>)},
1168  null);
1169  // Existiert die Methode des Objektes?
1170  if (myMethodInfo == null)
1171  {
1172  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
1173  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
1174  throw new OKWFrameObjectMethodNotFoundException(errorText);
1175  }
1176  else
1177  {
1178  // Ja, Methode via Invoke aufrufen
1179  lvLsReturn = (List<string>)myMethodInfo.Invoke(this.cvoObject, lvoParameter);
1180  }
1181  bOK = true;
1182  }
1183  finally
1184  {
1185  if (bOK)
1186  {
1187  this.Log.LogFunctionEndDebug(lvLsReturn);
1188  }
1189  else
1190  {
1191  this.Log.LogFunctionEndDebug();
1192  }
1193  }
1194  return lvLsReturn;
1195  }
1196 
1238  public List<string> CallMethodReturn_ListString(string fpsMethod, string fpsParameter_1, string fpsParameter_2, List<string> fpLsParameter_3)
1239  {
1240  List<string> lvLsReturn = new List<string>();
1241  object[] lvoParameter = new object[3];
1242  bool bOK = false;
1243  lvoParameter[0] = fpsParameter_1;
1244  lvoParameter[1] = fpsParameter_2;
1245  lvoParameter[2] = fpLsParameter_3;
1246  this.Log.LogFunctionStartDebug("CallMethodReturn_ListString",
1247  "string fpsMethod", fpsMethod,
1248  "string fpsParam1", fpsParameter_1,
1249  "string fpsParameter_2", fpsParameter_2,
1250  "List<string> fpLsParameter_3", fpLsParameter_3.ToString());
1251  try
1252  {
1253  Type myTypeObject = this.cvoObject.GetType();
1254  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod);
1255  // Existiert die Methode des Objektes?
1256  if (myMethodInfo == null)
1257  {
1258  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
1259  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
1260  throw new OKWFrameObjectMethodNotFoundException(errorText);
1261  }
1262  else
1263  {
1264  // Ja, Methode via Invoke aufrufen
1265  lvLsReturn = (List<string>)myMethodInfo.Invoke(this.cvoObject, lvoParameter);
1266  }
1267  bOK = true;
1268  }
1269  finally
1270  {
1271  if (bOK)
1272  {
1273  this.Log.LogFunctionEndDebug(lvLsReturn);
1274  }
1275  else
1276  {
1277  this.Log.LogFunctionEndDebug();
1278  }
1279  }
1280  return lvLsReturn;
1281  }
1282 
1314  public string CallMethodReturn_String(string fpsMethod)
1315  {
1316  string lvsReturn = string.Empty;
1317  bool bOK = false;
1318  this.Log.LogFunctionStartDebug("CallMethodWithReturn",
1319  "string fpsMethod", fpsMethod);
1320  try
1321  {
1322  Type myTypeObject = this.cvoObject.GetType();
1323  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
1324  BindingFlags.Public | BindingFlags.Instance,
1325  null,
1326  new Type[] {},
1327  null);
1328  // Existiert die Methode des Objektes?
1329  if (myMethodInfo == null)
1330  {
1331  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
1332  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
1333  throw new OKWFrameObjectMethodNotFoundException(errorText);
1334  }
1335  else
1336  {
1337  // Ja, Methode via Invoke aufrufen
1338  lvsReturn = (string)myMethodInfo.Invoke(this.cvoObject, null);
1339  }
1340  bOK = true;
1341  }
1342  finally
1343  {
1344  if (bOK)
1345  {
1346  this.Log.LogFunctionEndDebug(lvsReturn);
1347  }
1348  else
1349  {
1350  this.Log.LogFunctionEndDebug();
1351  }
1352  }
1353  return lvsReturn;
1354  }
1355 
1389  public string CallMethodReturn_String(string fpsMethod, string fpsParameter_1)
1390  {
1391  string lvsReturn = string.Empty;
1392  object[] lvoParameter = new object[1];
1393  bool bOK = false;
1394  lvoParameter[0] = fpsParameter_1;
1395  this.Log.LogFunctionStartDebug("CallMethodWithReturn",
1396  "string fpsMethod", fpsMethod,
1397  "string fpsParameter_1", fpsParameter_1);
1398  try
1399  {
1400  Type myTypeObject = this.cvoObject.GetType();
1401  MethodInfo myMethodInfo = myTypeObject.GetMethod(fpsMethod,
1402  BindingFlags.Public | BindingFlags.Instance,
1403  null,
1404  new Type[] {typeof(string)},
1405  null);
1406  // Existiert die Methode des Objektes?
1407  if (myMethodInfo == null)
1408  {
1409  // Nein: -> Mit einem OKWFrameObjectMethodNotFoundException aussteigen...
1410  string errorText = this.LM.GetMessage("CallMethod", "MethodNotDefined", fpsMethod);
1411  throw new OKWFrameObjectMethodNotFoundException(errorText);
1412  }
1413  else
1414  {
1415  // Ja, Methode via Invoke aufrufen
1416  lvsReturn = (string)myMethodInfo.Invoke(this.cvoObject, lvoParameter);
1417  }
1418  bOK = true;
1419  }
1420  finally
1421  {
1422  if (bOK)
1423  {
1424  this.Log.LogFunctionEndDebug(lvsReturn);
1425  }
1426  else
1427  {
1428  this.Log.LogFunctionEndDebug();
1429  }
1430  }
1431  return lvsReturn;
1432  }
1433 
1451  public bool CheckCharacter(string fpsFunctionalname)
1452  {
1453  // Variable
1454  bool lvb_Return = false;
1455  bool bOK = false;
1456  this.Log.LogFunctionStartDebug("CurrentObject.GetObjectName");
1457  // Initialisierung
1458  try
1459  {
1460  // Define a regular expression OKW_Object Name.
1461  // FIXME: Regulärenausdruck für Fachlich-funktionalen-Namen anpassen
1462  Regex rx = new Regex(@"^\w+");
1463  // Check each test string against the regular expression.
1464  if (rx.IsMatch(fpsFunctionalname))
1465  {
1466  lvb_Return = true;
1467  }
1468  else
1469  {
1470  // FrameObjekt-Name enthält nicht erlaubte Zeichen, daher Exception auslösen.
1471  string errorText = this.LM.GetMessage("CheckCharacter", "OKWFrameObjectIllegalNameCharacterException", fpsFunctionalname);
1472  throw new OKWFrameObjectIllegalNameCharacterException(errorText);
1473  }
1474  bOK = true;
1475  }
1476  finally
1477  {
1478  if (bOK)
1479  {
1480  this.Log.LogFunctionEndDebug(lvb_Return);
1481  }
1482  else
1483  {
1484  this.Log.LogFunctionEndDebug();
1485  }
1486  }
1487  return lvb_Return;
1488  }
1489 
1505  public object GetCurrentObject()
1506  {
1507  object lvoReturn = new object();
1508  bool bOK = false;
1509  this.Log.LogFunctionStartDebug("CurrentObject.GetCurrentObject");
1510  try
1511  {
1512  lvoReturn = this.cvoObject;
1513  bOK = true;
1514  }
1515  catch
1516  {
1517  if (bOK)
1518  {
1519  this.Log.LogFunctionEndDebug(this.cvoObject.GetType().FullName);
1520  }
1521  else
1522  {
1523  this.Log.LogFunctionEndDebug();
1524  }
1525  }
1526  return this.cvoObject;
1527  }
1528 
1544  public string GetObjectName()
1545  {
1546  string lvsReturn = string.Empty;;
1547  bool bOK = false;
1548  this.Log.LogFunctionStartDebug("CurrentObject.GetObjectName");
1549  try
1550  {
1551  lvsReturn = this.cvsObjectName;
1552  bOK = true;
1553  }
1554  catch
1555  {
1556  if (bOK)
1557  {
1558  this.Log.LogFunctionEndDebug(lvsReturn);
1559  }
1560  else
1561  {
1562  this.Log.LogFunctionEndDebug();
1563  }
1564  }
1565  return lvsReturn;
1566  }
1567 
1583  public void Init()
1584  {
1585  Logger.Instance.LogFunctionStartDebug("CurrentObject.Init");
1586  try
1587  {
1588  this.LM = new LogMessenger(this.GetType().Name);
1589  this.cvoObject = null;
1590  this.cvsChildName = string.Empty;
1591  this.cvsWindowName = string.Empty;
1592  this.cvsObjectName = string.Empty;
1593  this.myFrameObjectDictionary = null;
1594  this.myFrameObjectDictionary = new FrameObjectDictionary();
1595  }
1596  finally
1597  {
1598  Logger.Instance.LogFunctionEndDebug();
1599  }
1600  return;
1601  }
1602 
1631  public void LogObjectData()
1632  {
1633  Logger.Instance.LogFunctionStartDebug("CurrentObject.LogObjectData");
1634  try
1635  {
1636  Logger.Instance.ResOpenList("Object Data:");
1637  Logger.Instance.LogPrint(this.LM.GetMessage("LogObjectData", "WindowName", this.cvsWindowName));
1638  Logger.Instance.LogPrint(this.LM.GetMessage("LogObjectData", "ChildWindowName", this.cvsChildName));
1639  Logger.Instance.LogPrint(this.LM.GetMessage("LogObjectData", "Class of Object", this.cvoObject.GetType().Name));
1640  Logger.Instance.LogPrint(this.LM.GetMessage("LogObjectData", "FullNameOfObject", this.cvsObjectName));
1641  }
1642  catch (SystemException e)
1643  {
1644  Logger.Instance.LogPrint(e.Message);
1645  }
1646  finally
1647  {
1648  Logger.Instance.ResCloseList();
1649  }
1650  Logger.Instance.LogFunctionEndDebug();
1651  }
1652 
1678  public object SetChildName(string fpsChildName)
1679  {
1680  bool bOK = false;
1681  this.Log.LogFunctionStartDebug("CurrentObject.SetChildName", "string fpsChildName", fpsChildName);
1682  this.Log.LogPrintDebug(this.LM.GetMessage("SetChildName", "GivenWindownameDebug"));
1683  try
1684  {
1685  if (this.cvsWindowName != string.Empty)
1686  {
1687  this.Log.LogPrintDebug(this.LM.GetMessage("SetChildName", "SetChildwindowNameDebug", this.cvsWindowName, this.cvsChildName));
1688  this.cvsChildName = fpsChildName;
1689  this.UpdateObject();
1690  bOK = true;
1691  }
1692  else
1693  {
1694  // Fenster Objekt wurde nicht gesetzt, Exception auslösen...
1695  string ErrorText = this.LM.GetMessage("SetChildName", "OKWFrameObjectWindowNotSetException");
1696  throw new OKWFrameObjectWindowNotSetException(ErrorText);
1697  }
1698  }
1699  finally
1700  {
1701  if (bOK)
1702  {
1703  this.Log.LogFunctionEndDebug(this.cvoObject.GetType().FullName);
1704  }
1705  else
1706  {
1707  this.Log.LogFunctionEndDebug();
1708  }
1709  }
1710  return this.cvoObject;
1711  }
1712 
1734  public object SetWindowName(string fpsWindowName)
1735  {
1736  object lvoReturn = new object();
1737  bool bOK = false;
1738  this.Log.LogFunctionStartDebug("CurrentObject.SetWindowName", "string fpsWindowName", fpsWindowName);
1739  try
1740  {
1741  this.cvsWindowName = fpsWindowName;
1742  this.cvsChildName = string.Empty;
1743  this.UpdateObject();
1744  lvoReturn = this.cvoObject;
1745  bOK = true;
1746  }
1747  finally
1748  {
1749  if (bOK)
1750  {
1751  this.Log.LogFunctionEndDebug(lvoReturn.ToString());
1752  }
1753  else
1754  {
1755  this.Log.LogFunctionEndDebug();
1756  }
1757  }
1758  return lvoReturn;
1759  }
1760 
1776  private object ResetToWindow()
1777  {
1778  bool bOK = false;
1779  this.Log.LogFunctionStartDebug("CurrentObject.ResetToWindow");
1780  this.Log.LogPrintDebug(this.LM.GetMessage("ResetToWindow", "ResetToWindowDebug"));
1781  try
1782  {
1783  this.cvsChildName = string.Empty;
1784  this.UpdateObject();
1785  bOK = true;
1786  }
1787  finally
1788  {
1789  if (bOK)
1790  {
1791  this.Log.LogFunctionEndDebug(this.cvoObject.GetType().FullName);
1792  }
1793  else
1794  {
1795  this.Log.LogFunctionEndDebug();
1796  }
1797  }
1798  return this.cvoObject;
1799  }
1800 
1823  private void UpdateObject()
1824  {
1825  this.Log.LogFunctionStartDebug("CurrentObject.UpdateObject");
1826  try
1827  {
1828  if (this.cvsChildName == string.Empty)
1829  {
1830  // < 2. Get the Window-Object...
1831  this.cvoObject = this.myFrameObjectDictionary.GetParentObjectByName(this.cvsWindowName);
1832  // "frm_" + this.cvsWindowName; //< 1. Set the cvsObjectName for a window-object.
1833  this.cvsObjectName = this.cvoObject.GetType().Name;
1834  }
1835  else
1836  {
1837  // < 1. Set the cvsObjectName for a child-object.
1838  this.cvsObjectName = this.cvsWindowName + "." + this.cvsChildName;
1839  // < 2. Now get the Window-Object...
1840  this.cvoObject = this.myFrameObjectDictionary.GetChildObjectByName(this.cvsWindowName, this.cvsChildName);
1841  }
1842  }
1843  finally
1844  {
1845  this.Log.LogFunctionEndDebug();
1846  }
1847  return;
1848  }
1849 
1850  #endregion Methods
1851  }
1852 }
string GetMessage(string MethodName, string TextKey)
Holt die Log-Meldung für MethodeNmae/Textkey ohne weitere Parameter.
bool CallMethodReturn_BooleanPb(string fpsMethod, bool fpbParameter_1)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
Diese Klasse verwaltet das aktuelle GUI-Objekt.
void LogPrint(string fps_Message)
LogPrint Function: Prints the values of expressions to the results file.
Definition: Logger.cs:302
void ResOpenList(string fps_Name)
Creates a new hierarchical level in the results file. Use ResOpenList to start a new hierarchical lev...
Definition: Logger.cs:426
string cvsChildName
Die Eigenschaft enthält den fachlichen Namen des aktuellen Kindobjektes.
object ResetToWindow()
Das aktuelle Objekt wird auf das Fenster zurückgesetzt. Kindobjekt wird gelöscht. ...
string cvsObjectName
Vollständiger "technischer Name" des aktuellen Objektes "WindowName.ChildObjectName".
string GetObjectName()
Ermittelt den ObjektNamen des aktuellen Objektes.
void UpdateObject()
Methode aktualisert zwei Werte:
List< string > CallMethodReturn_ListString(string fpsMethod, string fpsParam1, string fpsParam2)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
void CallMethod(string fpsMethod, string fpsParameter_1, string fpsParameter_2, List< string > fpLsValue)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
string CallMethodReturn_String(string fpsMethod)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
object SetChildName(string fpsChildName)
Setzt das Kindobjekt.
string cvsWindowName
Eigenschaft enthält den fachlichen Namen des aktuellen Fensters. Auf dieses Fenster beziehen sich all...
LogMessenger LM
Hält eine Referenz auf die Klasse LogMessenger für die sprachabhängige Log-Ausgabe vor...
void CallMethod(string fpsMethod, List< string > fpLsParameter_1, string fpsParameter_2)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
Logger Log
Hält eine Referenz auf die Klasse Logger vor.
object SetWindowName(string fpsWindowName)
Hier wird der Kontext auf ein Fenster gesetzt.
List< string > CallMethodReturn_ListString(string fpsMethod, string fpsParameter_1, string fpsParameter_2, List< string > fpLsParameter_3)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
void CallMethod(string fpsMethod, string fpsParameter_1, string fpsParameter_2, string fpsParameter_3)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
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...
void CallMethod(string fpsMethod, List< string > fpLsParameter)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
int CallMethodReturn_Int(string fpsMethod)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
string CallMethodReturn_String(string fpsMethod, string fpsParameter_1)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
CurrentObject()
Initialisiert eine neue Instanz der OKW.CurrentObject Klasse Nicht öffentlicher Konstruktor: Verwende...
FrameObjectDictionary myFrameObjectDictionary
Diese Übersicht enthält alle besuchten/ genutzten "Frame Objects".
void Init()
Führt die Initialisierung der Klasse durch: Es werden alle Felder der Klasse auf einen definierten An...
object GetCurrentObject()
Liefert die Referenz zum aktuellen Frame-Object. Referenz ist im Feld cvoObject abgelegt.
bool CheckCharacter(string fpsFunctionalname)
Diese Methode prüft den fachlichen Objektnamen auf "erlaubte" Zeichen.
LogMessenger liest Log-Meldungen sprachspezifisch für die im Konstruktor gegeben Klasse aus der Zugeh...
Definition: LogMessenger.cs:90
Diese Ausnahme wird ausgelöst, wenn kein Fenster Objekt ausgewählt/gesetzt worden ist bevor ein Kindo...
void CallMethod(string fpsMethod, string fpsParameter_1)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
void LogPrintDebug(string fpsMessage)
Loggt eine Nachricht.
Definition: Logger.cs:332
string cvsObjectFunctionalName
Vollständiger "funktionaler Name" des aktuellen Objektes "WindowName.ChildObjectName".
List< string > CallMethodReturn_ListString(string fpsMethod)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
Baisklasse für das lesen von OKW *Log.xml Dateien Designpattern: Singelton Hier gilt das Highlander P...
List< string > CallMethodReturn_ListString(string fpsMethod, List< string > fpLsParameter_1)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
void CallMethod(string fpsMethod, string fpsParameter_1, string fpsParameter_2)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf.
object GetChildObjectByName(string fps_ParentObject, string fps_ChildObject)
Die Methode liefert das Objekt des gegebenen Kindobjekttests zurück.
void CallMethod(string fpsMethod)
Gibt die Instanz für die einzige Instanz dieser Klasse zurück. Hinweis:
object cvoObject
Singelton-Class: Instanz enthält die Object-Referenzierung des CurrentObject.
void LogObjectData()
Methode gibt alle wichtigen Informationen zum aktuellen Objekt aus. Diese soll im Fehler- oder Ausnah...
bool CallMethodReturn_Boolean(string fpsMethod)
Ruft eine Methode des aktuellen Objektes via "late bound function call" auf. Die aufgerufene Methode ...
void ResCloseList()
Closes a hierarchical level in the results file that was opened with ResOpenList. Use ResOpenList to ...
Definition: Logger.cs:392
Definition: Core.cs:40