public string GetBuyerNameFromTaskWindow() { string buyerName = ""; if (!CanGetTaskWindow()) { return(buyerName); } List <int> taskWinHwnds; int taskHwnd = TryGetTaskWindow(out taskWinHwnds); if (taskHwnd > 0) { buyerName = GetBuyerNameFromTaskWindow(taskHwnd); WinApi.CloseWindow(taskHwnd, 2000); _desk.DelayFocusEditor(200); } if (buyerName != null) { buyerName = buyerName.Trim(); string endStr = "(阿里巴巴中国站)"; if (buyerName.EndsWith(endStr)) { buyerName = buyerName.Substring(0, buyerName.Length - endStr.Length); } } return(buyerName); }
public string GetBuyerNameFromBuyerInfoWindow() { string buyerName = ""; if (!CanGetTaskWindow()) { return(buyerName); } int buyerInfoHwnd = TryGetBuyerInfoWindow(); if (buyerInfoHwnd > 0) { WinApi.HideDeskWindow(buyerInfoHwnd); buyerName = GetBuyerNameFromBuyerInfoWindow(buyerInfoHwnd); WinApi.CloseWindow(buyerInfoHwnd); _desk.DelayFocusEditor(); } if (buyerName != null) { buyerName = buyerName.Trim(); string endStr = "(阿里巴巴中国站)"; if (buyerName.EndsWith(endStr)) { buyerName = buyerName.Substring(0, buyerName.Length - endStr.Length); } } if (string.IsNullOrEmpty(buyerName)) { _getTaskWindowFailCount++; if (_latestFailTime.xElapse().TotalMinutes < 3.0) { _continuousFailCount++; } else { _latestFailTime = DateTime.Now; _continuousFailCount = 1; } } else { _getTaskWindowSuccessOnce = true; _getTaskWindowFailCount = 0; } return(buyerName); }