public static void RebuildKeys(KeyBind[] newKeys) { config.keys = newKeys; GetInstance().grdControls.Rows.Clear(); foreach (var key in newKeys) { GetInstance().grdControls.Rows.Add(key.Index, key.Label, key.Type, key.joystickIndex, key.KeyName); } }
private void btnLoad_Click(object sender, EventArgs e) { //Make keys var keys = new KeyBind[beamJson.tactiles.Length+beamJson.joysticks.Length]; var i = 0; foreach (var tac in beamJson.tactiles) { Keys keyData = (Keys)tac.Key; var key = new KeyBind(tac.id, tac.Text, "Tactile", keyData.ToString(), (byte)tac.Key); keys[i] = key; i++; } byte joyIndex = 1; foreach (var joy in beamJson.joysticks) { var key = new KeyBind(joy.id, "Joystick", "Joystick", joyIndex.ToString(), joyIndex); keys[i] = key; i++; joyIndex++; } Form1.RebuildKeys(keys); this.Close(); }