public void UpdateDataControls(CurrentGameData currentGameData) { lblPlayersLeftVal.Text = currentGameData.PlayersLeft.ToString(); lblTotalChipsVal.Text = currentGameData.TotalChips.ToString(); lblAvgStackVal.Text = currentGameData.AverageStack.ToString(); lblTime.Text = currentGameData.GetMinutes().ToString("D2") + ":" + currentGameData.GetSeconds().ToString("D2"); lblRound.Text = "Round " + currentGameData.Round; lblBlinds.Text = currentGameData.GetBlinds(); lblNextBlinds.Text = currentGameData.GetNextBlinds(); lblPotVal.Text = "$" + currentGameData.Pot; lblFirstVal.Text = "$" + currentGameData.GetPayouts()[0]; lblSecondVal.Text = "$" + currentGameData.GetPayouts()[1]; lblThirdVal.Text = "$" + currentGameData.GetPayouts()[2]; lblFourthVal.Text = "$" + currentGameData.GetPayouts()[3]; }
public FrmMain() { InitializeComponent(); InitializeINI(); currentGameData = new CurrentGameData(); // Create control array for player screen (name, rebuys, rebuy button, remove button) PlayerControlArray = new TableLayoutPanelArray(pnlPlayers, this); // Create settings form frmSettings = new SettingsForm(this, tlpHeaders, PlayerControlArray, currentGameData); fonts = new Fonts(this); // Add default player names List <string> startingPlayers = settings[Settings.Default.IniSection]["StartingPlayerNames"].Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); foreach (string s in startingPlayers) { currentGameData.players.Add(new PlayerData(s)); PlayerControlArray.AddNewPanel(tlpHeaders, currentGameData); } // Refresh data with new info UpdateCurrentGameData(startingPlayers.Count); UpdateDataControls(currentGameData); fonts.ResizeAllFonts(); pnlMainScreen.BringToFront(); // Disable players panel since we start on main screen pnlPlayers.Enabled = false; // Disable rebuy buttons untill game has started PlayerControlArray.DisableRebuyButtons(); }
private void BtnSettingsOK_Click(object sender, EventArgs e, TableLayoutPanelArray playerControlArray, CurrentGameData currentGameData) { BtnSettingsApply_Click(sender, e, playerControlArray, currentGameData); this.Close(); }
public SettingsForm(Form main, TableLayoutPanel headers, TableLayoutPanelArray playerControlArray, CurrentGameData currentGameData) { _header = headers; fonts = new Fonts(main); InitializeComponent(); this.btnSettingsApply.Click += new System.EventHandler((sender, e) => BtnSettingsApply_Click(this, e, playerControlArray, currentGameData)); this.btnSettingsOK.Click += new System.EventHandler((sender, e) => BtnSettingsOK_Click(this, e, playerControlArray, currentGameData)); settings = fileIniData.ReadFile(Settings.Default.IniFile); switch (Int32.Parse(settings[Settings.Default.IniSection]["Bounties"])) { case 0: rbNone.Checked = true; HideBountyColumn(_header, playerControlArray); break; case 1: rbOnRebuy.Checked = true; ShowBountyColumn(_header, playerControlArray); break; case 2: rbOnElimination.Checked = true; ShowBountyColumn(_header, playerControlArray); break; default: break; } switch (Int32.Parse(settings[Settings.Default.IniSection]["Blinds"])) { case 0: rbPDC.Checked = true; break; case 1: rbAVISTA.Checked = true; break; case 2: rbCustom.Checked = true; break; default: break; } if (bool.Parse(settings[Settings.Default.IniSection]["TimeIsPerPlayer"])) { rbPerPlayer.Checked = true; } else { rbPerRound.Checked = true; } nudRoundLength.Value = (Int32.Parse(settings[Settings.Default.IniSection]["SecondsPerPlayer"]) / 60); nudMaxRoundLength.Value = (Int32.Parse(settings[Settings.Default.IniSection]["MaxSecondsPerRound"]) / 60); nudStartingChips.Value = Int32.Parse(settings[Settings.Default.IniSection]["StartingChips"]); nudBuyinCost.Value = Int32.Parse(settings[Settings.Default.IniSection]["BuyinCost"]); nudLastRebuyRound.Value = Int32.Parse(settings[Settings.Default.IniSection]["LastRebuyRound"]); List <string> existingLocations = settings[Settings.Default.IniSection]["ExistingLocations"].Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); foreach (string location in existingLocations) { lbExistingLocations.Items.Add(location); } tbSaveFolder.Text = settings[Settings.Default.IniSection]["ResultsFolder"]; }
private void BtnSettingsApply_Click(object sender, EventArgs e, TableLayoutPanelArray playerControlArray, CurrentGameData currentGameData) { int roundLengthInMinutes = Int32.Parse(nudRoundLength.Text); int maxRoundLengthInMinutes = Int32.Parse(nudMaxRoundLength.Text); // Set round time and round type settings if (rbPerPlayer.Checked) { settings[Settings.Default.IniSection]["SecondsPerPlayer"] = (roundLengthInMinutes * 60).ToString(); settings[Settings.Default.IniSection]["MaxSecondsPerRound"] = (maxRoundLengthInMinutes * 60).ToString(); settings[Settings.Default.IniSection]["TimeIsPerPlayer"] = true.ToString(); } else if (rbPerRound.Checked) { settings[Settings.Default.IniSection]["SecondsPerRound"] = (roundLengthInMinutes * 60).ToString(); settings[Settings.Default.IniSection]["TimeIsPerPlayer"] = false.ToString(); } if (Equals(settings[Settings.Default.IniSection]["Bounties"], "0")) { HideBountyColumn(_header, playerControlArray); } else { ShowBountyColumn(_header, playerControlArray); } // Save starting chips settings[Settings.Default.IniSection]["StartingChips"] = nudStartingChips.Value.ToString(); // Save rebuy info settings[Settings.Default.IniSection]["BuyinCost"] = nudBuyinCost.Value.ToString(); settings[Settings.Default.IniSection]["LastRebuyRound"] = nudLastRebuyRound.Value.ToString(); currentGameData.ChangeBlindsSchedule(Int32.Parse(settings[Settings.Default.IniSection]["Blinds"])); // Save Results Folder settings[Settings.Default.IniSection]["ResultsFolder"] = tbSaveFolder.Text; fonts.ResizeAllFonts(); //Properties.Settings.Default.Save(); // Saves settings in application configuration file fileIniData.WriteFile(Settings.Default.IniFile, settings); // Activate main form in order to update displayed data // main form updates dispalyed data on activate Application.OpenForms["frmMain"].Activate(); }