private string GetBuyerNameUseCache() { string buyerName = ""; Rectangle buyerNameRegion = _desk.Automator.GetBuyerNameRegion(); if (!_desk.IsBoundaryVisable(buyerNameRegion)) { _desk.BringTop(); } if (_desk.IsBoundaryVisable(buyerNameRegion)) { string buyerImageB64Str = GetImageB64StrNoCache(true); if (_bmpB64_buyerNameDict.ContainsKey(buyerImageB64Str)) { buyerName = _bmpB64_buyerNameDict[buyerImageB64Str]; } else { buyerName = GetBuyerNameFromTaskWindow(); if (!string.IsNullOrEmpty(buyerName)) { string buyerImageB64StrNoCache = GetImageB64StrNoCache(false); if (buyerImageB64StrNoCache == buyerImageB64Str) { _bmpB64_buyerNameDict[buyerImageB64Str] = buyerName; } } } } return(buyerName); }
internal static void ActiveChromeDev(ChatDesk desk) { try { bool isForeground = desk.IsForeground; int chromeDevHwnd = GetExistChromeDevTools(desk); Util.Assert(chromeDevHwnd != 0); isForeground = (isForeground || desk.IsForeground); for (int i = 0; i < 5; i++) { if (i > 0) { Thread.Sleep(30); } WinApi.BringTopAndDoAction(chromeDevHwnd, () => { WinApi.PressEsc(); }, 2); } if (isForeground) { desk.BringTop(); } } catch (Exception ex) { Log.Error("ocr2," + ex.Message); } }
private static void DoInject(string injectJs, int chromeDevHwnd, ChatDesk desk, Func <bool> isConnectOk) { for (int i = 0; i < 4; i++) { WinApi.BringTopAndDoAction(chromeDevHwnd, () => { DispatcherEx.xInvoke(() => { WinApi.PressEsc(); }); }, 2); if (i == 0) { Thread.Sleep(4000); } else { Thread.Sleep(4000); } ExcuteJsInner(injectJs, chromeDevHwnd); Thread.Sleep(100); if (isConnectOk()) { break; } } if (desk.IsForeground) { desk.BringTop(); } }
private void Window_MouseDown(object sender, MouseButtonEventArgs e) { if ((DateTime.Now - _preMouseDownTime).TotalSeconds > 1.0) { _preMouseDownTime = DateTime.Now; Desk.BringTop(); } }