Example #1
0
        public override void Invoke(IController hud)
        {
            hud.Render.WaitForVisiblityAndClickOrAbortHotkeyEvent(UiPathConstants.Paragon.NEW_PARAGON_BUTTON);
            hud.Render.WaitForVisiblityAndClickOrAbortHotkeyEvent(UiPathConstants.Paragon.PARAGON_TAB_CORE);
            var paragonAvailable = Double.Parse(hud.Render.GetUiElement(UiPathConstants.Paragon.PARAGON_UNSPENT_CORE).ReadText(System.Text.Encoding.ASCII, true));
            var amountOfClicks   = (int)Math.Ceiling(paragonAvailable / 100);

            if (amountOfClicks == 0)
            {
                hud.Render.WaitForVisiblityAndClickOrAbortHotkeyEvent(UiPathConstants.Paragon.PARAGON_BUTTON_CLOSE);
            }

            InputSimulator.PostMessageKeyDown(Keys.ControlKey);
            for (int i = 0; i < amountOfClicks; i++)
            {
                if (Vitality)
                {
                    hud.Render.WaitForVisiblityAndClickOrAbortHotkeyEvent(UiPathConstants.Paragon.PARAGON_BUTTON_SECOND);
                }
                else
                {
                    hud.Render.WaitForVisiblityAndClickOrAbortHotkeyEvent(UiPathConstants.Paragon.PARAGON_BUTTON_FIRST);
                }
            }
            hud.Render.WaitForVisiblityAndClickOrAbortHotkeyEvent(UiPathConstants.Paragon.PARAGON_BUTTON_ACCEPT);
            //Call keyUp after closing the interface because it can block the accept button click going through
            InputSimulator.PostMessageKeyUp(Keys.ControlKey);
        }