Пример #1
0
        public void UpdateWithTaches(int day, CalendarInfo c)
        {
            activitiesStack.Children.Clear();
            DateTime     d     = new DateTime(c.Month.Year, c.Month.Month, day);
            List <Tache> datal = c.GetDayTaches(c.Month.Year, c.Month.Month, day);

            if (datal.Count != 0)
            {
                Dictionary <string, List <Tache> > actDictionary = new Dictionary <string, List <Tache> >();
                actDictionary[""] = new List <Tache>();
                foreach (string s in DataSupervisor.ds.user.Activities.Keys)
                {
                    actDictionary[s] = new List <Tache>();
                }
                foreach (Tache t in datal)
                {
                    if (actDictionary.ContainsKey(t.Activitee))
                    {
                        actDictionary[t.Activitee].Add(t);
                    }
                    else
                    {
                        actDictionary[""].Add(t);
                    }
                }

                foreach (KeyValuePair <string, List <Tache> > kv in actDictionary)
                {
                    if (kv.Key == "")
                    {
                        continue;
                    }
                    StackActivite s     = new StackActivite();
                    string        color = "#FFFFFF";
                    if (DataSupervisor.ds.user.Activities.ContainsKey(kv.Key))
                    {
                        color = DataSupervisor.ds.user.Activities[kv.Key];
                    }
                    s.LoadData(kv.Key, color, kv.Value);
                    activitiesStack.Children.Add(s);
                }
            }
            else
            {
                TextBlock tb = new TextBlock()
                {
                    Text                = "Vous n'avez pas ajouté de tâches",
                    FontSize            = 16,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Margin              = new Thickness(0, 20, 0, 0)
                };
                activitiesStack.Children.Add(tb);
            }
        }
Пример #2
0
        public List <Tache> GetDayTaches(int day, int month, int year)
        {
            List <Tache> lst;

            if (MonthData.Month.Month == month && MonthData.Month.Year == year)
            {
                lst = MonthData.GetDayTaches(year, month, day);
            }
            else
            {
                CalendarInfo data = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{month}-{year}.json", new DateTime(year, month, day));
                lst = data.GetDayTaches(year, month, day);
            }
            return(lst);
        }