public static IUiElement GetOrRegisterAndGetUiElement(this IRenderController renderController, string path)
        {
            var layer = renderController.GetUiElement(path) ??
                        renderController.RegisterUiElement(path, null, null);

            return(layer);
        }
        private static IUiElement GetCachedElement(IRenderController controller, string name)
        {
            if (!uiElementCache.ContainsKey(name) || uiElementCache[name] == null)
            {
                uiElementCache[name] = controller.GetUiElement(name);
            }

            return(uiElementCache[name]);
        }
        public static void CloseChatAndOpenWindows(this IRenderController renderController)
        {
            if (renderController.IsUiElementVisible(UiPathConstants.Ui.CHAT_INPUT))
            {
                InputSimulator.PressKey(Keys.Escape);
                WaitForConditionOrAbortHotkeyEvent(() => !renderController.IsUiElementVisible(UiPathConstants.Ui.CHAT_INPUT));
            }

            InputSimulator.PressKey(Settings.Keybinds[(int)ActionKey.Close]);
            Thread.Sleep(25);
        }
Ejemplo n.º 4
0
 public static void WaitForVisiblityAndClickOrAbortHotkeyEvent(this IRenderController renderController, string path,
                                                               int maxWaitTimeMs = 2000, int intervalMs = 25, bool leftClick = true)
 {
     WaitForConditionOrAbortHotkeyEvent(() => renderController.IsUiElementVisible(path), maxWaitTimeMs, intervalMs);
     if (leftClick)
     {
         renderController.GetOrRegisterAndGetUiElement(path).Click();
     }
     else
     {
         renderController.GetOrRegisterAndGetUiElement(path).RightClick();
     }
 }
 public static IUiElement WaypointMapWorldMapUiElement(this IRenderController controller)
 {
     return(GetCachedElement(controller, "Root.NormalLayer.WaypointMap_main.LayoutRoot.OverlayContainer.WorldMap"));
 }
 public static IUiElement ChatEditLineUiElement(this IRenderController controller)
 {
     return(GetCachedElement(controller, "Root.NormalLayer.chatentry_dialog_backgroundScreen.chatentry_content.chat_editline"));
 }
 public static IUiElement InventorySidePaneUiElement(this IRenderController controller)
 {
     return(GetCachedElement(controller, "Root.NormalLayer.inventory_side_pane_container"));
 }
        public static bool IsUiElementVisible(this IRenderController renderController, string path)
        {
            var uiElement = renderController.GetOrRegisterAndGetUiElement(path);

            return(!(uiElement is null) && uiElement.Visible);
        }
Ejemplo n.º 9
0
 public static void WaitForVisiblityAndRightClickOrAbortHotkeyEvent(this IRenderController renderController, string path,
                                                                    int maxWaitTimeMs = 2000, int intervalMs = 25)
 {
     WaitForVisiblityAndClickOrAbortHotkeyEvent(renderController, path, maxWaitTimeMs, intervalMs, false);
 }
 public static bool IsShopOpen(this IRenderController renderController)
 {
     return(renderController.IsUiElementVisible(UiPathConstants.Vendor.CURRENCY_TYPE));
 }