private void autoSelect_Click(object sender, EventArgs e) { using (var dialog = new FindControllerPropertyDialog()) { var deviceList = (FindForm() as MainForm).DeviceList; dialog.DeviceList = deviceList; if (dialog.ShowDialog() == DialogResult.OK) { var item = deviceList.RecentTouchedDevice(); List <Type> list; if (!mappingsDetectionType.TryGetValue(item.DetectedType, out list)) { return; } ToolStripItem onlyOne = null; int count = 0; foreach (ToolStripItem menu in availableItems.Items) { var type = menu.Tag as Type; if (list.Contains(type)) { menu.Visible = true; onlyOne = menu; count++; } else { menu.Visible = false; } } if (count == 0) { return; } var result = new DetectionResult(); result.Joystick = item.Item.Key; result.Value = item.DetectedValue; result.Type = item.DetectedType; result.From = dialog.ButtonFrom; result.To = dialog.ButtonTo; availableItems.Tag = result; if (count == 1) { onlyOne.PerformClick(); } else { availableItems.Show(MousePosition); } } } }
public void Apply(DetectionResult result) { JoystickPOV = result.Joystick + ".POV" + result.Value; }
public void Apply(DetectionResult result) { Joystick = result.Joystick; Button = result.From; }
public void Apply(DetectionResult result) { throw new NotSupportedException(); }
public void Apply(DetectionResult result) { JoystickAxis = result.Joystick + "." + result.Value; }
public void Apply(DetectionResult result) { Joystick = result.Joystick; From = result.From; Range = result.To - result.From + 1; }