private void loadRules() { try { ElementInfo[] rules = OfficeApplication.OfficeDocumentProxy.getElementsOfResource(resourceInfo); this.Cursor = Cursors.WaitCursor; foreach (ElementInfo info in OfficeApplication.OfficeApplicationProxy.getElementsToAdd(siteInfo)) { bool exists = false; foreach (ElementInfo ruleinResource in rules) { if (ruleinResource.Equals(info)) { exists = true; break; } } if (!exists) { listView1.Items.Add(new ElementListView(info)); } } } catch (Exception e) { OfficeApplication.WriteError(e); } finally { this.Cursor = Cursors.Default; } }
private void initizalize() { this.checkBoxActivePag.Checked = pageInformation.page.active; this.dateTimePickerEndDate.Value = DateTime.Now; this.textBoxTitle.Text = pageInformation.title; this.textBoxDescription.Text = pageInformation.description; this.checkBoxActive.Checked = pageInformation.active; this.labelSite.Text = pageInformation.page.site.title; this.labelPage.Text = pageInformation.page.title; loadCalendars(); VersionInfo info = new VersionInfo(); info.nameOfVersion = "*"; comboBoxVersiones.Items.Add(info); foreach (VersionInfo versionInfo in OfficeApplication.OfficeDocumentProxy.getVersions(repositoryName, contentID)) { comboBoxVersiones.Items.Add(versionInfo); } VersionInfo selected = new VersionInfo(); selected.nameOfVersion = pageInformation.version; if (OfficeApplication.OfficeDocumentProxy.needsSendToPublish(pageInformation)) { this.toolTip1.SetToolTip(this.checkBoxActive, "Necesita enviar a flujo el contenido para activarlo"); this.buttonSenttoAuthorize.Visible = true; } else { this.buttonSenttoAuthorize.Visible = false; } if (OfficeApplication.OfficeDocumentProxy.isInFlow(pageInformation)) { this.toolTip1.SetToolTip(this.checkBoxActive, "El contenido se encuentra en proceso de ser autorizado, para activarlo, necesita terminar este proceso"); } comboBoxVersiones.SelectedItem = selected; loadProperties(); loadRules(); loadTitles(); try { DateTime date = OfficeApplication.OfficeDocumentProxy.getEndDate(pageInformation); if (date == null) { this.checkBoxEndDate.Checked = false; this.dateTimePickerEndDate.Enabled = false; } else { this.checkBoxEndDate.Checked = true; this.dateTimePickerEndDate.Enabled = true; this.dateTimePickerEndDate.Value = date; } } catch (Exception ue) { OfficeApplication.WriteError(ue); } }
private void toolStripButtonDeleteRule_Click(object sender, EventArgs e) { if (this.listViewRules.Items.Count > 0 && this.listViewRules.SelectedIndices.Count > 0) { ElementInfo info = ((ElementListView)listViewRules.SelectedItems[0]).ElementInfo; DialogResult res = MessageBox.Show(this, "¿Desea eliminar la regla / rol ó grupo de usuario " + info.title, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Question); if (res == DialogResult.OK) { try { this.Cursor = Cursors.WaitCursor; OfficeApplication.OfficeDocumentProxy.deleteElementToResource(pageInformation, info); loadRules(); if (listViewRules.Items.Count == 0 || listViewRules.SelectedIndices.Count == 0) { toolStripButtonDeleteRule.Enabled = false; toolStripButtonActivate.Enabled = false; } else { toolStripButtonDeleteRule.Enabled = true; toolStripButtonActivate.Enabled = true; } } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { this.Cursor = Cursors.Default; } } } }
private void TitleAndDescription_ShowStep(object sender, TSWizards.ShowStepEventArgs e) { this.textBoxTitle.Focus(); if (showType) { ComboBoxType.Items.Clear(); try { String repository = this.Wizard.Data[SelectCategory.REPOSITORY_ID].ToString(); foreach (ContentType type in OfficeApplication.OfficeApplicationProxy.getContentTypes(repository)) { this.ComboBoxType.Items.Add(type); } if (this.ComboBoxType.Items.Count > 0) { this.ComboBoxType.SelectedIndex = 0; } } catch (Exception ue) { OfficeApplication.WriteError(ue); } ContentType contentType = (ContentType)this.ComboBoxType.SelectedItem; String repositoryName = this.Wizard.Data[SelectCategory.REPOSITORY_ID].ToString(); PropertyInfo[] props = OfficeApplication.OfficeDocumentProxy.getContentProperties(repositoryName, contentType.id); if (props == null || props.Length == 0) { this.Wizard.changeToFinish(); } else { this.Wizard.changeToNext(); } } }
private void treedir_BeforeExpand(object sender, TreeViewCancelEventArgs e) { if (e.Node.FirstNode != null) { if (e.Node.FirstNode.Text.Equals("")) { e.Node.Nodes.Clear(); try { System.IO.DirectoryInfo dir = (DirectoryInfo)e.Node.Tag; System.IO.DirectoryInfo[] dirs = dir.GetDirectories(); foreach (System.IO.DirectoryInfo dirinfo in dirs) { TreeNode node = e.Node.Nodes.Add(dirinfo.Name); node.Tag = dirinfo; node.Nodes.Add(""); } } catch (System.IO.IOException ioe) { OfficeApplication.WriteError(ioe); } } } }
private void loadTree() { this.treeView1.Nodes.Clear(); TreeNode root = this.treeView1.Nodes.Add("Repositorios", "Repositorios", 0, 1); try { foreach (RepositoryInfo repository in OfficeApplication.OfficeApplicationProxy.getRepositories()) { RepositoryNode repositoryNode = new RepositoryNode(repository); root.Nodes.Add(repositoryNode); foreach (CategoryInfo category in OfficeApplication.OfficeApplicationProxy.getCategories(repository.name)) { CategoryNode categoryNode = new CategoryNode(category, repository); repositoryNode.Nodes.Add(categoryNode); if (category.childs > 0) { TreeNode dummyNode = new DummyNode(); categoryNode.Nodes.Add(dummyNode); } } } } catch (Exception e) { OfficeApplication.WriteError(e); } if (this.treeView1.Nodes.Count > 0) { this.treeView1.Nodes[0].Expand(); } }
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 static IEnumerable <Entry> LoadIds(OfficeVersion officeVersion, OfficeApplication officeApplication) { var folder = Path.Combine( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "OfficeData", officeVersion.ToString()); var files = new DirectoryInfo(folder).GetFiles("*.xlsx") .Where(f => f.Name.StartsWith(officeApplication.ToString(), StringComparison.OrdinalIgnoreCase)); foreach (var file in files) { using (var package = new ExcelPackage(file)) { var ws = package.Workbook.Worksheets.First(); for (var r = 2; r <= ws.Dimension.End.Row; r++) { yield return(new Entry { Completion = new Completion(ws.Cells[r, 1].GetValue <string>()), ControlType = ws.Cells[r, 2].GetValue <string>(), TabSet = ws.Cells[r, 3].GetValue <string>(), Tab = ws.Cells[r, 4].GetValue <string>(), Group = ws.Cells[r, 5].GetValue <string>(), ParentControl = ws.Cells[r, 6].GetValue <string>(), }); } } } }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (this.listViewCalendar.SelectedItems.Count > 0) { DialogResult res = MessageBox.Show(this, "¿Desea eliminar la calendarización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { CalendarInfo cal = ((CalendarItem)this.listViewCalendar.SelectedItems[0]).CalendarInfo; this.listViewCalendar.Items.Remove((CalendarItem)this.listViewCalendar.SelectedItems[0]); if (this.listViewCalendar.Items.Count == 0 || listViewCalendar.SelectedItems.Count == 0) { this.toolStripButtonDelete.Enabled = false; } try { added.Remove(cal); OfficeApplication.OfficeDocumentProxy.deleteCalendar(pageInformation, cal); loadCalendars(); } catch (Exception ue) { OfficeApplication.WriteError(ue); } } } if (this.listViewCalendar.SelectedItems.Count == 0) { this.toolStripButtonDelete.Enabled = false; } }
private void toolStripButtonAddPage_Click(object sender, EventArgs e) { OfficeApplication.CreatePage(); if (selectWebPage.SelectedWebPage != null) { selectWebPage.SelectedWebPage.ReLoadChilds(); selectWebPage.SelectedWebPage.Expand(); } }
/// <summary> /// Delete a Directory /// </summary> /// <param name="dir"></param> /// <exception cref="DirectoryNotFoundException">If the especific directory does not exist</exception> public static void DeleteTemporalDirectory(DirectoryInfo dir) { try { dir.Delete(true); } catch (DirectoryNotFoundException e) { OfficeApplication.WriteError(e); } }
internal override void Dispose(bool disposing) { if (disposing) { // Free managed if (_application != null) { _application.Dispose(); _application = null; } } base.Dispose(true); }
private void fillCalendarList() { this.listBoxCalendars.Items.Clear(); try { foreach (CalendarInfo cal in OfficeApplication.OfficeDocumentProxy.getCatalogCalendars(resourceInfo.page.site)) { this.listBoxCalendars.Items.Add(cal); } } catch (Exception e) { OfficeApplication.WriteError(e); } }
private void toolStripButtonView_Click(object sender, EventArgs e) { if (this.listViewVersions.SelectedItems.Count > 0) { String name = null; try { String version = this.listViewVersions.SelectedItems[0].Text; String type = document.DocumentType.ToString().ToLower(); name = OfficeApplication.OfficeDocumentProxy.createPreview(this.document.reporitoryID, this.document.contentID, version, type); String urlproxy = OfficeApplication.OfficeDocumentProxy.WebAddress.ToString(); if (!urlproxy.EndsWith("/gtw")) { if (!urlproxy.EndsWith("/")) { urlproxy += "/"; } if (!urlproxy.EndsWith("gtw")) { urlproxy += "gtw"; } } Uri url = new Uri(urlproxy + "?contentId=" + this.document.contentID + "&versionName=" + version + "&repositoryName=" + this.document.reporitoryID + "&name=" + name + "&type=" + type); String title = OfficeApplication.OfficeDocumentProxy.getTitle(this.document.reporitoryID, this.document.contentID); FormPreview dialogPreview = new FormPreview(url, false, title); dialogPreview.ShowDialog(this); } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { if (name != null) { try { OfficeApplication.OfficeDocumentProxy.deletePreview(name); } catch (Exception ue) { OfficeApplication.WriteError(ue); } } } } }
private void loadContents() { try { this.Cursor = Cursors.WaitCursor; this.toolStripButtonSee.Enabled = false; this.toolStripButtonAuthorize.Enabled = false; this.toolStripButtonReject.Enabled = false; this.listViewFlows.Items.Clear(); if (this.comboBoxSites.SelectedItem is WebSiteInfo) { WebSiteInfo site = (WebSiteInfo)this.comboBoxSites.SelectedItem; if (this.radioButtonAll.Checked) { foreach (FlowContentInformation info in OfficeApplication.OfficeApplicationProxy.getAllContents(site)) { FlowItem item = new FlowItem(info); this.listViewFlows.Items.Add(item); } } else if (this.radioButtonMyDocuments.Checked) { foreach (FlowContentInformation info in OfficeApplication.OfficeApplicationProxy.getMyContents(site)) { FlowItem item = new FlowItem(info); this.listViewFlows.Items.Add(item); } } else { foreach (FlowContentInformation info in OfficeApplication.OfficeApplicationProxy.getContentsForAuthorize(site)) { FlowItem item = new FlowItem(info); this.listViewFlows.Items.Add(item); } } } } catch (Exception e) { OfficeApplication.WriteError(e); } finally { this.Cursor = Cursors.Default; } }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (this.listBoxCalendars.SelectedItem != null) { CalendarInfo cal = (CalendarInfo)this.listBoxCalendars.SelectedItem; DialogResult res = MessageBox.Show(this, "¿Deseas eliminar la calendarización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { try { this.Cursor = Cursors.WaitCursor; bool canDelete = OfficeApplication.OfficeApplicationProxy.canDeleteCalendar(this.resourceInfo.page.site, cal); if (canDelete) { OfficeApplication.OfficeDocumentProxy.deleteCalendarFromCatalog(this.resourceInfo.page.site, cal); fillCalendarList(); if (this.listBoxCalendars.SelectedItem == null || this.listBoxCalendars.Items.Count == 0) { this.toolStripButtonDelete.Enabled = false; this.toolStripButtonEdit.Enabled = false; } else { this.toolStripButtonDelete.Enabled = true; this.toolStripButtonEdit.Enabled = true; } } else { MessageBox.Show(this, "¡El calendario no se puede borrar, esta siendo utilizado por otro contenido u otro elemento del portal!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { this.Cursor = Cursors.Default; } } } }
public static void setValue(WBOffice4.Interfaces.PropertyInfo prop, Object obj, String value) { Type type = obj.GetType(); String name = prop.id; int pos = name.IndexOf("#"); if (pos != -1) { name = name.Substring(pos + 1); } name = name.Replace(':', '_'); System.Reflection.PropertyInfo info = type.GetProperty(name); object[] index = { }; if (info.PropertyType.Name.Equals("Int32", StringComparison.InvariantCultureIgnoreCase)) { try { Int32 ivalue = Int32.Parse(value); info.SetValue(obj, ivalue, index); } catch (Exception e) { OfficeApplication.WriteError(e); } } else if (info.PropertyType.Name.Equals("Boolean", StringComparison.InvariantCultureIgnoreCase)) { try { bool bvalue = bool.Parse(value); info.SetValue(obj, bvalue, index); } catch (Exception e) { OfficeApplication.WriteError(e); } } else { info.SetValue(obj, value, index); } }
private void loadRules() { this.listViewRules.Items.Clear(); this.Cursor = Cursors.WaitCursor; try { foreach (ElementInfo info in OfficeApplication.OfficeDocumentProxy.getElementsOfResource(pageInformation)) { this.listViewRules.Items.Add(new ElementListView(info)); } } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { this.Cursor = Cursors.Default; } }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (this.listViewVersions.SelectedItems.Count > 0) { String versionInfo = this.listViewVersions.SelectedItems[0].Text; bool published = ((VersionInfo)this.listViewVersions.SelectedItems[0].Tag).published; if (published) { MessageBox.Show(this, "¡No se puede borrar una versión que ha sido publicada.!\r\nDebe borrar primero la publicación del contenido.", "Borrado de versión de contenido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { DialogResult res = MessageBox.Show(this, "¿Desea borrar la versión " + versionInfo + "?", "Borrado de versión de contenido", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { try { this.Cursor = Cursors.WaitCursor; OfficeApplication.OfficeDocumentProxy.deleteVersionOfContent(this.document.reporitoryID, this.document.contentID, versionInfo); loadVersions(); } catch (Exception ue) { OfficeApplication.WriteError(ue); } finally { this.Cursor = Cursors.Default; } } } catch (Exception ue) { OfficeApplication.WriteError(ue); } } }
private void toolStripButtonAddRule_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; FormAddElement frm = new FormAddElement(this.pageInformation.page.site, this.pageInformation); this.Cursor = Cursors.Default; DialogResult res = frm.ShowDialog(this); if (res == DialogResult.OK) { ElementInfo element = frm.ElementInfo; try { this.Cursor = Cursors.WaitCursor; OfficeApplication.OfficeDocumentProxy.addElementToResource(this.pageInformation, element); loadRules(); if (listViewRules.Items.Count == 0 || listViewRules.SelectedIndices.Count == 0) { toolStripButtonDeleteRule.Enabled = false; toolStripButtonActivate.Enabled = false; } else { toolStripButtonDeleteRule.Enabled = true; toolStripButtonActivate.Enabled = true; } } 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; } } } } }
private void toolStripButtonAdd_Click(object sender, EventArgs e) { FormCalendarList list = new FormCalendarList(pageInformation); DialogResult res = list.ShowDialog(this); if (res == DialogResult.OK) { if (list.listBoxCalendars.SelectedItem != null) { CalendarInfo calendar = (CalendarInfo)list.listBoxCalendars.SelectedItem; bool exists = false; int count = this.listViewCalendar.Items.Count; for (int i = 0; i < count; i++) { CalendarItem calactual = (CalendarItem)this.listViewCalendar.Items[i]; if (calactual.CalendarInfo.id.Equals(calendar.id)) { exists = true; break; } } if (!exists) { try { added.Add(calendar); } catch (Exception ue) { OfficeApplication.WriteError(ue); } } } } loadCalendars(); }
public OfficeDestination(OfficeApplication application, string extension, object fileFormat) { Application = application; Extension = extension; FileFormat = fileFormat; }
private void buttonDocstoAuthorize_Click(object sender, RibbonControlEventArgs e) { OfficeApplication.ShowDocumentsToAuthorize(); }
private void buttonCloseSession_Click(object sender, RibbonControlEventArgs e) { OfficeApplication.CloseSession(); }
private void buttonAbout_Click(object sender, RibbonControlEventArgs e) { OfficeApplication.ShowAbout(); }
private void buttonHelp_Click(object sender, RibbonControlEventArgs e) { OfficeApplication.ShowHelp(); }
private void buttonChangePassword_Click(object sender, RibbonControlEventArgs e) { OfficeApplication.ChangePassword(); }
private void buttonCreatePage_Click(object sender, RibbonControlEventArgs e) { OfficeApplication.CreatePage(); }
private IApplicationPrinterController GetInstance(OfficeApplication applicationType) { if (m_cache.ContainsKey(applicationType)) { //return m_cache[applicationType]; // Removing the above line and adding Dispose/Remove effectively disables the cache, while minimising the change. // Until we can better understand why the reuse of the application instance has side effects, we will have to take the performance hit. m_cache[applicationType].Dispose(); m_cache.Remove(applicationType); } IApplicationPrinterController controller = null; switch (applicationType) { case OfficeApplication.Word: controller = new WordPrinterController(); m_cache.Add(applicationType, controller); break; case OfficeApplication.Excel: controller = new ExcelPrinterController(); m_cache.Add(applicationType, controller); break; case OfficeApplication.PowerPoint: controller = new PowerPointPrinterController(); m_cache.Add(applicationType, controller); break; case OfficeApplication.Outlook: controller = new OutlookPrinterController(); m_cache.Add(applicationType, controller); break; } return controller; }
public static IEnumerable <Entry> GetIdsFromCache(OfficeVersion officeVersion, OfficeApplication officeApplication) { if (_entries == null) { _entries = new Dictionary <OfficeVersion, IDictionary <OfficeApplication, IEnumerable <Entry> > >(); } if (!_entries.ContainsKey(officeVersion)) { _entries[officeVersion] = new Dictionary <OfficeApplication, IEnumerable <Entry> >(); } var versionEntries = _entries[officeVersion]; if (!versionEntries.ContainsKey(officeApplication)) { versionEntries[officeApplication] = LoadIds(officeVersion, officeApplication).OrderBy(e => e.Completion.DisplayText).ToList(); } return(versionEntries[officeApplication]); }