public FileViewerInternal() { InitializeComponent(); InitializeComplete(); _currentViewPositionCache = new CurrentViewPositionCache(this); TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e); TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => ScrollPosChanged?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.KeyUp += (s, e) => KeyUp?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.DoubleClick += (s, e) => DoubleClick?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseMove += (s, e) => MouseMove?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseEnter += (s, e) => MouseEnter?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseLeave += (s, e) => MouseLeave?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseDown += (s, e) => { SelectedLineChanged?.Invoke( this, new SelectedLineEventArgs( TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y))); }; HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers", new HighlightColor(Color.FromArgb(80, 0, 0, 0), Color.White, false, false)); TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false; _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea); VRulerPosition = AppSettings.DiffVerticalRulerPosition; }
private void Base_DoubleClick(object sender, EventArgs e) { if (canClick) { DoubleClick?.Invoke(this, e); } }
public void HandleDoubleClick(Point clickPosition, Point pan) { if (Rect.Contains(clickPosition - pan)) { DoubleClick?.Invoke(this, new EventArgs()); } }
public void FireDoubleClick(Position pos) { DoubleClick?.Invoke(this, new EventMapClickedEvent { Position = pos }); }
public void CreateDeal(string dealName, string dealAlias, string currency) { Wait.For(this.GetWindow <MainWindow>(), window => { window.Maximize(); Click.On(window.MenuButtonPane.Actions); DoubleClick.On(window.MenuButtonTreePane.FindTreeItem("Deal")); }); Wait.For(this.GetWindow <DealSelectWindow>(), window => { Click.On(window.NewRadioButton); Enter.TextInto(window.NameTextBox, StringHelpers.GenerateNameWithSuffix(dealName)); Enter.TextInto(window.AliasTextBox, StringHelpers.GenerateNameWithSuffix(dealAlias)); Select.By(window.CurrencyComboBox, currency); Select.By(window.DepartmentComboBox, 0); Click.On(window.OkButton); Wait.For(this.GetWindow <WarningWindow>(), dialog => { Click.On(dialog.YesButton); }); }, WaitToFinish.YES); }
public void SelectAction(string actionItem) { var mainWindow = Container.GetInstance <WindowFactory <MainWindow> >().Context; Click.On(mainWindow.MenuButtonPane.Actions); DoubleClick.On(mainWindow.MenuButtonTreePane.FindTreeItem(actionItem)); }
public void HandleDoubleClick(Point clickPosition, Point pan, float scale = 1) { if (Rect.Contains(new Point((clickPosition - pan) * (1 / scale)))) { DoubleClick?.Invoke(this, new EventArgs()); } }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); if (el == null) { throw new ArgumentException("element cannot be null"); } var doubleclick = false; if (DoubleClick != null) { doubleclick = DoubleClick.Get(context); } var button = Button.Get(context); var virtualClick = false; if (VirtualClick != null) { virtualClick = VirtualClick.Get(context); } var _button = (Input.MouseButton)button; el.Click(virtualClick, _button, OffsetX, OffsetY, doubleclick); }
public OutlinePanel() { View = new OutlineView(); EnclosingScrollView = new ScrollContainerView(View); View.SelectionNodeChanged += (s, e) => { if (View.SelectedNode is WidgetNodeView nodeView) { RaiseFirstResponder?.Invoke(this, nodeView.Wrapper); } }; View.KeyPress += (sender, e) => { if (e == DeleteKey) { if (View.SelectedNode is WidgetNodeView nodeView) { RaiseDeleteItem?.Invoke(this, nodeView.Wrapper); } } }; View.DoubleClick += (sender, e) => { DoubleClick?.Invoke(this, (View.SelectedNode as WidgetNodeView)?.Wrapper); }; View.StartDrag += (sender, e) => { StartDrag?.Invoke(this, (e as WidgetNodeView)?.Wrapper); }; }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); if (el == null) { throw new ArgumentException("element cannot be null"); } var doubleClick = false; if (DoubleClick != null) { doubleClick = DoubleClick.Get(context); } TimeSpan timeout = TimeSpan.FromSeconds(0); //if (Timeout != null) timeout = Timeout.Get(context); var button = Button.Get(context); var virtualClick = false; if (VirtualClick != null) { virtualClick = VirtualClick.Get(context); } // if (button != (int)Input.MouseButton.Left) { VirtualClick = false; } //var flabuttun = (FlaUI.Core.Input.MouseButton)Enum.Parse(typeof(FlaUI.Core.Input.MouseButton), button.ToString(), true); //el.Click(AnimateMouse.Get(context), flabuttun, doubleClick, OffsetX, OffsetY, timeout, virtualClick); var _button = (Input.MouseButton)button; el.Click(virtualClick, _button, OffsetX, OffsetY); }
/// <summary> /// Handles most events of the control /// </summary> /// <param name="eventName">Type of event to raise</param> /// <remarks></remarks> public void DoEvent(LightweightEvents eventName) { switch (eventName) { case LightweightEvents.Click: DoClick(); break; case LightweightEvents.MouseDown: if (canClick) { isPressed = true; Redraw(); } MouseDown?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); break; case LightweightEvents.MouseUp: if (canClick) { isPressed = false; Redraw(); } MouseUp?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); break; case LightweightEvents.MouseEnter: Scrolling = true; MouseEnter?.Invoke(this, new EventArgs()); break; case LightweightEvents.MouseLeave: Scrolling = false; MouseLeave?.Invoke(this, new EventArgs()); break; case LightweightEvents.Update: Update?.Invoke(this, null); break; case LightweightEvents.DoubleClick: DoubleClick?.Invoke(this, new EventArgs()); break; case LightweightEvents.MouseMove: MouseMove?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); break; default: throw new NotImplementedException("The requested event for this control does not exist"); } }
public bool PropagateDoubleClick(Point mousePosition) { if (Visibility == Visibility.Hidden) { return(false); } if (mousePosition.X >= AbsolutePosition.X && mousePosition.X <= AbsolutePosition.X + Width && mousePosition.Y >= AbsolutePosition.Y && mousePosition.Y <= AbsolutePosition.Y + Height) { if (Children.Count > 0) { bool ret = false; for (int i = Children.Count - 1; i >= 0; i--) { LogicalNode child = Children[i]; if (child.PropagateDoubleClick(mousePosition)) { ret = true; } if (ret) { break; } } if (ret == false) { DoubleClick?.Invoke(this, null); foreach (MenuEvent ev in events.Values) { if (ev.EventType == MenuEvent.Type.DoubleClick) { ev.Trigger(this); } } return(true); } else { return(ret); } } else { DoubleClick?.Invoke(this, null); foreach (MenuEvent ev in events.Values) { if (ev.EventType == MenuEvent.Type.DoubleClick) { ev.Trigger(this); } } return(true); } } else { return(false); } }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); if (el == null) { throw new ArgumentException("element cannot be null"); } var doubleclick = false; if (DoubleClick != null) { doubleclick = DoubleClick.Get(context); } var button = Button.Get(context); var virtualClick = false; if (VirtualClick != null) { virtualClick = VirtualClick.Get(context); } var animatemouse = false; if (AnimateMouse != null) { animatemouse = AnimateMouse.Get(context); } var keymodifiers = ""; if (KeyModifiers != null) { keymodifiers = KeyModifiers.Get(context); } var disposes = new List <IDisposable>(); var keys = TypeText.GetKeys(keymodifiers); foreach (var vk in keys) { disposes.Add(FlaUI.Core.Input.Keyboard.Pressing(vk)); } var _button = (Input.MouseButton)button; el.Click(virtualClick, _button, OffsetX, OffsetY, doubleclick, animatemouse); disposes.ForEach(x => { x.Dispose(); }); TimeSpan postwait = TimeSpan.Zero; if (PostWait != null) { postwait = PostWait.Get(context); } if (postwait != TimeSpan.Zero) { System.Threading.Thread.Sleep(postwait); } }
protected virtual void OnDoubleClick(ButtonHandlerEventArgs e) { if (!_initialized) { throw new InvalidOperationException($"Not initialized {_pin}"); } DoubleClick?.Invoke(this, e); }
protected void HandleMouseDown(IMouse mouse, MouseButton button) { MouseDown?.Invoke(mouse, button); if (_firstClick || (_firstClickButton != null && _firstClickButton != button)) { // This is the first click with the given mouse button. _firstClickTime = null; if (!_firstClick && !(_firstClickButton is null)) { // Only the mouse buttons differ so treat last click as a single click. Click?.Invoke(mouse, _firstClickButton.Value, Position); } ProcessFirstClick(button); } else { // This is the second click with the same mouse button. if (_firstClickTime != null && (DateTime.Now - _firstClickTime.Value).TotalMilliseconds <= DoubleClickTime) { // Within the maximum double click time. _firstClickTime = null; var position = Position; if (Math.Abs(position.X - _firstClickPosition.X) < DoubleClickRange && Math.Abs(position.Y - _firstClickPosition.Y) < DoubleClickRange) { // Second click was in time and in range -> double click. _firstClick = true; DoubleClick?.Invoke(mouse, button, position); } else { // Second click was in time but outside range -> single click. // The second click is another "first click". Click?.Invoke(mouse, button, position); ProcessFirstClick(button); } } else { // The double click time elapsed. // If Update() would have detected the time elapse before, // it would have set _firstClick back to true and we won't be here. // Therefore Update() has not detected time elapse here and we have // to handle it. HandleDoubleClickTimeElapse(); // Now process the second click as another "first click". ProcessFirstClick(button); } } }
public void OnPointerClick(PointerEventData eventData) { FirstClick?.Invoke(this, null); if (eventData.clickCount == 2 || (Input.touchCount > 0 && Input.GetTouch(0).tapCount == 2)) { DoubleClick?.Invoke(this, null); } }
public static void MaximizeWindow(this Window window) { if (window.Patterns.Window.Pattern.CanMaximize.Value && window.Patterns.Window.Pattern.WindowVisualState.Value != WindowVisualState.Maximized) { DoubleClick.On(window.TitleBar); var logger = InjectionHelper.GetInstance <DesktopLogger>(); logger.Write(window, "has been maximized"); } }
void DoubleClicked(jQueryMouseEvent evt) { var tr = new jQuery(evt.Target).Closest("tr"); if(tr.Length == 0) return; var idx = (int) tr.Data("row-id"); if(!rowBindings.ContainsKey(idx)) return; var obj = rowBindings[idx]; DoubleClick?.Invoke(this, obj); }
private void MouseButtonDownHandler(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2) { LabelDoubleClickArgs eventArgs = new LabelDoubleClickArgs(); eventArgs.Page = TaskPage; DoubleClick?.Invoke(sender, eventArgs); } }
private IntPtr HookFunc(int nCode, IntPtr wParam, IntPtr lParam) { // Parse system messages if (nCode >= 0) { if (MouseMessages.WM_LBUTTONDOWN == (MouseMessages)wParam) { LeftButtonDown?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_LBUTTONUP == (MouseMessages)wParam) { LeftButtonUp?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_RBUTTONDOWN == (MouseMessages)wParam) { RightButtonDown?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_RBUTTONUP == (MouseMessages)wParam) { RightButtonUp?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_MOUSEMOVE == (MouseMessages)wParam) { MouseMove?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_MOUSEWHEEL == (MouseMessages)wParam) { MouseWheel?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_LBUTTONDBLCLK == (MouseMessages)wParam) { DoubleClick?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_MBUTTONDOWN == (MouseMessages)wParam) { MiddleButtonDown?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } if (MouseMessages.WM_MBUTTONUP == (MouseMessages)wParam) { MiddleButtonUp?.Invoke( (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT))); } } return(CallNextHookEx(_hookId, nCode, wParam, lParam)); }
private void EventsSubscribe() { foreach (var item in _inventorySlots) { item.FirstClick += (obj, e) => SetActiveSlot((InventorySlot)obj); item.DoubleClick += (obj, e) => DoubleClick?.Invoke(obj, e); item.DragStarted += (obj, e) => DragStarted((InventorySlot)obj, e); item.Drag += (obj, e) => Drag((InventorySlot)obj, e); item.DragEnded += (obj, e) => OnDragEnded((InventorySlot)obj, e); } }
private void ProcessMouseDown(MouseButtons button, bool doubleClick) { if (doubleClick) { DoubleClick?.Invoke(this, new MouseEventArgs(button, 2, 0, 0, 0)); MouseDoubleClick?.Invoke(this, new MouseEventArgs(button, 2, 0, 0, 0)); _doubleClickDown = true; } MouseDown?.Invoke(this, new MouseEventArgs(button, doubleClick ? 2 : 1, 0, 0, 0)); }
/// <summary> /// Raise event to go forward. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DragTime(object sender, EventArgs e) { // Stop the timer ((DispatcherTimer)sender).Stop(); if (!this.CursorIsOver() || Collection.level == Constants.Level.Episode) { return; } DoubleClick?.Invoke(this.Index, e); }
private void MainGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Selected?.Invoke(); IsSelected = true; mainGrid.Background = new SolidColorBrush(Color.FromRgb(216, 237, 255)); if (e.ClickCount == 2) { DoubleClick?.Invoke(); } }
protected override int HookCallbackProcedure(int nCode, int wParam, IntPtr lParam) { if (nCode > -1 && (MouseDown != null || MouseUp != null || MouseMove != null)) { MouseLLHookStruct mouseHookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct)); MouseButtons button = GetButton(wParam); MouseEventType eventType = GetEventType(wParam); MouseEventArgs e = new MouseEventArgs( button, (eventType == MouseEventType.DoubleClick ? 2 : 1), mouseHookStruct.pt.x, mouseHookStruct.pt.y, (eventType == MouseEventType.MouseWheel ? (short)((mouseHookStruct.mouseData >> 16) & 0xffff) : 0)); // Prevent multiple Right Click events (this probably happens for popup menus) if (button == MouseButtons.Right && mouseHookStruct.flags != 0) { eventType = MouseEventType.None; } switch (eventType) { case MouseEventType.MouseDown: MouseDown?.Invoke(this, e); break; case MouseEventType.MouseUp: Click?.Invoke(this, new EventArgs()); MouseUp?.Invoke(this, e); break; case MouseEventType.DoubleClick: DoubleClick?.Invoke(this, new EventArgs()); break; case MouseEventType.MouseWheel: MouseWheel?.Invoke(this, e); break; case MouseEventType.MouseMove: MouseMove?.Invoke(this, e); break; default: break; } } return(CallNextHookEx(_handleToHook, nCode, wParam, lParam)); }
private IEnumerator WaitAndInvoke(int clickCount) { yield return(new WaitForSeconds(0.2f)); if (clickCount == 1) { SingleClick?.Invoke(); } else if (clickCount == 2) { DoubleClick?.Invoke(); } LastClick?.Invoke(clickCount); }
/* * ============================================ * Event * ============================================ */ #region Event /// <summary> /// Double click on the tile. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tile_DoubleClick(object sender, MouseButtonEventArgs e) { // Don't do forward when holding the control key if (Keyboard.IsKeyDown(Key.LeftCtrl)) { return; } // The event is itercepeted in MainWindow, giving the order to the TileList to go to the next level if (e.ChangedButton == MouseButton.Left) { DoubleClick?.Invoke(this.Index, e); } }
public FileViewerInternal() { InitializeComponent(); InitializeComplete(); Disposed += (sender, e) => { //// _diffHighlightService not disposable //// _lineNumbersControl not disposable //// _currentViewPositionCache not disposable _findAndReplaceForm.Dispose(); }; _currentViewPositionCache = new CurrentViewPositionCache(this); TextEditor.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += SelectionManagerSelectionChanged; TextEditor.ActiveTextAreaControl.TextArea.PreviewKeyDown += (s, e) => { if (e.KeyCode == Keys.Escape && !TextEditor.ActiveTextAreaControl.SelectionManager.HasSomethingSelected) { EscapePressed?.Invoke(); } }; TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e); TextEditor.ActiveTextAreaControl.HScrollBar.ValueChanged += (s, e) => OnHScrollPositionChanged(EventArgs.Empty); TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => OnVScrollPositionChanged(EventArgs.Empty); TextEditor.ActiveTextAreaControl.TextArea.KeyUp += (s, e) => KeyUp?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.DoubleClick += (s, e) => DoubleClick?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseMove += (s, e) => MouseMove?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseEnter += (s, e) => MouseEnter?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseLeave += (s, e) => MouseLeave?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseDown += (s, e) => { SelectedLineChanged?.Invoke( this, new SelectedLineEventArgs( TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y))); }; TextEditor.ActiveTextAreaControl.TextArea.MouseWheel += TextArea_MouseWheel; HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers", new HighlightColor(SystemColors.ControlText, SystemColors.Control, false, false)); TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false; _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea); VRulerPosition = AppSettings.DiffVerticalRulerPosition; }
/// <summary> /// Callback function /// </summary> private IntPtr HookFunc(int nCode, IntPtr wParam, IntPtr lParam) { // parse system messages if (nCode < 0) { return(NativeMethods.CallNextHookEx(HookId, nCode, wParam, lParam)); } // ReSharper disable once SwitchStatementMissingSomeCases switch ((MouseFlags)wParam) { case MouseFlags.LeftDown: LeftButtonDown?.Invoke((MouseInput)Marshal.PtrToStructure(lParam, typeof(MouseInput))); break; case MouseFlags.LeftUp: LeftButtonUp?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.RightDown: RightButtonDown?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.RightUp: RightButtonUp?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.Move: MouseMove?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.Wheel: MouseWheel?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.DoubleLeftClick: DoubleClick?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.MiddleDown: MiddleButtonDown?.Invoke(MouseInputToStructure(lParam)); break; case MouseFlags.MiddleUp: MiddleButtonUp?.Invoke(MouseInputToStructure(lParam)); break; } return(NativeMethods.CallNextHookEx(HookId, nCode, wParam, lParam)); }
private void Select(object sender, MouseButtonEventArgs e) { OnSelect?.Invoke(Task); IsSelected = true; UpdateBackground(); OnSelected?.Invoke(Task); e.Handled = true; if (e.ClickCount == 2) { DoubleClick?.Invoke(Task); } }