コード例 #1
0
        public static List <Day> Schedule()
        {
            List <Day> days = new List <Day>();

            foreach (var it in Data.data.takvim)
            {
                List <DateTime> tempList = new List <DateTime>();
                tempList.Add(Convert.ToDateTime(it.datum + " " + it.zora));
                tempList.Add(Convert.ToDateTime(it.datum + " " + it.izlazaksunca));
                tempList.Add(Convert.ToDateTime(it.datum + " " + it.podne));
                tempList.Add(Convert.ToDateTime(it.datum + " " + it.ikindija));
                tempList.Add(Convert.ToDateTime(it.datum + " " + it.aksam));
                tempList.Add(Convert.ToDateTime(it.datum + " " + it.jacija));

                List <Vakat> vakti = new List <Vakat>();

                for (int i = 0; i < tempList.Count; i++)
                {
                    Vakat vakat = new Vakat
                    {
                        rbr          = i,
                        alarmSkipped = false,
                        toastSkipped = false,
                        time         = tempList[i],
                        name         = Fixed.timeNames[i],
                    };
                    //if (vakat.time.DayOfWeek == DayOfWeek.Friday) vakat.name = "Podne (Džuma)";
                    vakti.Add(vakat);
                }
                days.Add(new Day {
                    vakti = vakti
                });
            }
            return(days);
        }
コード例 #2
0
        public static void Set()
        {
            List <Offset> offset   = Offset();
            List <Day>    schedule = Schedule();

            Year y = new Year
            {
                locationID = Memory.location.id,
                months     = new List <Month>(),
            };

            for (int a = 1; a <= 12; a++)
            {
                List <Day> days = new List <Day>();

                foreach (var it in schedule)
                {
                    if (it.vakti[0].time.Month == a)
                    {
                        List <Vakat> vakti = new List <Vakat>();
                        int          br    = 0;
                        foreach (var v in it.vakti)
                        {
                            Vakat vi = new Vakat
                            {
                                alarmSkipped = AlarmSkipping.IsSkipped(v),
                                name         = v.name,
                                toastSkipped = ToastSkipping.IsSkipped(v),
                                time         = v.time,
                                rbr          = v.rbr,
                            };
                            vi.time = vi.time.AddMinutes(offset[a - 1].offsets[br]);
                            if (vi.rbr == 2 && Memory.Std_Podne)
                            {
                                if (!TimeZoneInfo.Local.IsDaylightSavingTime(vi.time))
                                {
                                    vi.time = new DateTime(vi.time.Year, vi.time.Month, vi.time.Day, 12, 0, 0);
                                }
                                else
                                {
                                    vi.time = new DateTime(vi.time.Year, vi.time.Month, vi.time.Day, 13, 0, 0);
                                }
                            }
                            vakti.Add(vi);
                            br++;
                        }
                        days.Add(new Day {
                            vakti = vakti
                        });
                    }
                }
                y.months.Add(new Month {
                    days = days
                });
            }

            Year.year = y;
        }
コード例 #3
0
        public static void SkipAlarm(Vakat vakat)
        {
            string tmp = Memory.skippedAlarms;

            tmp  = tmp.Replace("[" + Vakat.Key(vakat) + "]", "");
            tmp += "[" + Vakat.Key(vakat) + "]";
            Memory.skippedAlarms = tmp;
            Year.year.months[vakat.time.Month - 1].days[vakat.time.Day - 1].vakti[vakat.rbr].alarmSkipped = true;
        }
コード例 #4
0
 public static bool IsSkipped(Vakat vakat)
 {
     return(Memory.skippedAlarms.Contains("[" + Vakat.Key(vakat) + "]"));
 }
コード例 #5
0
 public static void StayAlarm(Vakat vakat)
 {
     Memory.skippedAlarms = Memory.skippedAlarms.Replace("[" + Vakat.Key(vakat) + "]", "");
     Year.year.months[vakat.time.Month - 1].days[vakat.time.Day - 1].vakti[vakat.rbr].alarmSkipped = false;
 }
コード例 #6
0
 public static void StayToast(Vakat vakat)
 {
     Memory.skippedToasts = Memory.skippedToasts.Replace("[" + Vakat.Key(vakat) + "]", "");
     Year.year.months[vakat.time.Month - 1].days[vakat.time.Day - 1].vakti[vakat.rbr].toastSkipped = false;
 }
コード例 #7
0
 public static string Key(Vakat v)
 {
     return(v.time.Year + "|" + v.time.Month + "|" + v.time.Day + "|" + v.name.Substring(0, 2).ToLower());
 }