当前位置: 首页>>代码示例>>C#>>正文


C# UIElement.Click方法代码示例

本文整理汇总了C#中UIElement.Click方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.Click方法的具体用法?C# UIElement.Click怎么用?C# UIElement.Click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIElement的用法示例。


在下文中一共展示了UIElement.Click方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SafeClickElement

        /// <summary>
        /// Checks to see if ZetaDia.Me.IsValid, element is visible, triggers fireWorldTransferStart if needed and clicks the element
        /// </summary>
        /// <param name="element"></param>
        /// <param name="name"></param>
        /// <param name="fireWorldTransfer"></param>
        /// <returns></returns>
        public static bool SafeClickElement(UIElement element, string name = "", bool fireWorldTransfer = false)
        {
            if (!Trinity.Player.IsValid)
                return false;
            if (!IsElementVisible(element))
                return false;
            if (fireWorldTransfer)
                GameEvents.FireWorldTransferStart();

            Logger.Log("Clicking UI element {0} ({1})", name, element.BaseAddress);
            element.Click();
            return true;
        }
开发者ID:MGramolini,项目名称:Trinity,代码行数:20,代码来源:GameUI.cs

示例2: SafeClickElement

        /// <summary>
        /// Checks to see if ZetaDia.Me.IsValid, element is visible, triggers fireWorldTransferStart if needed and clicks the
        /// element
        /// </summary>
        /// <param name="element"></param>
        /// <param name="name"></param>
        /// <param name="fireWorldTransfer"></param>
        /// <returns></returns>
        public static bool SafeClickElement(UIElement element, string name = "", bool fireWorldTransfer = false)
        {
            if (!ZetaDia.IsInGame)
                return false;

            if (!IsElementVisible(element))
                return false;

            if (fireWorldTransfer)
                GameEvents.FireWorldTransferStart();

            Log.Info("Clicking UI element {0} ({1})", name, element.BaseAddress);
            element.Click();
            return true;
        }
开发者ID:dachidahu,项目名称:AutoFollow,代码行数:23,代码来源:GameUI.cs

示例3: SafeClick

        /// <summary>
        /// Clicks a UI Element after a random interval. 
        /// </summary>
        /// <param name="uiElement"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        internal static bool SafeClick(UIElement uiElement, ClickDelay delayOption, string name = "", int postClickThreadSleepDuration = 0, bool fireWorldTransferStart = false)
        {
            try
            {
                if (DateTime.UtcNow.Subtract(_lastClick).TotalMilliseconds < 500)
                    return false;

                if (ElementIsVisible(uiElement, name))
                {
                    if (!String.IsNullOrEmpty(name))
                    {
                        Logr.Debug("{0} button is visible", name);
                    }
                    else
                    {
                        Logr.Debug("{0}={1} is visible", uiElement.Hash, uiElement.Name);
                    }

                    if (!clickTimer.IsRunning && delayOption == ClickDelay.Delay)
                    {
                        clickTimer.Start();
                        SetClickTimerRandomVal();
                    }
                    else if ((ClickTimerRandomReady() && ElementIsVisible(uiElement, name)) || delayOption == ClickDelay.NoDelay)
                    {
                        if (!String.IsNullOrEmpty(name))
                        {
                            Logr.Log("Clicking {0} button", name);
                        }
                        else
                        {
                            Logr.Log("Clicking {0}={1}", uiElement.Hash, uiElement.Name);
                        }

                        // sleep plugins for a bit
                        if (ZetaDia.IsInGame && fireWorldTransferStart)
                            GameEvents.FireWorldTransferStart();

                        _lastClick = DateTime.UtcNow;
                        uiElement.Click();
                        //BotMain.PauseFor(TimeSpan.FromMilliseconds(ClickThreadSleepInterval));

                        //if (postClickThreadSleepDuration > 0)
                        //    BotMain.PauseFor(TimeSpan.FromMilliseconds(postClickThreadSleepDuration));

                        clickTimer.Reset();
                    }
                    else
                    {
                        Logr.Debug("Pausing bot, waiting for {0}={1}", uiElement.Hash, uiElement.Name);
                        BotMain.PauseWhile(ClickTimerRandomNotReady, 0, ClickTimerTimeout);
                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                Logr.Log("Error clicking UI button {0}: " + ex.ToString(), name);
                return false;
            }
        }
开发者ID:mythsya,项目名称:db-plugins,代码行数:67,代码来源:GameUI.cs

示例4: SafeClickElement

        public static void SafeClickElement(UIElement element, string name = "", bool fireWorldTransfer = false)
        {
            if (ZetaDia.Me.IsValid)
            {
                if (IsElementVisible(element))
                {
                    if (fireWorldTransfer)
                        GameEvents.FireWorldTransferStart();

                    Logger.Log("Clicking UI element {0} ({1})", name, element.BaseAddress);
                    element.Click();
                }
            }
        }
开发者ID:mythsya,项目名称:db-plugins,代码行数:14,代码来源:GameUI.cs


注:本文中的UIElement.Click方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。