private void Form1_Load(object sender, EventArgs e) { var controller = new XboxController(0); controller.ButtonUp += ControllerOnButtonUp; controller.ButtonDown += ControllerOnButtonDown; controller.TriggerChanged += ControllerOnTriggerChanged; controller.StickChanged += ControllerOnStickChanged; }
static void Main() { _timer = new Timer(Timer); _point = new Point(); var controller = new XboxController(0); controller.DownA += (sender, args) => Mouse.LeftDown(); controller.UpA += (sender, args) => Mouse.LeftUp(); controller.DownB += (sender, args) => Mouse.RightDown(); controller.UpB += (sender, args) => Mouse.RightUp(); controller.StickChanged += ControllerOnStickChanged; controller.UpLeft += (sender, args) => Mouse.LeftClick(); controller.DownRight += (sender, args) => Window.OpenSwitcher(); controller.UpRight += (sender, args) => Window.CloseSwitcher(); controller.UpRBack += (sender, args) => Window.SwitchNextWindow(); controller.UpLBack += (sender, args) => Window.SwitchPreviousWindow(); controller.Start(); Process.GetCurrentProcess().WaitForExit(); }