OpenKeyWord  Version: 426, Datum:
AUI_AnyWin.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.GUI.AUI
43 {
44  using System;
45  using System.Collections.Generic;
46  using System.Text;
47  using System.Windows.Forms;
48 
49  using OKW.Log;
50 
65  public class AUI_AnyWin
66  {
67  #region Fields
68 
75  protected string controlID;
76 
80  protected OKW_Wait4Value MyWait4Value = new OKW_Wait4Value();
81 
87  protected string text;
88 
94  protected string title;
95 
96  #endregion Fields
97 
98  #region Constructors
99 
111  public AUI_AnyWin(string fpsTitel, string fpsText, string fpsControlID)
112  {
113  this.text = fpsText;
114  this.title = fpsTitel;
115  this.controlID = fpsControlID;
116  }
117 
118  #endregion Constructors
119 
120  #region Methods
121 
122  public virtual void Click_On()
123  {
124  this.LogFunctionStartDebug("Click_On()");
125 
126  // ControlClick($titel, $text, 21006 , "right", 2)
127  if (0 == AutoItX3.AU3_ControlClick(this.title, this.text, this.controlID, "left", 1, 5, 5))
128  {
129  // EXCEPTION: GUIException- Nachricht auslagern.
130  this.LogObjectData();
131  this.LogFunctionEndDebug();
132  throw new GUIException("AutoIt Fehler...");
133  }
134 
135  this.LogFunctionEndDebug();
136  return;
137  }
138 
150  public virtual bool GetValue_ACTIVE()
151  {
152  LogFunctionStartDebug("GetValue_ACTIVE");
153 
154  bool lvbReturn = false;
155 
156  LogFunctionEndDebug(lvbReturn);
157 
158  throw new NotImplementedException("AutoIt unterstützt das Auslesen von Tooltips nicht:-(");
159 
160  // return lvbReturn;
161  }
162 
174  public virtual bool GetValue_FOCUS()
175  {
176  this.LogFunctionStartDebug("GetValue_FOCUS");
177 
178  bool lvbReturn = false;
179 
180  this.LogFunctionEndDebug(lvbReturn);
181 
182  throw new NotImplementedException("Die Implementierung GetValue_FOCUS von ist noch nicht erfolg");
183 
184  //return lvbReturn;
185  }
186 
197  public virtual List<string> GetValue_TOOLTIP()
198  {
199  this.LogFunctionStartDebug("GetValue_TOOLTIP");
200 
201  List<string> lvLsReturn = new List<string>();
202  this.LogFunctionEndDebug(lvLsReturn);
203 
204  throw new NotImplementedException("AutoIt unterstützt das Auslesen von Tooltips nicht:-(");
205 
206  //return lvLsReturn;
207  }
208 
218  public void LogFunctionStartDebug(string fpsMethodName, string P1_Name, string P1_Value)
219  {
220  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + "." + fpsMethodName, P1_Name, P1_Value);
221  }
222 
232  public void LogFunctionStartDebug(string fpsMethodName)
233  {
234  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + "." + fpsMethodName);
235  }
236 
248  public virtual bool LogValue_ACTIVE()
249  {
250  this.LogFunctionStartDebug("LogValue_ACTIVE");
251 
252  bool lvbReturn = this.GetValue_ACTIVE();
253 
254  this.LogFunctionEndDebug(lvbReturn);
255 
256  return lvbReturn;
257  }
258 
269  public virtual bool LogValue_FOCUS()
270  {
271  this.LogFunctionStartDebug("LogValue_FOCUS");
272 
273  bool lvbReturn = this.GetValue_FOCUS();
274 
275  this.LogFunctionEndDebug(lvbReturn);
276 
277  return lvbReturn;
278  }
279 
291  public virtual List<string> LogValue_TOOLTIP()
292  {
293  this.LogFunctionStartDebug("LogValue_TOOLTIP");
294 
295  List<string> lvLsReturn = this.GetValue_TOOLTIP();
296 
297  this.LogFunctionEndDebug(lvLsReturn);
298 
299  return lvLsReturn;
300  }
301 
316  public virtual List<string> MemorizeTooltip()
317  {
318  this.LogFunctionStartDebug("MemorizeTooltip");
319 
320  List<string> lvLsReturn = this.GetValue_TOOLTIP();
321 
322  this.LogFunctionEndDebug(lvLsReturn);
323 
324  return lvLsReturn;
325  }
326 
341  public virtual bool Memorize_ACTIVE()
342  {
343  this.LogFunctionStartDebug("Memorize_ACTIVE");
344 
345  bool lvbReturn = this.GetValue_ACTIVE();
346 
347  this.LogFunctionEndDebug(lvbReturn);
348 
349  return lvbReturn;
350  }
351 
365  public virtual bool Memorize_FOCUS()
366  {
367  this.LogFunctionStartDebug("Memorize_FOCUS");
368 
369  bool lvbReturn = this.GetValue_FOCUS();
370 
371  this.LogFunctionEndDebug(lvbReturn);
372 
373  return lvbReturn;
374  }
375 
380  public string ReadClipboard()
381  {
382  string lvs_Return = string.Empty;
383 
384  this.LogFunctionStartDebug("ReadClipboard");
385 
386  lvs_Return = AutoItX3.ClipGet();
387 
388  this.LogFunctionEndDebug(lvs_Return);
389 
390  return lvs_Return;
391  }
392 
401  public virtual void TypeKey(List<string> fps_Values)
402  {
403  this.LogFunctionStartDebug("TypeKey", "fps_Values", fps_Values.ToString());
404 
405  // Loop through all List-Values with foreach...
406  foreach (string Value in fps_Values)
407  {
408  Logger.Instance.LogPrintDebug(">>" + Value + "<<");
409 
410  if (0 == AutoItX3.AU3_ControlFocus(this.title, this.text, this.controlID))
411  {
412  // AutoIt Fehler...
413  this.LogObjectData();
414  this.LogFunctionEndDebug();
415  throw new GUIException("AutoIt Fehler...");
416  }
417 
418  AutoItX3.AU3_ControlSend(this.title, this.text, this.controlID, Value, 1);
419  }
420 
421  this.LogFunctionEndDebug();
422  return;
423  }
424 
436  public virtual List<string> VerifyTooltip(List<string> fplsExpectedValue)
437  {
438  this.LogFunctionStartDebug("MemorizeTooltip", "fplsExpectedValue", fplsExpectedValue[1]);
439 
440  List<string> lvLsReturn;
441 
442  // GetValue_TOOLTIP als delegaten definieren
443  OKW_Wait4Value.ListStringCallBack myCallBack = this.GetValue_TOOLTIP;
444 
445  // Nun mit dem erwarteten Sollwert und GetValue_TOOLTIP ggf. auf den Wert Warten.
446  lvLsReturn = this.MyWait4Value.Wait4Value(fplsExpectedValue, myCallBack);
447 
448  this.LogFunctionEndDebug(lvLsReturn);
449 
450  return lvLsReturn;
451  }
452 
462  public virtual bool Verify_ACTIVE(bool fpbExpectedValue)
463  {
464  this.LogFunctionStartDebug("Memorize_ACTIVE", "fpbExpectedValue", fpbExpectedValue.ToString());
465 
466  bool lvbReturn = false;
467 
468  // GetValue_TOOLTIP als delegaten definieren
469  OKW_Wait4Value.BoolCallBack myCallBack = this.GetValue_ACTIVE;
470 
471  // Nun mit dem erwarteten Sollwert und GetValue_TOOLTIP ggf. auf den Wert Warten.
472  lvbReturn = this.MyWait4Value.Wait4Value(fpbExpectedValue, myCallBack);
473 
474  this.LogFunctionEndDebug(lvbReturn);
475 
476  return lvbReturn;
477  }
478 
489  public virtual bool Verify_FOCUS(bool fpbExpectedValue)
490  {
491  this.LogFunctionStartDebug("Verify_FOCUS", "fpbExpectedValue", fpbExpectedValue.ToString());
492 
493  bool lvbReturn = false;
494 
495  // GetValue_TOOLTIP als delegaten definieren
496  OKW_Wait4Value.BoolCallBack myCallBack = this.GetValue_FOCUS;
497 
498  // Nun mit dem erwarteten Sollwert und GetValue_FOCUS ggf. auf den Wert Warten.
499  lvbReturn = this.MyWait4Value.Wait4Value(fpbExpectedValue, myCallBack);
500 
501  this.LogFunctionEndDebug(lvbReturn);
502 
503  return lvbReturn;
504  }
505 
506  protected void LogFunctionEndDebug()
507  {
508  Logger.Instance.LogFunctionEndDebug();
509  }
510 
511  protected void LogFunctionEndDebug(string fps_Return)
512  {
513  Logger.Instance.LogFunctionEndDebug(fps_Return);
514  }
515 
516  protected void LogFunctionEndDebug(bool fpb_Return)
517  {
518  Logger.Instance.LogFunctionEndDebug(fpb_Return);
519  }
520 
521  protected void LogFunctionEndDebug(List<string> fpls_Return)
522  {
523  Logger.Instance.LogFunctionEndDebug(fpls_Return);
524  }
525 
531  protected void LogObjectData()
532  {
533  Log.Logger.Instance.LogPrint(" title: >>" + this.title + "<<");
534  Log.Logger.Instance.LogPrint(" text: >>" + this.text + "<<");
535  Log.Logger.Instance.LogPrint(" controlID: >>" + this.controlID + "<<");
536  }
537 
538  #endregion Methods
539  }
540 }
virtual void TypeKey(List< string > fps_Values)
Tastatureingabe an das Objekt.
Definition: AUI_AnyWin.cs:401
Initialisiert eine neue Instanz der GUIException-Klasse.
virtual List< string > LogValue_TOOLTIP()
Ermittelt den textuellen Inhalt des ToolTips.
Definition: AUI_AnyWin.cs:291
AUI_AnyWin(string fpsTitel, string fpsText, string fpsControlID)
Konstruktor mit den drei AutoIt Contrler oder Steuerelement Objekterkennungseigenschaften.
Definition: AUI_AnyWin.cs:111
virtual bool Memorize_FOCUS()
Ermittelt ob das Objekt den Fokus besitz und liefert diesen für das Schlüsselwort MerkeWert...
Definition: AUI_AnyWin.cs:365
delegate List< string > ListStringCallBack()
Callback Muster string Variante.
virtual List< string > VerifyTooltip(List< string > fplsExpectedValue)
Ermittelt den textuellen Inhalt des ToolTips für Prüfewert.
Definition: AUI_AnyWin.cs:436
virtual bool LogValue_FOCUS()
Ermittelt für LoggeWert, ob das aktuelle Objekt den Fokus hat.
Definition: AUI_AnyWin.cs:269
virtual bool Verify_FOCUS(bool fpbExpectedValue)
Ermittelt den textuellen Inhalt des ToolTips.
Definition: AUI_AnyWin.cs:489
virtual bool GetValue_FOCUS()
Ermittelt, ob das Objekt den Fokus hat.
Definition: AUI_AnyWin.cs:174
AUI_AnyWin ist die Basisklasse für die OKW AutoIt Klassen. Diese stellt die Objekterkennungseigensc...
Definition: AUI_AnyWin.cs:65
string text
Autoit Objekterkennungseigenschaft hier: "text" des Steuerelementes.
Definition: AUI_AnyWin.cs:87
OKW_Wait4Value ist die zetrale Klasse, die für das Warten auf GUI eigenschaften zuständig ist...
static string ClipGet()
List den aktuellen Wert des Clipboard via Autoit.
Definition: AutoItX3.cs:814
string Wait4Value(string fpExpected, StringCallBack fpCallMeBack)
Methode liest den Wert aus der deligierten Methode fpCallMeBack wartet ggf. und liefert den Wert zurü...
string controlID
Autoit Objekterkennungseigenschaft hier: controlID des Steuerelementes.
Definition: AUI_AnyWin.cs:75
virtual bool Memorize_ACTIVE()
Ermittelt, ob das Objekt Aktiv ist, für das Schlüsselwort MerkeWert.
Definition: AUI_AnyWin.cs:341
virtual bool GetValue_ACTIVE()
Ermittelt ob das Objekt Aktiv ist.
Definition: AUI_AnyWin.cs:150
delegate bool BoolCallBack()
Callback Muster string Variante.
virtual List< string > GetValue_TOOLTIP()
Ermittelt den textuellen Inhalt des ToolTips. Anmerkung: AutoIt unterstützt das Auslesen des Tooltips...
Definition: AUI_AnyWin.cs:197
void LogFunctionStartDebug(string fpsMethodName, string P1_Name, string P1_Value)
Diese Methode ruft die Methode Logger.Instance.LogFunctionStartDebug(fpsMethodName, P1_Name, P1_Value), und erweitert den gegebenen Methodenname in fpsMethodName mit this.GetType().FullName um den Klassenbezeichner.
Definition: AUI_AnyWin.cs:218
virtual bool Verify_ACTIVE(bool fpbExpectedValue)
Ermittelt, ob das Objekt Aktiv ist, für das Schlüsselwort PrüfeWert.
Definition: AUI_AnyWin.cs:462
void LogObjectData()
Ausgabe der Autoit Objekterkennungseigenschaften des Controls. Wird im Fehlerfall als Analyse Hilfe a...
Definition: AUI_AnyWin.cs:531
void LogPrintDebug(string fpsMessage)
Loggt eine Nachricht.
Definition: Logger.cs:332
void LogFunctionStartDebug(string fpsMethodName)
Diese Methode ruft die Methode Logger.Instance.LogFunctionStartDebug(fpsMethodName, P1_Name, P1_Value), und erweitert den gegebenen Methodenname in fpsMethodName mit this.GetType().FullName um den Klassenbezeichner.
Definition: AUI_AnyWin.cs:232
virtual bool LogValue_ACTIVE()
Ermittelt, ob das Objekt Aktiv ist, für das Schlüsselwort LoggeWert.
Definition: AUI_AnyWin.cs:248
string title
Autoit Objekterkennungseigenschaft hier: "title" des Steuerelementes.
Definition: AUI_AnyWin.cs:94
string ReadClipboard()
List den aktuellen Wert des Clipboard via Autoit.
Definition: AUI_AnyWin.cs:380
virtual List< string > MemorizeTooltip()
Ermittelt den textuellen Inhalt des ToolTips für das Schlüsselwort MerkeWert.
Definition: AUI_AnyWin.cs:316
Definition: Core.cs:40