示例#1
0
        public static void OpenChromeDevTools(int processId, bool hasOkButton = true)
        {
            int i = 0;

            while (i < 10)
            {
                int devWarnDialogHwnd = GetOpenDevToolsWarning(processId);
                if (devWarnDialogHwnd == 0)
                {
                    Thread.Sleep(50);
                    i++;
                    continue;
                }
                int okButonHwnd = hasOkButton ? FindOkButtonHwnd(devWarnDialogHwnd) : FindNoButtonHwnd(devWarnDialogHwnd);
                if (okButonHwnd == 0)
                {
                    throw new Exception("Can't Find Ok Button in warning dialog.");
                }
                for (int j = 0; j < 10; j++)
                {
                    WinApi.ClickPointBySendMessage(okButonHwnd, 10, 10);
                    Thread.Sleep(50);
                    if (!WinApi.IsHwndAlive(okButonHwnd))
                    {
                        goto DONE;
                    }
                }
            }
            DONE :;
        }
示例#2
0
        public bool Nav(string text, ChatDesk chatDesk)
        {
            bool result = false;

            try
            {
                chatDesk.Automator.OpenWorkbench();
                Util.WaitFor(() => false, 300, 300, false);
                HwndInfo hwndInfo = new HwndInfo(this.AddrTextBoxHwnd, "AddrTextBoxHwnd");
                WinApi.ClickPointBySendMessage(hwndInfo.Handle, 30, 5);
                Util.WaitFor(() => false, 100, 100, false);
                WinApi.Editor.SetText(hwndInfo, text, true);
                for (int i = 0; i < 2; i++)
                {
                    Util.WaitFor(() => false, 100, 100, false);
                    WinApi.ClickHwndBySendMessage(hwndInfo.Handle, 1);
                    WinApi.PressEnterKey();
                }
                result = true;
            }
            catch (Exception e)
            {
                Log.Exception(e);
                result = false;
            }
            return(result);
        }
示例#3
0
 private void ClickInfoWindow()
 {
     try
     {
         if (_desk.AssistWindow != null)
         {
             var toLogicalRatioWithUIThread = _desk.AssistWindow.ToLogicalRatioWithUIThread;
             int x = (int)(268.0 / toLogicalRatioWithUIThread.XRatio);
             int y = (int)(104.0 / toLogicalRatioWithUIThread.YRatio);
             WinApi.ClickPointBySendMessage(_desk.Hwnd.Handle, x, y);
         }
     }
     catch (Exception e)
     {
         Log.Exception(e);
     }
 }
示例#4
0
 private void ClickMemberName(int hWnd)
 {
     if (hWnd != 0)
     {
         if (_desk.AssistWindow != null)
         {
             WndAssist.XYRatio toLogicalRatioWithUIThread = _desk.AssistWindow.ToLogicalRatioWithUIThread;
             int x = (int)(88.0 / toLogicalRatioWithUIThread.XRatio);
             int y = (int)(54.0 / toLogicalRatioWithUIThread.YRatio);
             WinApi.ClickPointBySendMessage(hWnd, x, y);
         }
         else
         {
             Log.Info("AssistWindow==null,无法ClickMemberName,seller=" + _desk.Seller);
         }
     }
 }
示例#5
0
 private void ClickTask()
 {
     try
     {
         int               toolbarPlusHwnd            = _desk.Automator.ToolbarPlusHwnd;
         Rectangle         windowRectangle            = WinApi.GetWindowRectangle(toolbarPlusHwnd);
         WndAssist.XYRatio toLogicalRatioWithUIThread = Wnd.ToLogicalRatioWithUIThread;
         int               xr = (int)(100.0 / toLogicalRatioWithUIThread.XRatio);
         int               yr = (int)(15.0 / toLogicalRatioWithUIThread.YRatio);
         int               x  = windowRectangle.Width - xr;
         int               y  = windowRectangle.Height - yr;
         WinApi.ClickPointBySendMessage(toolbarPlusHwnd, x, y);
     }
     catch (Exception e)
     {
         Log.Exception(e);
     }
 }
示例#6
0
        private static int OpenNewChromeDevTools(ChatDesk desk)
        {
            var debugHwnd = 0;

            AssertSingleChatChromeVisible(desk);
            if (!WinApi.BringTopAndDoAction(desk.Hwnd.Handle, () =>
            {
                var chatRecordChromeHwnd = desk.Automator.ChatRecordChromeHwnd;
                WinApi.ClickPointBySendMessage(chatRecordChromeHwnd, 5, 5);
                WinApi.PressF12();
                Thread.Sleep(100);
                OpenChromeDevTools(desk.AliappProcessId);
                debugHwnd = GetExistChromeDevTools(desk.AliappProcessId, 5);
                AssertSingleChatChrome(debugHwnd);
                HideChromeDebugWindow = debugHwnd > 0;
                HideChromeDevDebugWindow(debugHwnd);
            }, 5))
            {
                throw new Exception("Can't bring chat desk to top");
            }
            return(debugHwnd);
        }