public void Say(PatternBase pattern, string text) { DoubleClick(pattern); ShortcutKey("LControl", "A"); Press("Back"); Window edit = Window.GetMousePointWindow(); edit.Say(text); }
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); } }
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); }
public void RightClick(PatternBase pattern) { Match m = Find(pattern); RightClick(m); }
public void MiddleClick(PatternBase pattern) { Match m = Find(pattern); MiddleClick(m); }
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); }
/// <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; }
public void DoubleClick(PatternBase pattern) { Match m = Find(pattern); DoubleClick(m); }
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()); }
/// <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; }
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()); }
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; }
public void DragDrop(PatternBase from, PatternBase to) { Hover(from); appWin.Mouse.LeftDown(); Hover(to); appWin.Mouse.LeftUp(); }
public static void IsNotExisted(Region r,PatternBase pattern) { IsTrue(r.Find(pattern) == null, "{0} is existed!", pattern.ToString()); }
public void Hover(PatternBase pattern) { Match m = Find(pattern); Hover(m); }
public Match(Region parent,PatternBase pattern) : base(parent.AppWin) { this.Pattern = pattern; this.Parent = parent; }
public void Click(PatternBase pattern) { Match m = Find(pattern); Click(m); }