private void btnEditSource_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var item = view.GetFocusedRow() as BibliographySource; if (item.IsNotNullOrMissing()) { using (var dlg = new SourceForm(item, grid.DataSource as List <BibliographySource>)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dlg.Save(); Microsoft.Office.Interop.Word.Source src = null; foreach (Microsoft.Office.Interop.Word.Source source in Document.Bibliography.Sources) { if (source.Tag == dlg.Source.Tag) { src = source; break; } } if (src != null) { var xml = GetXml(dlg.Source); src.Delete(); Document.Bibliography.Sources.Add(xml.Trim()); LoadBibliography(); } } } } }
private void btnAddSource_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (var dlg = new SourceForm(grid.DataSource as List <BibliographySource>)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg.Source != null) { dlg.Save(); var xml = GetXml(dlg.Source); Document.Bibliography.Sources.Add(xml.Trim()); LoadBibliography(); } } } }