private void ContextHotKey_Click(object sender, EventArgs e) { SelectKey SelectKeyDialog = new SelectKey(); var SelectedIndex = mTracks_lst.SelectedItems[0].Index; if (SelectKeyDialog.ShowDialog() == DialogResult.OK) { var Game = GetCurrentGame(); bool KeyIsFree = true; foreach (var track in Game.Tracks) { //Checking to see if any other track is already using this key if (track.Hotkey == SelectKeyDialog.ChosenKey) { KeyIsFree = false; } } if (KeyIsFree) { Game.Tracks[SelectedIndex].Hotkey = SelectKeyDialog.ChosenKey; SaveTrackKeys(GetCurrentGame()); ReloadTracks(GetCurrentGame()); RefreshTrackList(); } else { MessageBox.Show(string.Format("\"{0}\" has already been assigned!", SelectKeyDialog.ChosenKey), "Invalid Key"); } } }
private void ChangeRelayButton_Click(object sender, EventArgs e) { var SelectKeyDialog = new SelectKey(); if (SelectKeyDialog.ShowDialog() == DialogResult.OK) { if (!((SelectKeyDialog.ChosenKey ?? "") == (My.MySettingsProperty.Settings.PlayKey ?? ""))) { My.MySettingsProperty.Settings.RelayKey = SelectKeyDialog.ChosenKey; My.MySettingsProperty.Settings.Save(); ChangeRelayButton.Text = string.Format("Relay key: \"{0}\" (change)", My.MySettingsProperty.Settings.RelayKey); } else { MessageBox.Show("Play key and relay key can not be the same!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void PlayKeyButton_Click(object sender, EventArgs e) { SelectKey SelectKeyDialog = new SelectKey(); if (SelectKeyDialog.ShowDialog() == DialogResult.OK) { if (!(SelectKeyDialog.ChosenKey == SLAM.Properties.Settings.Default.RelayKey)) { SLAM.Properties.Settings.Default.PlayKey = SelectKeyDialog.ChosenKey; SLAM.Properties.Settings.Default.Save(); RefreshPlayKey(); } else { MessageBox.Show("Play key and relay key can not be the same!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void ChangeRelayButton_Click(object sender, EventArgs e) { SelectKey SelectKeyDialog = new SelectKey(); if (SelectKeyDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (!(SelectKeyDialog.ChosenKey == SLAM.Properties.Settings.Default.PlayKey)) { SLAM.Properties.Settings.Default.RelayKey = SelectKeyDialog.ChosenKey; SLAM.Properties.Settings.Default.Save(); ChangeRelayButton.Text = string.Format("Relay key: \"{0}\" (change)", SLAM.Properties.Settings.Default.RelayKey); } else { MessageBox.Show("Play key and relay key can not be the same!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }