Exemplo n.º 1
0
 public void Say(PatternBase pattern, string text)
 {
     DoubleClick(pattern);
     ShortcutKey("LControl", "A");
     Press("Back");
     Window edit = Window.GetMousePointWindow();
     edit.Say(text);
 }
Exemplo n.º 2
0
 public void WaitVanish(PatternBase pattern,double seconds = 0)
 {
     Clock.Start();
     double timeout = seconds == 0 ? autoWaitTimeout * 1000 : seconds * 1000;
     Match m = null;
     while (Clock.Tick() < timeout) {
         m = pattern.Find(this);
         if (m==null) {
             return;
         }
         Wait(WaitScanRate);
     }
 }
Exemplo n.º 3
0
 public void OnVanish(PatternBase pattern,Action<PatternBase, Match> action)
 {
     //预留
     System.Timers.Timer timer = new System.Timers.Timer();
     timer.Interval = waitScanRate;
     bool flag = false;
     timer.Elapsed += delegate (object sender, System.Timers.ElapsedEventArgs e) {
         Match m = null;
         if ((m = pattern.Find(this)) != null)
             flag = true;
         else {
             if( flag == true) {
                 flag= false;
                 action(pattern,m);
             }
         }
     };
     timers.Add(timer);
 }
Exemplo n.º 4
0
 public void RightClick(PatternBase pattern)
 {
     Match m = Find(pattern);
     RightClick(m);
 }
Exemplo n.º 5
0
 public void MiddleClick(PatternBase pattern)
 {
     Match m = Find(pattern);
     MiddleClick(m);
 }
Exemplo n.º 6
0
 public void OnApear(PatternBase pattern, Action<PatternBase,Match> action)
 {
     System.Timers.Timer timer = new System.Timers.Timer();
     timer.Interval = waitScanRate;
     timer.Elapsed += delegate (object sender, System.Timers.ElapsedEventArgs e) {
         Match m = null;
         if ((m = pattern.Find(this)) != null)
             action(pattern,m);
     };
     timers.Add(timer);
 }
Exemplo n.º 7
0
 /// <summary>
 /// 不抛错的找图
 /// </summary>
 /// <param name="pattern"></param>
 /// <returns></returns>
 public Match FindSafe(PatternBase pattern)
 {
     Clock.Start();
     double timeout = autoWaitTimeout * 1000;
     Match m = null;
     while (Clock.Tick() < timeout) {
         m = pattern.Find(this);
         if (m != null) {
             return m;
         }
         Wait(WaitScanRate);
     }
     return m;
 }
Exemplo n.º 8
0
 public void DoubleClick(PatternBase pattern)
 {
     Match m = Find(pattern);
     DoubleClick(m);
 }
Exemplo n.º 9
0
 public List<Match> FindAll(PatternBase pattern)
 {
     Clock.Start();
     double timeout = autoWaitTimeout * 1000;
     List<Match> ms = new List<Match>();
     while (Clock.Tick() < timeout) {
         ms = pattern.FindAll(this);
         if (ms.Count != 0) {
             return ms;
         }
         Wait(WaitScanRate);
     }
     throw new FindFailException(pattern.ToString());
 }
Exemplo n.º 10
0
 /// <summary>
 /// 不抛错的找图
 /// </summary>
 /// <param name="pattern"></param>
 /// <returns></returns>
 public List<Match> FindAllSafe(PatternBase pattern)
 {
     Clock.Start();
     double timeout = autoWaitTimeout * 1000;
     List<Match> ms = new List<Match>();
     while (Clock.Tick() < timeout) {
         ms = pattern.FindAll(this);
         if (ms.Count != 0) {
             return ms;
         }
         Wait(WaitScanRate);
     }
     return ms;
 }
Exemplo n.º 11
0
 public Match Find(PatternBase pattern)
 {
     Clock.Start();
     double timeout = autoWaitTimeout * 1000;
     Match m = null;
     while (Clock.Tick() < timeout) {
         m = pattern.Find(this);
         if (m != null) {
             return m;
         }
         Wait(WaitScanRate);
     }
     throw new FindFailException(pattern.ToString());
 }
Exemplo n.º 12
0
 public bool Exists(PatternBase pattern, double seconds = 0)
 {
     double timeout = seconds==0?autoWaitTimeout * 1000:seconds*1000;
     Match m = null;
     Clock.Start();
     while (Clock.Tick() < timeout) {
         m = pattern.Find(this);
         if (m != null) {
             return true;
         }
         Wait(WaitScanRate);
     }
     return false;
 }
Exemplo n.º 13
0
 public void DragDrop(PatternBase from, PatternBase to)
 {
     Hover(from);
     appWin.Mouse.LeftDown();
     Hover(to);
     appWin.Mouse.LeftUp();
 }
Exemplo n.º 14
0
 public static void IsNotExisted(Region r,PatternBase pattern)
 {
     IsTrue(r.Find(pattern) == null, "{0} is existed!", pattern.ToString());
 }
Exemplo n.º 15
0
 public void Hover(PatternBase pattern)
 {
     Match m = Find(pattern);
     Hover(m);
 }
Exemplo n.º 16
0
 public Match(Region parent,PatternBase pattern)
     : base(parent.AppWin)
 {
     this.Pattern = pattern;
     this.Parent = parent;
 }
Exemplo n.º 17
0
 public void Click(PatternBase pattern)
 {
     Match m = Find(pattern);
     Click(m);
 }