public PageFinances(Airline airline) { //binds and initializes page InitializeComponent(); this.Language = XmlLanguage.GetLanguage(new CultureInfo(AppSettings.GetInstance().getLanguage().CultureInfo, true).IetfLanguageTag); SetLocalDefaults(airline); // binds top level budgets and buttons Button btnApply = (Button)this.FindName("buttonApply"); Button btnReset = (Button)this.FindName("buttonReset"); Button btn1Year = (Button)this.FindName("_1year"); Button btn5Year = (Button)this.FindName("_5year"); Button btn10Year = (Button)this.FindName("_10year"); Viewbox panelContent = (Viewbox)this.FindName("panelViewbox"); setMaximums(airline); BudgetHelpers.SetDefaults(airline); SetLocalDefaults(airline); SetOverviewPanel(airline, 1); //event handlers btnApply.Click += new RoutedEventHandler(btnApply_Click); btnReset.Click += new RoutedEventHandler(btnReset_Click); btn1Year.Click += new RoutedEventHandler(btn1Year_Click); btn5Year.Click += new RoutedEventHandler(btn5Year_Click); btn10Year.Click += new RoutedEventHandler(btn10Year_Click); this.RemoveLogicalChild(panelContent); base.setContent(panelContent); showPage(this); }
//sets initial overview panel private void SetOverviewPanel(Airline humanAirline, int n) { IDictionary <DateTime, AirlineBudget> testBudget = GameObject.GetInstance().HumanAirline.TestBudget; AirlineBudget budget = BudgetHelpers.GetOneYearBudget(GameObject.GetInstance().GameTime, n); intFleetSizeValue.Text = humanAirline.getFleetSize().ToString(); intFleetSizeValue1.Text = budget.FleetSize.ToString(); mCashValue.Text = humanAirline.Money.ToString("C0"); mCashValue1.Text = budget.Cash.ToString("C0"); mBudgetValue.Text = BudgetHelpers.SetDefaults(humanAirline).ToString("C0"); mBudgetValue1.Text = budget.TotalBudget.ToString("C0"); mrBudgetValue.Text = BudgetHelpers.GetRemainingBudget().ToString("C0"); mrBudgetValue1.Text = budget.RemainingBudget.ToString("C0"); //the *0.15 is arbitrary padding meoyCashValue.Text = (humanAirline.Money - BudgetHelpers.GetRemainingBudget() - (humanAirline.Budget.TotalBudget * 0.15)).ToString("C0"); meoyCashValue1.Text = budget.EndYearCash.ToString("C0"); mAvgAirlinerValue.Text = BudgetHelpers.GetAvgFleetValue().ToString("C0"); mAvgAirlinerValue1.Text = (budget.FleetValue / budget.FleetSize).ToString("C0"); mTotalFleetValue.Text = BudgetHelpers.GetFleetValue().ToString("C0"); mTotalFleetValue1.Text = budget.FleetValue.ToString("C0"); intTotalEmployees.Text = GameObject.GetInstance().HumanAirline.getNumberOfEmployees().ToString(); intTotalEmployees1.Text = budget.TotalEmployees.ToString(); mTotalPayroll.Text = (AirlineHelpers.GetMonthlyPayroll(GameObject.GetInstance().HumanAirline) * 12).ToString("C0"); mTotalPayroll1.Text = budget.TotalPayroll.ToString("C0"); intSubsValue.Text = GameObject.GetInstance().HumanAirline.Subsidiaries.Count().ToString("C0"); intSubsValue1.Text = budget.TotalSubValue.ToString("C0"); mAvgSubsValue.Text = BudgetHelpers.GetAvgSubValue(humanAirline).ToString("C0"); mAvgAirlinerValue1.Text = (budget.TotalSubValue / budget.Subsidiaries).ToString("C0"); //mTotalSubsValue.Text = BudgetHelpers.GetTotalSubValues(humanAirline).ToString("C0"); }
private void btnReset_Click(object sender, RoutedEventArgs e) { BudgetHelpers.SetDefaults(GameObject.GetInstance().HumanAirline); SetLocalDefaults(GameObject.GetInstance().HumanAirline); SetOverviewPanel(GameObject.GetInstance().HumanAirline, 1); }