IEnumerator RequestTodaysView()
    {
        // today's view
        yield return(0);

        DateTime currentDate = DateTime.Now;

        if (currentDate.DayOfWeek == System.DayOfWeek.Monday)
        {
            RequestView(State.WEEKLY, currentDate);
        }
        else
        {
            RequestView(State.MONTHLY, currentDate);
        }
        // get upcoming alarms
        yield return(0);

        List <Alarm> eventsThisWeek = new List <Alarm>();
        DateTime     temp;

        for (int i = 0; i < 6; i++)
        {
            temp = currentDate.AddDays(i);
            SearchResult search = data.TryGetEntries(temp.Day.ToString() + "." + temp.Month.ToString() + "." + temp.Year.ToString());
            if (search.value)
            {
                if (search.info.Alarms.Count > 0)
                {
                    eventsThisWeek.AddRange(search.info.Alarms);
                }
            }
        }
        eventsThisWeek.RemoveAll(x => x.report);

        yield return(0);

        // check for semester report
        if (currentDate.Month % 3 == 0 && TimeConversions.IntInRange(currentDate.Day, 20, 31))
        {
            Alarm reportAlarm = new Alarm();
            reportAlarm.attributes[0] = gManager.language.ReportAlarmNotes;
            reportAlarm.report        = true;
            eventsThisWeek.Insert(0, reportAlarm);
        }
        // display events
        if (eventsThisWeek.Count > 0)
        {
            ExtrasViewController extras = FindObjectOfType <ExtrasViewController>();
            if (extras)
            {
                extras.RequestAlarmPreview(eventsThisWeek);
            }
        }
    }
Esempio n. 2
0
    public void OnClickAlarmIndicator()
    {
        ExtrasViewController extras = FindObjectOfType <ExtrasViewController>();

        extras.RequestAlarmPreview(info.Alarms);
    }