本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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();
}
}
}