예제 #1
0
        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);
                    }
                }
            }
        }
예제 #2
0
 public void Apply(DetectionResult result)
 {
     JoystickPOV = result.Joystick + ".POV" + result.Value;
 }
예제 #3
0
 public void Apply(DetectionResult result)
 {
     Joystick = result.Joystick;
     Button   = result.From;
 }
예제 #4
0
 public void Apply(DetectionResult result)
 {
     throw new NotSupportedException();
 }
예제 #5
0
 public void Apply(DetectionResult result)
 {
     JoystickAxis = result.Joystick + "." + result.Value;
 }
예제 #6
0
 public void Apply(DetectionResult result)
 {
     Joystick = result.Joystick;
     From     = result.From;
     Range    = result.To - result.From + 1;
 }