private void toolStripButtonAdd_Click(object sender, EventArgs e) { FrmPeriodicidad dialogCalendar = new FrmPeriodicidad(false); DialogResult res = dialogCalendar.ShowDialog(this); if (res == DialogResult.OK) { XmlDocument xmlCalendar = dialogCalendar.Document; String xml = xmlCalendar.OuterXml; String title = dialogCalendar.textBoxTitle.Text; try { this.Cursor = Cursors.WaitCursor; OfficeApplication.OfficeApplicationProxy.createCalendar(resourceInfo.page.site, title, xml); fillCalendarList(); } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { this.Cursor = Cursors.Default; } } }
private void toolStripButtonEdit_Click(object sender, EventArgs e) { if (this.listBoxCalendars.SelectedItem != null) { CalendarInfo cal = (CalendarInfo)this.listBoxCalendars.SelectedItem; if (cal.xml != null) { FrmPeriodicidad dialogCalendar = new FrmPeriodicidad(cal.active); dialogCalendar.textBoxTitle.Text = cal.title; XmlDocument document = new XmlDocument(); document.LoadXml(cal.xml); dialogCalendar.Document = document; DialogResult res = dialogCalendar.ShowDialog(this); if (res == DialogResult.OK) { XmlDocument xmlCalendar = dialogCalendar.Document; String xml = xmlCalendar.OuterXml; String title = dialogCalendar.textBoxTitle.Text; cal.title = title; cal.xml = xml; try { this.Cursor = Cursors.WaitCursor; OfficeApplication.OfficeDocumentProxy.updateCalendar(resourceInfo.page.site, cal); } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { this.Cursor = Cursors.Default; } } } } }