public void ItemBase_GenerateFile() { Bank[] banks = new Bank[] { new Bank() { CostPerRound = 1560.0, CurrentCost = 563402.3, GainPerRound = 8960.0, Id = 1000, InitialCost = 580630.0, Name = "My Bank", PicturePath = "toto.png", LoanRate = 2.5, MinLoanAmount = 1000.0, MaxLoanAmount = 25000.0 } }; XmlSerializationHelper.HelperUTF8.ToFile<Bank[]>("E:\\banks.xml", banks); }
private void InitializeContent() { using (FormChooseBank dlg = new FormChooseBank()) { if (dlg.ShowDialog(this) != DialogResult.OK) { return; } this.bank = dlg.SelectedBank; if (this.bank == null) { return; } } if (this.player.BankAccounts == null) { this.player.BankAccounts = new BankAccountCollection(); } this.bankAccount = this.player.BankAccounts.GetAccountOrCreate(this.bank); this.labelBanqueName.Text = this.bank.Name; this.labelLoanRepaymentPerTurn.Text = string.Format("{0:C2}", this.bankAccount.LoanRepaymentPerTurn); this.labelDeposit.Text = string.Format("{0:C2}", this.bankAccount.Deposit); this.label18.Text = string.Format("{0}%", this.bank.DepositPercentInterestPerTurn); this.radioButtonPutMoney.Checked = true; this.numericUpDownPutMoney.Maximum = Convert.ToDecimal(this.player.Capital); this.numericUpDownGetMoney.Maximum = Convert.ToDecimal(this.bankAccount.Deposit); this.numericUpDownTurnNumber.Value = 20; this.textBox1.Text = string.Format("{0}%", this.bank.LoanRate); // IMPORTANT!!! this.numericUpDownLoanAmount.Minimum = Convert.ToDecimal(this.bank.MinLoanAmount); this.numericUpDownLoanAmount.Maximum = Convert.ToDecimal(this.bank.MaxLoanAmount); this.labelTurnLeftValue.Text = string.Format("{0}", this.bankAccount.LoanRepaymentTurnsLeft); if (this.bankAccount.LoanRepaymentTurnsLeft <= 0) { this.label16.Visible = false; this.labelTurnLeftValue.Visible = false; this.labelTurnsLeft.Visible = false; } else { this.label16.Visible = true; this.labelTurnLeftValue.Visible = true; this.labelTurnsLeft.Visible = true; if (this.bankAccount.LoanRepaymentTurnsLeft == 1) { this.labelTurnsLeft.Text = "tour."; } else { this.labelTurnsLeft.Text = "tours."; } } }