Exemplo n.º 1
0
        private void RefreshPrevious()
        {
            if (DataManager.Evaluation.Data == null || DataManager.Plan.Data == null)
            {
                return;
            }

            SetActiveView(mPreviousView);

            // Create an array of all represented months in our data
            DateTime[] months = CreateCompletedMonthList();

            for (int i = 0; i < months.Length; i++)
            {
                DateTime currentMonth = months[i];

                // Add month header
                string formatedMonth = currentMonth.ToString("MMMM yyyy", mLanguageInfo).ToUpper();
                string monthBarTitle = TextManager.Get(mCompletedTag) + " " + formatedMonth;
                Add(mHeaderPreviousPrefab).SetTitle(monthBarTitle);

                // Find the evaluation for this month and add it
                for (int j = 0; j < DataManager.Evaluation.Done.Length; j++)
                {
                    DataEvaluation evaluation = DataManager.Evaluation.Done[j];
                    DateTime       date       = evaluation.CreatedAt.Value;

                    if (date.Year == currentMonth.Year && date.Month == currentMonth.Month)
                    {
                        Add(mCheckPrefab).SetData(evaluation, mLanguageInfo);
                    }
                }

                // Find the goals for this month and add them
                for (int j = 0; j < DataManager.Plan.CompletedGoals.Length; j++)
                {
                    DataGoal goal = DataManager.Plan.CompletedGoals[j];
                    DateTime date = goal.FinishedAt.Value;

                    if (date.Year == currentMonth.Year && date.Month == currentMonth.Month)
                    {
                        MonthlyGoal created = Add(mGoalPrefab);
                        created.SetData(goal);

                        if (mToFocus != null && goal.ID == mToFocus.ID)
                        {
                            mFocusGoal      = created;
                            mFocusIsOngoing = false;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void RefreshCurrent()
        {
            if (DataManager.Evaluation.Data == null || DataManager.Plan.Data == null)
            {
                return;
            }

            SetActiveView(mCurrentView);

            Add(mHeaderCurrentPrefab).SetTitle(TextManager.Get(mLatestCheckTag));

            if (DataManager.Evaluation.Done.Length > 0)
            {
                Add(mCheckPrefab).SetData(DataManager.Evaluation.Done[0], mLanguageInfo);
            }

            int remainingGoalCount = DataManager.Plan.OngoingGoals.Length;

            if (remainingGoalCount > 0)
            {
                Add(mHeaderCurrentPrefab).SetTitle(TextManager.Get(mRemainingGoalsTag) + " (" + remainingGoalCount + ")");

                for (int i = 0; i < DataManager.Plan.OngoingGoals.Length; i++)
                {
                    DataGoal    goal    = DataManager.Plan.OngoingGoals[i];
                    MonthlyGoal created = Add(mGoalPrefab);
                    created.SetData(goal);

                    if (mToFocus != null && goal.ID == mToFocus.ID)
                    {
                        mFocusGoal      = created;
                        mFocusIsOngoing = true;
                    }
                }
            }
        }