예제 #1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Handle the File browse button to locate a file to write to.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private void btnFileBrowse_Click(object sender, EventArgs e)
 {
     if (m_fileDialog.ShowSaveDialog(txtOutputFile.Text, this) == DialogResult.OK)
     {
         txtOutputFile.Text = m_fileDialog.FileName;
     }
 }
예제 #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Handle the browse button to locate a file to write to.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private void m_btnBrowse_Click(object sender, System.EventArgs e)
 {
     if (m_fileDialog.ShowSaveDialog(m_txtOutputFile.Text, false, this) == DialogResult.OK)
     {
         m_txtOutputFile.Text = m_fileDialog.FileName;
         // Ensure that the end of the filename is visible, and that the beginning
         // is also visible if the whole filename fits.
         m_txtOutputFile.Select(0, 0);
         m_txtOutputFile.Select(m_txtOutputFile.Text.Length, 0);
     }
 }
예제 #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export an Open XML for Exchanging Scripture Annotations (OXESA) file.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool OnFileExportOXESA(object args)
		{
			CheckDisposed();
			XmlScrAnnotationsList list = new XmlScrAnnotationsList(Cache);
			// need to use the dataAccess from the rootbox to get the filtered list - TE-9277
			var dataAccess = m_dataEntryView.RootBox.DataAccess;
			foreach (IScrBookAnnotations annotations in m_scr.BookAnnotationsOS)
			{
				List<IScrScriptureNote> notesToExport = new List<IScrScriptureNote>();
				// TE-9371: Changed way to get hvo's of filtered notes to improve performance
				int arraySize = dataAccess.get_VecSize(annotations.Hvo, ScrBookAnnotationsTags.kflidNotes);
				int[] itemHvos;
				using (var arrayPtr = MarshalEx.ArrayToNative<int>(arraySize))
				{
					int chvo;
					dataAccess.VecProp(annotations.Hvo, ScrBookAnnotationsTags.kflidNotes, arraySize, out chvo, arrayPtr);
					itemHvos = MarshalEx.NativeToArray<int>(arrayPtr, chvo);
				}
				foreach (int hvo in itemHvos)
				{
					IScrScriptureNote note =
						Cache.ServiceLocator.GetInstance<IScrScriptureNoteRepository>().GetObject(hvo);

					if (note.AnnotationTypeRA.Guid == CmAnnotationDefnTags.kguidAnnTranslatorNote ||
						note.AnnotationTypeRA.Guid == CmAnnotationDefnTags.kguidAnnConsultantNote)
					{
						// When we are exporting only notes, we only want to export notes that
						// are translator notes or consultant notes (i.e. no checking error notes).
						notesToExport.Add(note);
					}
				}
				list.Add(notesToExport);
			}

			using (TeImportExportFileDialog dlg = new TeImportExportFileDialog(Cache.ProjectId.Name, FileType.OXESA))
			{
				// TODO: Need to supply a decent default filename. Should it include
				// a date/time to avoid accidental overwriting?
				if (dlg.ShowSaveDialog(null, this) == DialogResult.OK)
					list.SerializeToFile(dlg.FileName);
			}

			return true;
		}
예제 #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export an Open XML for Exchanging Scripture Annotations (OXESA) file.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool OnFileExportOXESA(object args)
		{
			CheckDisposed();

			XmlScrAnnotationsList list = new XmlScrAnnotationsList(Cache);
			TeNotesVc vc = m_dataEntryView.NotesEditingHelper.CurrentNotesVc;
			int filterFlid = vc.NotesSequenceHandler.Tag;
			foreach (int hvoAnnotations in m_scr.BookAnnotationsOS.HvoArray)
			{
				int[] allHvos = Cache.GetVectorProperty(hvoAnnotations, filterFlid, true);
				List<int> notesToExport = new List<int>();
				foreach (int noteHvo in allHvos)
				{
					ScrScriptureNote note = new ScrScriptureNote(m_cache, noteHvo);
					if (note.AnnotationTypeRA.Guid == LangProject.kguidAnnTranslatorNote ||
						note.AnnotationTypeRA.Guid == LangProject.kguidAnnConsultantNote)
					{
						// When we are exporting only notes, we only want to export notes that
						// are translator notes or consultant notes (i.e. no checking error notes).
						notesToExport.Add(noteHvo);
					}
				}
				list.Add(new FdoObjectSet<IScrScriptureNote>(Cache, notesToExport.ToArray(), false));
			}

			using (TeImportExportFileDialog dlg = new TeImportExportFileDialog(Cache, FileType.OXESA))
			{
				// TODO: Need to supply a decent default filename. Should it include
				// a date/time to avoid accidental overwriting?
				if (dlg.ShowSaveDialog(null, this) == DialogResult.OK)
					list.SerializeToFile(dlg.FileName);
			}
			return true;
		}