private void BackButton_OnPointerPressed(object?sender, PointerPressedEventArgs e) { MainWindow.Instance.Pager.SwitchPage(Pages.Home); }
private void InputElement_OnPointerPressed(object?sender, PointerPressedEventArgs e) { Utils.OpenUrl($"https://github.com/Mxater/DualSenseSupport/releases/tag/{aboutModel.ActualVersion}"); }
private async void Cancel_OnPointerPressed(object?sender, PointerPressedEventArgs e) { await DeviceLogManager.Instance.CancelDownload(); MainWindow.Instance.Pager.SwitchPage(Pages.System); }
protected override void OnPointerPressed(PointerPressedEventArgs e) { InvalidateVisual(); }
public void BeginResizeDrag(WindowEdge edge, PointerPressedEventArgs e) { }
internal void Cell_MouseLeftButtonDown(object sender, PointerPressedEventArgs e) { if (Owner != null) { if (!Owner.HasFocusInternal) { Owner.Focus(); } bool ctrl, shift; CalendarExtensions.GetMetaKeyState(e.KeyModifiers, out ctrl, out shift); CalendarDayButton b = sender as CalendarDayButton; if (b != null) { _isControlPressed = ctrl; if (b.IsEnabled && !b.IsBlackout) { DateTime selectedDate = (DateTime)b.DataContext; Contract.Requires <ArgumentNullException>(selectedDate != null); _isMouseLeftButtonDown = true; // null check is added for unit tests if (e != null) { _downEventArg = e; } switch (Owner.SelectionMode) { case CalendarSelectionMode.None: { return; } case CalendarSelectionMode.SingleDate: { Owner.CalendarDatePickerDisplayDateFlag = true; if (Owner.SelectedDates.Count == 0) { Owner.SelectedDates.Add(selectedDate); } else { Owner.SelectedDates[0] = selectedDate; } return; } case CalendarSelectionMode.SingleRange: { // Set the start or end of the selection // range if (shift) { Owner.UnHighlightDays(); Owner.HoverEnd = selectedDate; Owner.HoverEndIndex = b.Index; Owner.HighlightDays(); } else { Owner.UnHighlightDays(); Owner.HoverStart = selectedDate; Owner.HoverStartIndex = b.Index; } return; } case CalendarSelectionMode.MultipleRange: { if (shift) { if (!ctrl) { // clear the list, set the states to // default foreach (DateTime item in Owner.SelectedDates) { Owner.RemovedItems.Add(item); } Owner.SelectedDates.ClearInternal(); } Owner.HoverEnd = selectedDate; Owner.HoverEndIndex = b.Index; Owner.HighlightDays(); } else { if (!ctrl) { // clear the list, set the states to // default foreach (DateTime item in Owner.SelectedDates) { Owner.RemovedItems.Add(item); } Owner.SelectedDates.ClearInternal(); Owner.UnHighlightDays(); } Owner.HoverStart = selectedDate; Owner.HoverStartIndex = b.Index; } return; } } } else { // If a click occurs on a BlackOutDay we set the // HoverStart to be null Owner.HoverStart = null; } } else { _isControlPressed = false; } } }
private void NotesCanvasLeftPointerPressed(Canvas canvas, PointerPoint point, PointerPressedEventArgs args) { var pitHitInfo = ViewModel.NotesViewModel.HitTest.HitTestPitchPoint(point.Position); if (pitHitInfo.Note != null) { editState = new PitchPointEditState(canvas, ViewModel, pitHitInfo.Note, pitHitInfo.Index, pitHitInfo.OnPoint, pitHitInfo.X, pitHitInfo.Y); return; } var vbrHitInfo = ViewModel.NotesViewModel.HitTest.HitTestVibrato(point.Position); if (vbrHitInfo.hit) { if (vbrHitInfo.hitToggle) { ViewModel.NotesViewModel.ToggleVibrato(vbrHitInfo.note); return; } if (vbrHitInfo.hitStart) { editState = new VibratoChangeStartState(canvas, ViewModel, vbrHitInfo.note); return; } if (vbrHitInfo.hitIn) { editState = new VibratoChangeInState(canvas, ViewModel, vbrHitInfo.note); return; } if (vbrHitInfo.hitOut) { editState = new VibratoChangeOutState(canvas, ViewModel, vbrHitInfo.note); return; } if (vbrHitInfo.hitDepth) { editState = new VibratoChangeDepthState(canvas, ViewModel, vbrHitInfo.note); return; } if (vbrHitInfo.hitPeriod) { editState = new VibratoChangePeriodState(canvas, ViewModel, vbrHitInfo.note); return; } if (vbrHitInfo.hitShift) { editState = new VibratoChangeShiftState( canvas, ViewModel, vbrHitInfo.note, vbrHitInfo.point, vbrHitInfo.initialShift); return; } return; } var noteHitInfo = ViewModel.NotesViewModel.HitTest.HitTestNote(point.Position); if (args.KeyModifiers == KeyModifiers.Control) { // New selection. ViewModel.NotesViewModel.DeselectNotes(); editState = new NoteSelectionEditState(canvas, ViewModel, GetSelectionBox(canvas)); Cursor = ViewConstants.cursorCross; return; } if (args.KeyModifiers == (KeyModifiers.Control | KeyModifiers.Shift)) { // Additional selection. editState = new NoteSelectionEditState(canvas, ViewModel, GetSelectionBox(canvas)); Cursor = ViewConstants.cursorCross; return; } if (noteHitInfo.hitBody) { if (noteHitInfo.hitResizeArea) { editState = new NoteResizeEditState( canvas, ViewModel, noteHitInfo.note, args.KeyModifiers == KeyModifiers.Alt); Cursor = ViewConstants.cursorSizeWE; } else { editState = new NoteMoveEditState(canvas, ViewModel, noteHitInfo.note); Cursor = ViewConstants.cursorSizeAll; } return; } ViewModel.NotesViewModel.DeselectNotes(); var note = ViewModel.NotesViewModel.MaybeAddNote(point.Position); if (note != null) { // Start moving right away editState = new NoteMoveEditState(canvas, ViewModel, note); Cursor = ViewConstants.cursorSizeAll; } }
internal static void DoWindowTitleThumbMoveOnDragDelta(IMetroThumb thumb, MetroWindow window, VectorEventArgs dragDeltaEventArgs) { if (thumb == null) { throw new ArgumentNullException(nameof(thumb)); } if (window == null) { throw new ArgumentNullException(nameof(window)); } // drag only if IsWindowDraggable is set to true if (!window.IsWindowDraggable || (!(Math.Abs(dragDeltaEventArgs.Vector.Y) > 2) && !(Math.Abs(dragDeltaEventArgs.Vector.X) > 2))) { return; } // tage from DragMove internal code window.VerifyAccess(); //var cursorPos = WinApiHelper.GetPhysicalCursorPos(); // if the window is maximized dragging is only allowed on title bar (also if not visible) var windowIsMaximized = window.WindowState == WindowState.Maximized; if (window._titleBar != null && window._titleBar.IsPointerOver /*&& window._mouseDown*/) { window.WindowState = WindowState.Normal; try { if (dummyMovePointer == null) { dummyMovePointer = new Pointer(0, PointerType.Mouse, true); } if (dummyPointerPressedEventArgs == null) { //just create a dummy PointerPressedEventArgs dummyPointerPressedEventArgs = new PointerPressedEventArgs ( window, dummyMovePointer, window, new Point(1, 1), 0, new PointerPointProperties(RawInputModifiers.None, PointerUpdateKind.LeftButtonPressed), KeyModifiers.None ); } window.PlatformImpl.BeginMoveDrag(dummyPointerPressedEventArgs); } catch { } window._mouseDown = false; } //var isMouseOnTitlebar = Mouse.GetPosition(thumb).Y <= window.TitleBarHeight && window.TitleBarHeight > 0; //if (!isMouseOnTitlebar && windowIsMaximized) //{ // return; //} #pragma warning disable 618 // for the touch usage //UnsafeNativeMethods.ReleaseCapture(); #pragma warning restore 618 if (windowIsMaximized) { //var cursorXPos = cursorPos.x; EventHandler windowOnStateChanged = null; windowOnStateChanged = (sender, args) => { //window.Top = 2; //window.Left = Math.Max(cursorXPos - window.RestoreBounds.Width / 2, 0); //window.StateChanged -= windowOnStateChanged; //if (window.WindowState == WindowState.Normal) //{ // Mouse.Capture(thumb, CaptureMode.Element); //} }; //window.StateChanged -= windowOnStateChanged; //window.StateChanged += windowOnStateChanged; } // var criticalHandle = window.CriticalHandle; //#pragma warning disable 618 // // these lines are from DragMove // // NativeMethods.SendMessage(criticalHandle, WM.SYSCOMMAND, (IntPtr)SC.MOUSEMOVE, IntPtr.Zero); // // NativeMethods.SendMessage(criticalHandle, WM.LBUTTONUP, IntPtr.Zero, IntPtr.Zero); // var wpfPoint = window.PointToScreen(Mouse.GetPosition(window)); // var x = (int)wpfPoint.X; // var y = (int)wpfPoint.Y; // NativeMethods.SendMessage(criticalHandle, WM.NCLBUTTONDOWN, (IntPtr)HT.CAPTION, new IntPtr(x | (y << 16))); //#pragma warning restore 618 }
protected override void TagMiddleClick(object sender, PointerPressedEventArgs args) { return; }
void ResizeSouth(object sender, PointerPressedEventArgs e) => BeginResizeDrag(WindowEdge.South);
private void Window_OnPointerPressed(object?sender, PointerPressedEventArgs e) { ClickedEventHandler?.Invoke(this, EventArgs.Empty); Hide(); }
protected override void OnPointerPressed(PointerPressedEventArgs e) { BeginMoveDrag(e); base.OnPointerPressed(e); }
protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); PseudoClasses.Add(":pressed"); }
public PointerPressedContextEventArgs(PointerPressedEventArgs pointerPressedEventArgs, bool isInToolbox) { PointerPressedEventArgs = pointerPressedEventArgs; IsInToolbox = isInToolbox; }
void Window_Focus(object sender, PointerPressedEventArgs e) => this.Focus();
private void OnPointerPressed(object sender, PointerPressedEventArgs e) { TargetControl?.Focus(); }
void MoveWindow(object sender, PointerPressedEventArgs e) => BeginMoveDrag(e);
private void DropDownButton_PointerPressed(object sender, PointerPressedEventArgs e) { _ignoreButtonClick = _isPopupClosing; }
private void IconMouseDown(object sender, PointerPressedEventArgs e) { throw new NotImplementedException(); }
private void OkButton_Click(object sender, PointerPressedEventArgs e) { Close(); }
protected abstract void TagMiddleClick(object sender, PointerPressedEventArgs args);
public void ContentControl_MouseDown(object sender, PointerPressedEventArgs e) { var mainGrid = this.Get <Grid>("MG"); mainGrid.Focus(); }
public void BeginMoveDrag(PointerPressedEventArgs e) { }
public void Drag(object sender, PointerPressedEventArgs e) => DragDrop.Drag(Program.Project.Window?.Selection, e);
protected override void OnPointerPressed(PointerPressedEventArgs e) { }
public void OnGitHubLink_Click(object sender, PointerPressedEventArgs e) { OpenURL(@"https://github.com/aldelaro5/Bug-Fables-Save-Editor"); }
private void TextNewVersion_OnPointerPressed(object?sender, PointerPressedEventArgs e) { Utils.OpenUrl(aboutModel.VersionUrl); }
public void OnLicenseLink_Click(object sender, PointerPressedEventArgs e) { OpenURL(@"https://github.com/aldelaro5/Bug-Fables-Save-Editor/blob/main/LICENSE"); }
private void Popup_PointerPressed(object sender, PointerPressedEventArgs e) { popup.Close(); }
void Drag(object sender, PointerPressedEventArgs e) => Owner.Drag(sender, e);