Exemplo n.º 1
0
    /// <summary>
    /// Gets a list of events that occur today.
    /// </summary>
    /// <returns>A list of events that occur today</returns>
    protected List <Occurrence> GetTodaysEvents()
    {
        // Load selected calendars, if we haven't already
        if (_Calendars == null)
        {
            LoadSelectedCalendars();
        }

        // Get all event occurrences for today
        return(_Calendars.GetOccurrences <Event>(DateTime.Today));
    }
Exemplo n.º 2
0
    /// <summary>
    /// Gets a list of events that occur today.
    /// </summary>
    /// <returns>A list of events that occur today</returns>
    protected IList <Occurrence> GetTodaysEvents()
    {
        // Load selected calendars, if we haven't already
        if (_Calendars == null)
        {
            LoadSelectedCalendars();
        }

        // Get all events that occur today.
        return(_Calendars.GetOccurrences <IEvent>(DateTime.Today, DateTime.Today.AddDays(1)));
    }
Exemplo n.º 3
0
        /// <summary>
        /// Fills the event list with active items for
        /// the selected month.
        /// </summary>
        private void FillEventList()
        {
            // Clear our list of items
            listEvents.Items.Clear();

            // Get a list of event occurrences from each of our calendars.
            List <Occurrence> occurrences = _Calendars.GetOccurrences <Event>(StartOfMonth, EndOfMonth);

            // Iterate through each occurrence
            foreach (Occurrence o in occurrences)
            {
                // Cast the component to an event
                Event evt = o.Component as Event;
                if (evt != null)
                {
                    // Make sure the event is active (hasn't been cancelled)
                    if (evt.IsActive())
                    {
                        // Get a string that represents our event
                        string summary = o.Period.StartTime.ToString("d") + " - " + evt.Summary.Value;
                        if (evt.IsAllDay)
                        {
                            summary += " (All Day)";
                        }

                        // Add the occurrence to the list view
                        listEvents.Items.Add(new ListViewItem(summary));
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Fills the event list with active items for
        /// the selected month.
        /// </summary>
        private void FillEventList()
        {
            // Clear our list of items
            listEvents.Items.Clear();

            // Get a list of event occurrences from each of our calendars.
            IList <Occurrence> occurrences = _Calendars.GetOccurrences <IEvent>(StartOfMonth, EndOfMonth);

            // Iterate through each occurrence
            foreach (Occurrence o in occurrences)
            {
                // Cast the component to an event
                IEvent evt = o.Source as IEvent;
                if (evt != null)
                {
                    // Make sure the event is active (hasn't been cancelled)
                    if (evt.IsActive())
                    {
                        // Add the occurrence to the list view
                        listEvents.Items.Add(new ListViewItem(GetEventString(o, evt)));
                    }
                }
            }
        }
Exemplo n.º 5
0
 // TODO: Figure out how to cache the .ics events for a while
 public static IList <Occurrence> LoadFeedEvents(DateTime date)
 {
     return(calendars.GetOccurrences <IEvent>(date));
 }