public static void AddNewGoal(Button btnAddGoal, Button buttondelete, Label labelStop, int lengthGoals, String goalName, String goal, Int32 type, Form form, int measurements) { if (lengthGoals <= 3 || btnAddGoal.Top >= 400) { if (btnAddGoal.Top < 400 && (!goalName.Equals("") || !goal.Equals("")) && lengthGoals <= 3) { btnAddGoal.Top += 90; buttondelete.Top += 90; InitializeUI.AddGoalVisuals(type, goalName, goal, 0, 75 * lengthGoals, form, btnAddGoal, measurements); FinancialPlanController.ActivePlan.AddFinancialGoal(new FinancialGoal() { Value = Convert.ToDouble(goal), Name = goalName }); } if (btnAddGoal.Top >= 400) { btnAddGoal.BackColor = Color.Gray; labelStop.Visible = true; btnAddGoal.Enabled = false; } } else { labelStop.Visible = true; btnAddGoal.BackColor = Color.Gray; btnAddGoal.Enabled = false; } }
public static void loadGoals(Button btnAddGoal, Button buttondelete, Label labelStop, Form form, int measurements) { var x = 0; var y = 0; var z = 0; foreach (FinancialGoal goal in FinancialPlanController.ActivePlan.FinancialGoals) { InitializeUI.AddGoalVisuals(0, goal.Name, Convert.ToString(goal.Value), y, x, form, btnAddGoal, measurements); btnAddGoal.Top += 90; buttondelete.Top += 90; x += 75; z++; } if (z == 3) { labelStop.Visible = true; btnAddGoal.BackColor = Color.Gray; btnAddGoal.Enabled = false; } }