public void AddImageDragDropListener(IActionListener listener) { pictureBoxSource.DragDrop += (sender, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { var data = e.Data.GetData(DataFormats.FileDrop) as string[]; if (data != null && data.Length > 0) { listener.ActionPerformed(sender, new MyDragDropEventArgs<string[]>(data)); } } }; pictureBoxTarget.DragDrop += (sender, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { var data = e.Data.GetData(DataFormats.FileDrop) as string[]; if (data != null && data.Length > 0) { listener.ActionPerformed(sender, new MyDragDropEventArgs<string[]>(data)); } } }; }
private ToolTip GetToolTip(UIItem uiItem, IActionListener actionListener) { mouse.Click(uiItem.Bounds.Center()); actionListener.ActionPerformed(Action.WindowMessage); Thread.Sleep(CoreAppXmlConfiguration.Instance.TooltipWaitTime); return ToolTip.GetFrom(uiItem.Bounds.Center()); }
protected virtual void Scroll(ScrollAmount amount) { if (!IsScrollable) { return; } switch (amount) { case ScrollAmount.LargeDecrement: ScrollPattern.SetScrollPercent( ScrollPattern.Current.HorizontalScrollPercent, ValidPercentage(ScrollPattern.Current.VerticalScrollPercent - ScrollPercentage)); break; case ScrollAmount.SmallDecrement: ScrollPattern.SetScrollPercent( ScrollPattern.Current.HorizontalScrollPercent, ValidPercentage(ScrollPattern.Current.VerticalScrollPercent - SmallPercentage())); break; case ScrollAmount.LargeIncrement: ScrollPattern.SetScrollPercent( ScrollPattern.Current.HorizontalScrollPercent, ValidPercentage(ScrollPattern.Current.VerticalScrollPercent + ScrollPercentage)); break; case ScrollAmount.SmallIncrement: ScrollPattern.SetScrollPercent( ScrollPattern.Current.HorizontalScrollPercent, ValidPercentage(ScrollPattern.Current.VerticalScrollPercent + SmallPercentage())); break; } actionListener.ActionPerformed(Action.Scroll); }
private ToolTip GetToolTip(UIItem uiItem, IActionListener actionListener) { mouse.LeftClick(uiItem.Bounds.Center()); actionListener.ActionPerformed(Action.WindowMessage); Thread.Sleep(CoreAppXmlConfiguration.Instance.TooltipWaitTime); return(ToolTip.GetFrom(uiItem.Bounds.Center())); }
/// <summary> /// Implements <see cref="IUIItem.Enter"/> /// </summary> public virtual void Enter(string value) { var pattern = automationElement.Patterns.Value.PatternOrDefault; if (pattern != null) { pattern.SetValue(string.Empty); } if (string.IsNullOrEmpty(value)) { return; } actionListener.ActionPerformed(Action.WindowMessage); EnterData(value); }
/// <summary> /// Implements <see cref="IUIItem.Enter"/> /// </summary> public virtual void Enter(string value) { var pattern = Pattern(ValuePattern.Pattern) as ValuePattern; if (pattern != null) { pattern.SetValue(string.Empty); } if (string.IsNullOrEmpty(value)) { return; } actionListener.ActionPerformed(Action.WindowMessage); EnterData(value); }
public void Click(Point click) { if (Position.Contains(click)) { mListener?.ActionPerformed(); Background = Color.Aqua; } }
protected virtual void Scroll(ScrollAmount amount) { if (!IsScrollable) { return; } ScrollPattern.ScrollVertical(amount); actionListener.ActionPerformed(Action.Scroll); }
protected virtual void Scroll(ScrollAmount amount) { if (!IsScrollable) { return; } ScrollPattern.ScrollHorizontal(amount); actionListener.ActionPerformed(Action.WindowMessage); }
protected virtual void Scroll(ScrollAmount amount) { if (!IsScrollable) { return; } ScrollPattern.Scroll(0, amount); actionListener.ActionPerformed(Action.Scroll); throw new InvalidOperationException("Verifyu this (amount vs value)"); }
protected virtual void Scroll(ScrollAmount amount) { if (!IsScrollable) { return; } ScrollPattern.Scroll(amount, 0); actionListener.ActionPerformed(Action.WindowMessage); throw new InvalidOperationException("Verify the above, we scroll by enum value instead of actula value?"); }
public virtual void Send(string keysToType, IActionListener actionListener) { if (heldKeys.Count > 0) { keysToType = keysToType.ToLower(); } CapsLockOn = false; foreach (char c in keysToType) { short key = VkKeyScan(c); if (c.Equals('\r')) { continue; } if (ShiftKeyIsNeeded(key)) { SendKeyDown((short)KeyboardInput.SpecialKeys.SHIFT, false); } if (CtrlKeyIsNeeded(key)) { SendKeyDown((short)KeyboardInput.SpecialKeys.CONTROL, false); } if (AltKeyIsNeeded(key)) { SendKeyDown((short)KeyboardInput.SpecialKeys.ALT, false); } Press(key, false); if (ShiftKeyIsNeeded(key)) { SendKeyUp((short)KeyboardInput.SpecialKeys.SHIFT, false); } if (CtrlKeyIsNeeded(key)) { SendKeyUp((short)KeyboardInput.SpecialKeys.CONTROL, false); } if (AltKeyIsNeeded(key)) { SendKeyUp((short)KeyboardInput.SpecialKeys.ALT, false); } } actionListener.ActionPerformed(Action.WindowMessage); }
/// <summary> /// Implements <see cref="IKeyboardWithActionListener.Send(string, IActionListener)"/> /// </summary> public virtual void Send(string keysToType, IActionListener actionListener) { if (HeldKeys.Count() > 0) { keysToType = keysToType.ToLower(); } CapsLockOn = false; foreach (var key in from c in keysToType let key = KeyboardWin32.VkKeyScan(c) where !c.Equals('\r') select key) { if (KeyboardWin32.ShiftKeyIsNeeded(key)) { SendKeyDown((short)KeyboardInput.SpecialKeys.SHIFT, false); } if (KeyboardWin32.CtrlKeyIsNeeded(key)) { SendKeyDown((short)KeyboardInput.SpecialKeys.CONTROL, false); } if (KeyboardWin32.AltKeyIsNeeded(key)) { SendKeyDown((short)KeyboardInput.SpecialKeys.ALT, false); } Press(key, false); if (KeyboardWin32.ShiftKeyIsNeeded(key)) { SendKeyUp((short)KeyboardInput.SpecialKeys.SHIFT, false); } if (KeyboardWin32.CtrlKeyIsNeeded(key)) { SendKeyUp((short)KeyboardInput.SpecialKeys.CONTROL, false); } if (KeyboardWin32.AltKeyIsNeeded(key)) { SendKeyUp((short)KeyboardInput.SpecialKeys.ALT, false); } } actionListener.ActionPerformed(Action.WindowMessage); }
/// <summary> /// Implements <see cref="IKeyboardWithActionListener.ActionPerformed(IActionListener)"/> /// </summary> /// <remarks> public virtual void ActionPerformed(IActionListener actionListener) { actionListener.ActionPerformed(new Action(ActionType.WindowMessage)); }
/// <summary> /// Implements <see cref="IKeyboardWithActionListener.LeaveKey(KeyboardInput.SpecialKeys, IActionListener)"/> /// </summary> public virtual void LeaveKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { SendKeyUp((short)key, true); RemoveUsedKey(key); actionListener.ActionPerformed(Action.WindowMessage); }
/// <summary> /// Implements <see cref="IKeyboardWithActionListener.HoldKey(KeyboardInput.SpecialKeys, IActionListener)"/> /// </summary> public virtual void HoldKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { SendKeyDown((short)key, true); AddUsedKey(key); actionListener.ActionPerformed(Action.WindowMessage); }
public virtual void PressSpecialKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { Send(key, true); actionListener.ActionPerformed(Action.WindowMessage); }
public virtual void Send(string keysToType, IActionListener actionListener) { if (heldKeys.Count > 0) keysToType = keysToType.ToLower(); CapsLockOn = false; foreach (char c in keysToType) { short key = VkKeyScan(c); if (c.Equals('\r')) continue; if (ShiftKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.SHIFT, false); if (CtrlKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.CONTROL, false); if (AltKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.ALT, false); Press(key, false); if (ShiftKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.SHIFT, false); if (CtrlKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.CONTROL, false); if (AltKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.ALT, false); } actionListener.ActionPerformed(Action.WindowMessage); }
internal virtual void HoldKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { SendKeyDown((short) key, true); heldKeys.Add(key); actionListener.ActionPerformed(Action.WindowMessage); }
public virtual void LeaveKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { SendKeyUp((short) key, true); heldKeys.Remove(key); actionListener.ActionPerformed(Action.WindowMessage); }
private void ActionPerformed() { actionListener.ActionPerformed(Action.WindowMessage); }
private static void ActionPerformed(IActionListener actionListener) { actionListener.ActionPerformed(new Action(ActionType.WindowMessage)); }
public void AddLoadSourceListener(IActionListener listener) { btnLoadSource.Click += (sender, e) => { using (var fileDialog = new OpenFileDialog()) { if (fileDialog.ShowDialog() != DialogResult.OK) return; listener.ActionPerformed(pictureBoxFilterInput, new MyFileEventArgs(fileDialog.FileName)); } }; }
/// <summary> /// Implements <see cref="IKeyboardWithActionListener.PressSpecialKey(KeyboardInput.SpecialKeys, IActionListener)"/> /// </summary> public virtual void PressSpecialKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { Send(key, true); actionListener.ActionPerformed(Action.WindowMessage); }
private static void ActionPerformed(IActionListener actionListener) { actionListener.ActionPerformed(new Action(ActionType.WindowMessage)); }