示例#1
0
        void UpdateLoansProjections()
        {
            if (textNewLoans == null)
            {
                return;
            }

            try
            {
                float interest = sliderSetLoanInterest != null ? (float)sliderSetLoanInterest.Value : 0;
                float risk     = sliderSetLoanRisk != null ? (float)sliderSetLoanRisk.Value : 0;

                if (interest < 1e-5f || risk < 1e-5f)
                {
                    textNewLoans.Text = "No loans";
                }
                else
                {
                    float loanAvg    = MyBank.CalculateNewLoanAverage(interest, risk);
                    int   loanAvgInt = (int)(loanAvg * Bank.LOAN_MEAN / 1000) * 1000;
                    textNewLoans.Text = loanAvgInt.ToString("C");
                }
            }
            catch (FormatException)
            {
                textNewLoans.Text = "No loans";
            }
        }