コード例 #1
0
        private void InitialisingBudget()
        {
            Database_interaction db = new Database_interaction();
            Budget budget           = null;

            do
            {
                budget = db.GetBudget(DateTime.Now);
                float totalcost = db.GetTotalCostMonth(DateTime.Now);
                InvokeOnMainThread(delegate
                {
                    if (budget != null)
                    {
                        lblmonth.Text     = "This Month's Budget: " + budget.BudgetAmount.ToString();
                        lblRemaining.Text = "Remaining Budget: " + (budget.BudgetAmount - totalcost).ToString();
                        lblTotalCost.Text = "Total Cost This Month: " + totalcost.ToString();
                    }
                    else
                    {
                        lblmonth.Text     = "This Month's Budget: Not Set";
                        lblRemaining.Text = "Remaining Budget: 0";
                        lblTotalCost.Text = "Total Cost This Month: 0";
                    }
                });

                Thread.Sleep(10000);
            } while (budget != null);
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            UIImage img = UIImage.FromFile("BackGround.png");

            img = img.Scale(View.Frame.Size);
            this.View.BackgroundColor = UIColor.FromPatternImage(img);


            txtValue.Placeholder = "Must Be Didigt";
            budget = db.GetBudget(DateTime.Now);
            if (budget != null)
            {
                lblMonthBudget.Text        = "This Month's Budget: " + budget.BudgetAmount.ToString();
                lblTotalCostThisMonth.Text = "Total Cost This Month: " + totalcost.ToString();

                lblRemaningBudget.Text = "Remaning Budget: " + (budget.BudgetAmount - totalcost).ToString();

                lblTotalCostPlanned.Text = "Total Cost Planned: Not Set";
            }
            else
            {
                lblMonthBudget.Text    = "This Month's Budget: NotSet.";
                lblRemaningBudget.Text = "Remaning Budget: 0";
            }
            totalcost = db.GetTotalCostMonth(DateTime.Now);
            lblTotalCostThisMonth.Text = "Total Cost This Month: " + totalcost.ToString();


            lblTotalCostPlanned.Text = "Total Cost Planned: Not Set";


            var budgetManager = BudgetManagementController.Create();

            budgetManager.Budgets.Clear();

            tablePlannedCost.Source = dataSource = new BudgetResource(budgetManager.Budgets, this);

            ReadPlannedCost();
        }
コード例 #3
0
        private void buttonOKClicked(UIAlertController textInputAlertController)
        {
            Database_interaction db = new Database_interaction();

            db.AddBudget(new Budget(float.Parse(textInputAlertController.TextFields[0].Text), DateTime.Now));

            Budget budget = db.GetBudget(DateTime.Now);

            float totalcost = db.GetTotalCostMonth(DateTime.Now);

            if (budget != null)
            {
                lblmonth.Text     = "This Month's Budget: " + budget.BudgetAmount.ToString();
                lblRemaining.Text = "Remaining Budget: " + (budget.BudgetAmount - totalcost).ToString();

                lblTotalCost.Text = "Total Cost This Month: " + totalcost.ToString();
            }
            else
            {
                lblmonth.Text     = "This Month's Budget: Not Set";
                lblRemaining.Text = "Remaining Budget: 0";
                lblTotalCost.Text = "Total Cost This Month: 0";
            }
        }