/// <summary> /// Called when the Add Event menu item is clicked. /// </summary> /// <param name="sender">The source object</param> /// <param name="e">Event arguments</param> private void OnAddEvent(object sender, EventArgs e) { Calendar cal = (Calendar)Component; PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(cal, "Items"); if (itemsDesc != null) { // Tell the designer that we're changing the property RaiseComponentChanging(itemsDesc); // Do the change CalendarItem calItem = new CalendarItem(0, "CalendarItem", DateTime.Now, "http://www.mediachase.com", "some desc"); cal.Items.Add(calItem); // Tell the designer that we've changed the property RaiseComponentChanged(itemsDesc, null, null); UpdateDesignTimeHtml(); } }
/// <summary> /// Called when the Add Owner menu item is clicked. /// </summary> /// <param name="sender">The source object</param> /// <param name="e">Event arguments</param> private void OnAddOwner(object sender, EventArgs e) { Calendar cal = (Calendar)Component; PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(cal, "Owners"); if (itemsDesc != null) { // Tell the designer that we're changing the property RaiseComponentChanging(itemsDesc); // Do the change Owner owner = new Owner("Owner", "Owner"); cal.Owners.Add(owner); // Tell the designer that we've changed the property RaiseComponentChanged(itemsDesc, null, null); UpdateDesignTimeHtml(); } }
/// <summary> /// Called when the Add Holiday menu item is clicked. /// </summary> /// <param name="sender">The source object</param> /// <param name="e">Event arguments</param> private void OnAddHoliday(object sender, EventArgs e) { Calendar cal = (Calendar)Component; PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(cal, "Holidays"); if (itemsDesc != null) { // Tell the designer that we're changing the property RaiseComponentChanging(itemsDesc); // Do the change Holiday holiday = new Holiday(DateTime.Now.Date, "Holiday"); cal.Holidays.Add(holiday); // Tell the designer that we've changed the property RaiseComponentChanged(itemsDesc, null, null); UpdateDesignTimeHtml(); } }