コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="component"></param>
        public virtual void AddItem(ICalendarObject component)
        {
            var prop = component as IComponentProperty;

            if (prop == null)
            {
                throw new ArgumentException("THe value should be an IComponentProperty");
            }
            if (prop.Name == "RRULE" || prop.Name == "ATTENDEE" || prop.Name == "FREEBUSY")
            {
                if (MultipleValuesProperties.ContainsKey(prop.Name))
                {
                    MultipleValuesProperties[prop.Name].Add(prop);
                }
                else
                {
                    MultipleValuesProperties[prop.Name] = new List <IComponentProperty>()
                    {
                        prop
                    }
                };
            }
            else
            {
                Properties.Add(prop.Name, prop);
            }
        }
コード例 #2
0
        /// <summary>
        ///     Add a CalendarComponent property to the object.
        /// </summary>
        /// <param name="component">The calendarProperty to be added.</param>
        public virtual void AddItem(ICalendarObject component)
        {
            var prop = component as IComponentProperty;

            if (prop == null)
            {
                throw new ArgumentException("THe value should be an IComponentProperty");
            }

            //TODO:this properties should implement other interface to indentify that may contains
            //multiples values, this way is gonna be simpler this verification, among other things

            //check if the property is already in the object. If it is then put it in the
            //multiple property list.
            if (Properties.ContainsKey(prop.Name))
            {
                MultipleValuesProperties[prop.Name] = new List <IComponentProperty> {
                    prop, Properties[prop.Name]
                };
                Properties.Remove(prop.Name);
            }
            else if (MultipleValuesProperties.ContainsKey(prop.Name))
            {
                MultipleValuesProperties[prop.Name].Add(prop);
            }
            else
            {
                Properties.Add(prop.Name, prop);
            }
        }