Exemplo n.º 1
0
 //Load data.
 private void GetData()
 {
     GetGoal goal = new GetGoal();
     this.Price = goal.Price;
     this.GoalName = goal.GoalName;
     this.Progress = goal.Progress;
     this.ImagePath = goal.ImagePath;
 }
Exemplo n.º 2
0
 //Checks if users reaches his goal.
 private void CheckPercentage()
 {
     GetGoal goal = new GetGoal();
     if(goal.Progress >= 100)
     {
         ShowSuccess();
         ResetGoal();
         ShowGoal();
     }
 }
Exemplo n.º 3
0
        //Count number of kilometres to reach goal. 
        private int CountKilometerToGoal()
        {
            GetGoal goal = new GetGoal();

            double currentProgress = goal.Progress;
            double progressToDo = 100 - currentProgress;
            double goalPrice = goal.Price;
            double progressMoneyToDo = (goalPrice / 100) * progressToDo;
            double kilometerToDo = progressMoneyToDo / (0.097182 + 0.061333 + 0.061333);

            return Convert.ToInt32(Math.Round(kilometerToDo, 0));
        }
Exemplo n.º 4
0
        //Update goal progress when user stops tracking.
        private void UpdateProgress()
        {
            GetGoal goal = new GetGoal();

            double currentProgress = goal.Progress;
            double goalPrice = goal.Price;
            double currentProgressMoney = (goalPrice / 100) * currentProgress;

            int roundedProgress = 0;
            if (goalPrice != 0)
            {
                double newProgressMoney = currentProgressMoney + Convert.ToDouble(txbMoney2.Text);
                double newProgress = (newProgressMoney / goalPrice) * 100;
                roundedProgress = Convert.ToInt32(Math.Round(newProgress, 0));
            }

            txbProgress.Text = Convert.ToString(roundedProgress) + "%";

            SaveGoal goalSaver = new SaveGoal(goal.Price, goal.GoalName, roundedProgress, goal.ImagePath);
        }
Exemplo n.º 5
0
        //Show goal in goal screen. 
        private void ShowGoal()
        {
            GetGoal goal = new GetGoal();

            txbName2.Text = goal.GoalName;
            txbProgress.Text = Convert.ToString(goal.Progress) + "%";
            txbKilometerToGoal2.Text = Convert.ToString(CountKilometerToGoal());

            if (goal.ImagePath != "none")
            {
                ImageBrush brush = new ImageBrush();
                brush.ImageSource = new BitmapImage(new Uri(goal.ImagePath));
                brdGoal.Background = brush;
            }
        }