Beispiel #1
0
        private void OnMouseInput(INativeWindow window, IInputDevice device, ref HIDMouseInput input)
        {
            var mouseDevice  = (MouseDevice)InputDevice.GetOrAddDevice(device);
            var coreWindow   = window == null ? null : CoreWindow.FindWindow(window);
            var rootVisual   = coreWindow?.RootVisual;
            var hitUIElement = rootVisual?.InputHitTest(new Point(input.CursorX, input.CursorY));

            if (hitUIElement != null)
            {
                if (input.ChangedButton == 0)
                {
                    UIElement.RaiseEvent(new PointerRoutedEventArgs(UIElement.PointerMoveEvent, hitUIElement, mouseDevice));
                }
                else if (input.ChangedButton == 6)
                {
                    ;
                }
                else
                {
                    if (input.ChangedButtonState == PointerButtonState.Pressed)
                    {
                        UIElement.RaiseEvent(new PointerButtonRoutedEventArgs(UIElement.PointerPressedEvent, hitUIElement, mouseDevice,
                                                                              input.ChangedButton, input.ChangedButtonState));
                    }
                    else if (input.ChangedButtonState == PointerButtonState.Released)
                    {
                        UIElement.RaiseEvent(new PointerButtonRoutedEventArgs(UIElement.PointerReleasedEvent, hitUIElement, mouseDevice,
                                                                              input.ChangedButton, input.ChangedButtonState));
                    }
                }
            }
        }
Beispiel #2
0
        public void StartWatch()
        {
            WindowsReStyle();

            if (!UiFoundProcess)
            {
                MessageBox.Show("Could not find the process " + ConfigData.ProcessName,
                                "Windows Frameless Terminal", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            WindowPointer = CoreWindow.FindWindow(ConfigData.ProcessName, null);

            CoreWindow.GetWindowRect(WindowPointer, out CurrentWindowRectangle);

            CoreWindow.SetWindowPos(WindowPointer, 0, CurrentWindowRectangle.X, CurrentWindowRectangle.Y,
                                    CurrentWindowRectangle.Width, CurrentWindowRectangle.Height - 1, 0);

            if (windowManagerThread.IsAlive)
            {
                windowManagerThread.Abort();
            }

            if (WindowPointer != IntPtr.Zero)
            {
                windowManagerThread.Start();
            }

            StartWatchBtn.Content = "Stop Watch";

            uint processId;

            CoreWindow.GetWindowThreadProcessId(WindowPointer, out processId);
            InfoLbl.Content = "Info: PID: " + Convert.ToString(processId);

            SystemSounds.Beep.Play();
        }