private void bApply_Click(object sender, EventArgs e) { bool finish = false; string[] duplicates = { HotFold.Text, HotCheck.Text, HotCall.Text, HotRaise.Text }; for (int i = 0; i < duplicates.Length; i++) { for (int j = i + 1; j < duplicates.Length; j++) { if (duplicates[i] != duplicates[j] && duplicates[i] != duplicates[j].ToUpper() && duplicates[i].ToUpper() != duplicates[j]) { continue; } if (finish) { continue; } MessageBox.Show(@"You cant assign two or more hotkeys to one key !"); bReset_Click(sender, e); finish = true; } } if (finish) { return; } if (HotFold.Text.Length > 1 || HotCheck.Text.Length > 1 || HotCall.Text.Length > 1 || HotRaise.Text.Length > 1) { MessageBox.Show(@"You cant assign a hotkey to a combination of keys !"); bReset_Click(sender, e); } else { Properties.Settings.Default.FoldHotkey = HotFold.Text; Properties.Settings.Default.CheckHotkey = HotCheck.Text; Properties.Settings.Default.CallHotkey = HotCall.Text; Properties.Settings.Default.RaiseHotkey = HotRaise.Text; Properties.Settings.Default.Save(); AutoCloseMsb.Show("Your changes have been saved !", "Hotkeys", 2000); } }
private void bThinkTime_Click(object sender, EventArgs e) { int parsedValue; if (!int.TryParse(tbThink.Text, out parsedValue)) { MessageBox.Show(@"This is a number only field"); } else { if (int.Parse(tbThink.Text) <= 0 || int.Parse(tbThink.Text) > 100) { MessageBox.Show(@"You cant assign value lower than 0 and value higher than 100."); } else { MainPoker.ThinkTime = int.Parse(tbThink.Text) * 1000; AutoCloseMsb.Show("Your changes have been saved !", "Settings", 2000); Properties.Settings.Default.ThinkingTime = MainPoker.ThinkTime; Properties.Settings.Default.Save(); } } }