예제 #1
0
        /// <summary>
        /// To load an existing an iCalendar object, use one of the provided LoadFromXXX methods.
        /// <example>
        /// For example, use the following code to load an iCalendar object from a URL:
        /// <code>
        ///     iCalendar iCal = iCalendar.LoadFromUri(new Uri("http://somesite.com/calendar.ics"));
        /// </code>
        /// </example>
        /// </summary>
        public iCalendar()
            : base(null)
        {
            this.Name        = "VCALENDAR";
            UniqueComponents = new UniqueComponentList <UniqueComponent>(this);
            Events           = new UniqueComponentList <Event>(this);
            FreeBusy         = new List <FreeBusy>();
            Journals         = new UniqueComponentList <Journal>(this);
            TimeZones        = new List <iCalTimeZone>();
            Todos            = new UniqueComponentList <Todo>(this);

            object[] attrs = GetType().GetCustomAttributes(typeof(ComponentBaseTypeAttribute), false);
            if (attrs.Length > 0)
            {
                foreach (ComponentBaseTypeAttribute attr in attrs)
                {
                    m_ComponentBaseCreate = attr.Type.GetMethod("Create", BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase);
                }
            }

            if (m_ComponentBaseCreate == null)
            {
                m_ComponentBaseCreate = typeof(ComponentBase).GetMethod("Create", BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase);
            }
        }
예제 #2
0
        /// <summary>
        /// To load an existing an iCalendar object, use one of the provided LoadFromXXX methods.
        /// <example>
        /// For example, use the following code to load an iCalendar object from a URL:
        /// <code>
        ///     iCalendar iCal = iCalendar.LoadFromUri(new Uri("http://somesite.com/calendar.ics"));
        /// </code>
        /// </example>
        /// </summary>
        public iCalendar() : base(null)
        {
            this.Name        = "VCALENDAR";
            UniqueComponents = new UniqueComponentList <UniqueComponent>(this);
            Events           = new UniqueComponentList <Event>(this);
            FreeBusy         = new List <FreeBusy>();
            Journals         = new UniqueComponentList <Journal>(this);
            TimeZones        = new List <DDay.iCal.Components.TimeZone>();
            Todos            = new UniqueComponentList <Todo>(this);

            // Set default values for these required properties
            // NOTE: fixes bug #1672047
            Version   = _Version;
            ProductID = _ProdID;

            object[] attrs = GetType().GetCustomAttributes(typeof(ComponentBaseTypeAttribute), false);
            if (attrs.Length > 0)
            {
                foreach (ComponentBaseTypeAttribute attr in attrs)
                {
                    m_ComponentBaseCreate = attr.Type.GetMethod("Create", BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase);
                }
            }

            if (m_ComponentBaseCreate == null)
            {
                m_ComponentBaseCreate = typeof(ComponentBase).GetMethod("Create", BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase);
            }
        }
예제 #3
0
 /// <summary>
 /// To load an existing an iCalendar object, use one of the provided LoadFromXXX methods.
 /// <example>
 /// For example, use the following code to load an iCalendar object from a URL:
 /// <code>
 ///     iCalendar iCal = iCalendar.LoadFromUri(new Uri("http://somesite.com/calendar.ics"));
 /// </code>
 /// </example>
 /// </summary>
 public iCalendar() : base(null)
 {
     this.Name = "VCALENDAR";
     Events    = new UniqueComponentList <Event>(this);
     FreeBusy  = new List <FreeBusy>();
     Journals  = new UniqueComponentList <Journal>(this);
     TimeZones = new List <DDay.iCal.Components.TimeZone>();
     Todos     = new UniqueComponentList <Todo>(this);
 }