// command private void comboboxCommand_SelectedIndexChanged(object sender, EventArgs e) { if (this.Tag == null & listviewControls.SelectedIndices.Count == 1) { int i = listviewControls.SelectedIndices[0]; int j = comboboxCommand.SelectedIndex; if (j >= 0) { Interface.CurrentControls[i].Command = Interface.CommandInfos[j].Command; Interface.CommandInfo Info = Interface.CommandInfos.TryGetInfo(Interface.CommandInfos[j].Command); Interface.CurrentControls[i].InheritedType = Info.Type; UpdateControlListElement(listviewControls.Items[i], i, true); } } }
private void UpdateControlListElement(ListViewItem Item, int Index, bool ResizeColumns) { Interface.CommandInfo Info = Interface.CommandInfos.TryGetInfo(Interface.CurrentControls[Index].Command); Item.SubItems[0].Text = Info.Name; switch (Info.Type) { case Interface.CommandType.Digital: Item.SubItems[1].Text = Interface.GetInterfaceString("controls_list_type_digital"); break; case Interface.CommandType.AnalogHalf: Item.SubItems[1].Text = Interface.GetInterfaceString("controls_list_type_analoghalf"); break; case Interface.CommandType.AnalogFull: Item.SubItems[1].Text = Interface.GetInterfaceString("controls_list_type_analogfull"); break; default: Item.SubItems[1].Text = Info.Type.ToString(); break; } Item.SubItems[2].Text = Info.Description; if (Interface.CurrentControls[Index].Method == Interface.ControlMethod.Keyboard) { Item.ImageKey = @"keyboard"; } else if (Interface.CurrentControls[Index].Method == Interface.ControlMethod.Joystick) { if (Info.Type == Interface.CommandType.AnalogHalf | Info.Type == Interface.CommandType.AnalogFull) { Item.ImageKey = @"joystick"; } else { Item.ImageKey = @"gamepad"; } } else { Item.ImageKey = null; } Item.SubItems[3].Text = GetControlDetails(Index); if (ResizeColumns) { listviewControls.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } }