Example #1
0
        private static void Assign(DateTime[] dates, Dictionary <string, List <Activity> > output)
        {
            ActivitiesDict = output;

            Pages[0] = new DailyPage();
            Pages[1] = new WeeklyPage();
            Pages[2] = new MonthlyPage();
            Pages[3] = new TotalPage();

            Pages[4] = dates == null ? new SettingsPage() : new SettingsPage(dates[0], dates[1]);
            Pages[5] = new Yesterday();
            Pages[6] = dates == null ? new CustomPage() : new CustomPage(dates[0], dates[1]);
        }
Example #2
0
        public static void Load(bool isConvertingTime = false)
        {
            if (isConvertingTime && savedDates != null)
            {
                Pages[0] = new DailyPage();
                Pages[1] = new WeeklyPage();
                Pages[2] = new MonthlyPage();
                Pages[3] = new TotalPage();

                Pages[5] = new Yesterday();
                Pages[6] = savedDates == null ? new CustomPage() : new CustomPage(savedDates[0], savedDates[1]);
                return;
            }

            var output = ReadJson();

            DateTime[] dates = GetSavedDates();

            savedDates = dates;

            // Checking if json could be read
            if (output is int)
            {
                if (output == 0)
                {
                    // ShowPopUp("Json could not be found.\nTry Starting the ActivityLogger first.\nTip: Keep in mind the Program" +
                    // "\nwill only show programs\n" +
                    // "with more than 5 min of use.", GetDirectory() + @"\TMRosemite\ActivityLogger");

                    Assign(dates, new Dictionary <string, List <Activity> >());
                    return;
                }

                if (output == 1)
                {
                    ShowPopUp("The Json seems to be corrupted.\nYou can Remove the current Json the Solve this issue", GetDirectory() + @"\TMRosemite\ActivityLogger");
                    return;
                }
            }

            if (output.Count == 0)
            {
                ShowPopUp("no logs found.\n\nTip: Keep in mind the Program\nwill only show programs\n" +
                          "with more than 5 min of use.");
                return;
            }


            Assign(dates, output);
        }