public ReminderSettings(List <DailyReminder> OldListOfReminders, ModelManager model)
 {
     this.model = model;
     this.OldListOfReminders = OldListOfReminders;
     InitializeComponent();
     WindowEnricher.enrichWindow(this);
     addElements(OldListOfReminders);
 }
        public DailyAchievement(DateTime date, MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            InitializeComponent();
            WindowEnricher.enrichWindow(this);
            this.dailyAchievement = AchievementManager.LoadAchievementl(date);

            for (int i = 0; i < dailyAchievement.achievements.Count; i++)
            {
                Grid newElement = createAchivementElementList(dailyAchievement.achievements[i]);
                ListOfAchivements.Add(newElement);
                this.AchievementsListGrid.Children.Add(newElement);
            }
            updateVerticalPositionOfListElements();
        }
Example #3
0
        public MainWindow()
        {
            model.LoadModel();
            InitializeComponent();
            System.IO.Directory.CreateDirectory("achievements");

            WindowEnricher.enrichWindow(this);
            DateTime date           = DateTime.Now;
            DateTime lastUpdateDate = model.GetActualState().lastTimeUpdateReminders;

            while (!(date.Year == lastUpdateDate.Year && date.Month == lastUpdateDate.Month && date.Day == lastUpdateDate.Day - 1))
            {
                String fileName = "achievements/" + AchievementManager.DateToString(date) + ".xml";
                if (File.Exists(fileName))
                {
                    break;
                }
                DailyAchievements dailyAchievements = new DailyAchievements();
                dailyAchievements.date         = date;
                dailyAchievements.achievements = model.GetActualState().DailyReminders.Select(x =>
                {
                    Achievement achievement = new Achievement();
                    achievement.Name        = x.Name;
                    achievement.Achived     = false;
                    achievement.type        = x.type;
                    achievement.achivedInt  = 0;
                    achievement.Required    = isDateRequired(date, x);
                    return(achievement);
                }).ToList();
                AchievementManager.SaveAchievement(fileName, dailyAchievements);
                date = date.AddDays(-1);
            }

            date = DateTime.Now;
            for (int i = 0; i < 10; i++)
            {
                DailyAchievements dailyAchievements = AchievementManager.LoadAchievementl(date);

                Grid newElement = createHistoryElementList(dailyAchievements);
                ListOfDailyAchivements.Add(newElement);
                this.HistoryGrid.Children.Add(newElement);
                date = date.AddDays(-1);
            }

            updateVerticalPositionOfListElements(ListOfDailyAchivements, 60);


            date = DateTime.Now;
            this.actualAchievements = AchievementManager.LoadAchievementl(date);

            for (int i = 0; i < actualAchievements.achievements.Count; i++)
            {
                if ((!actualAchievements.achievements[i].Achived) && actualAchievements.achievements[i].achivedInt == 0)
                {
                    Grid newElement = createAchivementElementList(actualAchievements.achievements[i]);
                    ListOfAchivements.Add(newElement);
                    this.ReminderGrid.Children.Add(newElement);
                }
            }
            updateVerticalPositionOfListElements(ListOfAchivements, 120);
        }
Example #4
0
 public MainWindow()
 {
     model.LoadModel();
     InitializeComponent();
     WindowEnricher.enrichWindow(this);
 }