Esempio n. 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handle the File/Export/Xhtml menu command
		/// </summary>
		/// <param name="args"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected bool OnFileExportXhtml(object args)
		{
			using (ExportXmlDialog dlg = new ExportXmlDialog(m_cache, m_bookFilter, GetReferenceToCurrentBook().Book,
				m_StyleSheet, FileType.XHTML, m_app))
			{
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					// TODO/REVIEW: get the stylesheet overridden for printing.
					ExportXhtml export = new ExportXhtml(dlg.FileName, m_cache, m_bookFilter,
						dlg.ExportWhat, dlg.BookNumber, dlg.FirstSection, dlg.LastSection,
						dlg.Description, m_StyleSheet, CurrentPublication, m_app);
					export.Run(this);
				}
			}
			return true;
		}
Esempio n. 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export Key Terms menu handler
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected bool OnFileExportKeyTerms(object args)
		{
			FilteredScrBooks filteredScrBooks = m_cache.ServiceLocator.GetInstance<IFilteredScrBookRepository>().GetFilterInstance(
				m_bookFilterInstance);

			int defaultBook = (SelectedReference.ChkRef != null) ?
				BCVRef.GetBookFromBcv(SelectedReference.ChkRef.Ref) : 0;
			using (ExportXmlDialog dlg = new ExportXmlDialog(m_cache, filteredScrBooks, defaultBook,
				m_stylesheet, FileType.OXEKT, m_helpTopicProvider))
			{
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					XmlTermRenderingsList terms = new XmlTermRenderingsList(m_cache.LangProject);
					terms.SerializeToFile(dlg.FileName);
					MessageBox.Show(Properties.Resources.kstidOxektExportCompleteMsg,
						Properties.Resources.kstidOxektExportTitle, MessageBoxButtons.OK);
				}
			}
			return true;
		}
Esempio n. 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handle the File/Export/Xml menu command
		/// </summary>
		/// <param name="args"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected bool OnFileExportXml(object args)
		{
			AdjustScriptureAnnotations();
			using (ExportXmlDialog dlg = new ExportXmlDialog(m_cache, m_bookFilter, GetReferenceToCurrentBook().Book,
				m_StyleSheet, FileType.OXES, m_app))
			{
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					string filename = Path.GetFileName(dlg.FileName);
					string directory = Path.GetDirectoryName(dlg.FileName);
					// REVIEW (TimS): What does this code accomplish? It seems to just re-create
					// dlg.FileName in parts.
					if (directory.EndsWith(Path.VolumeSeparatorChar.ToString()))
						directory += Path.DirectorySeparatorChar;

					ExportXml export = new ExportXml(Path.Combine(directory, filename), m_cache,
						m_bookFilter, m_app, dlg.ExportWhat, dlg.BookNumber, dlg.FirstSection,
						dlg.LastSection, dlg.Description);
					if (export.Run(this))
					{
						// Validate the XML file. If it doesn't pass validation, display a
						// yellow error message box.
						string strError = Validator.GetAnyValidationErrors(export.FileName);
						if (!String.IsNullOrEmpty(strError))
							throw new ContinuableErrorException(strError);
					}
				}
			}
			return true;
		}
Esempio n. 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handle the File/Export/Xml menu command
		/// </summary>
		/// <param name="args"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected bool OnFileExportXml(object args)
		{
			AdjustScriptureAnnotations();
			ScrReference refBook = GetReferenceToCurrentBook();
			using (ExportXmlDialog dlg = new ExportXmlDialog(m_cache, m_bookFilter, refBook,
				m_StyleSheet, FileType.OXES))
			{
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					ExportXml export = new ExportXml(dlg.FileName, m_cache, m_bookFilter,
						dlg.ExportWhat, dlg.BookNumber, dlg.FirstSection, dlg.LastSection,
						dlg.Description);
					string filename = Path.GetFileName(dlg.FileName);
					string directory = Path.GetDirectoryName(dlg.FileName);
					if (directory.EndsWith(Path.VolumeSeparatorChar.ToString()) &&
						!directory.EndsWith(Path.DirectorySeparatorChar.ToString()))
					{
						directory += Path.DirectorySeparatorChar.ToString();
					}
					export.FileName = Path.Combine(directory, filename);
					if (export.Run())
					{
						// Validate the XML file. If it doesn't pass validation, display a
						// yellow error message box.
						string strError = Validator.GetAnyValidationErrors(export.FileName);
						if (!String.IsNullOrEmpty(strError))
							throw new SIL.Utils.ContinuableErrorException(strError);
					}
				}
			}
			return true;
		}