Ejemplo n.º 1
0
        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"];
        }