Ejemplo n.º 1
0
        void parser_SetStepsCompleted(object sender, LiftIO.Parsing.LiftParser <LiftObject, LiftEntry, LiftSense, LiftExample> .ProgressEventArgs e)
        {
            int nMin, nMax;

            m_progressDlg.GetRange(out nMin, out nMax);
            if (e.Progress > nMax)
            {
                m_progressDlg.Position = e.Progress % nMax;
            }
            else
            {
                m_progressDlg.Position = e.Progress;
            }
        }
Ejemplo n.º 2
0
 void parser_SetStepsCompleted(object sender, LiftIO.Parsing.LiftParser <LiftObject, LiftEntry, LiftSense, LiftExample> .ProgressEventArgs e)
 {
     if (m_progressDlg != null)
     {
         int nMin, nMax;
         m_progressDlg.GetRange(out nMin, out nMax);
         Debug.Assert(nMin < nMax);
         if (nMin >= nMax)
         {
             nMax = nMin + 1;
         }
         int n = e.Progress;
         if (n < nMin)
         {
             n = nMin;
         }
         if (n > nMax)
         {
             while (n > nMax)
             {
                 n = nMin + (n - nMax);
             }
         }
         m_progressDlg.Position = n;
     }
     e.Cancel = m_fCancelNow;
 }
Ejemplo n.º 3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// If <paramref name="progressDlg"/> is not <c>null</c> we run the background task
 /// with that progress dialog (without creating a separate thread). Otherwise we display
 /// a new progress dialog as a modal dialog and start the background task in a separate
 /// thread.
 /// </summary>
 /// <param name="progressDlg">The existing progress dialog, or <c>null</c>.</param>
 /// <param name="fDisplayUi">set to <c>true</c> to display the progress dialog,
 /// <c>false</c> to run without UI.</param>
 /// <param name="backgroundTask">The background task.</param>
 /// <param name="parameters">The paramters that will be passed to the background task</param>
 /// <returns>The return value from the background thread.</returns>
 /// ------------------------------------------------------------------------------------
 public object RunTask(IAdvInd4 progressDlg, bool fDisplayUi,
                       BackgroundTaskInvoker backgroundTask, params object[] parameters)
 {
     if (progressDlg != null)
     {
         int nMin;
         int nMax = 0;
         progressDlg.GetRange(out nMin, out nMax);
         progressDlg.Position = nMin;
         object ret = backgroundTask(progressDlg, parameters);
         progressDlg.SetRange(nMin, nMax);
         progressDlg.Position = nMax;
         return(ret);
     }
     return(RunTask(fDisplayUi, backgroundTask, parameters));
 }
Ejemplo n.º 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// If <paramref name="progressDlg"/> is not <c>null</c> we run the background task
		/// with that progress dialog (without creating a separate thread). Otherwise we display
		/// a new progress dialog as a modal dialog and start the background task in a separate
		/// thread.
		/// </summary>
		/// <param name="progressDlg">The existing progress dialog, or <c>null</c>.</param>
		/// <param name="fDisplayUi">set to <c>true</c> to display the progress dialog,
		/// <c>false</c> to run without UI.</param>
		/// <param name="backgroundTask">The background task.</param>
		/// <param name="parameters">The paramters that will be passed to the background task</param>
		/// <returns>The return value from the background thread.</returns>
		/// ------------------------------------------------------------------------------------
		public object RunTask(IAdvInd4 progressDlg, bool fDisplayUi,
			BackgroundTaskInvoker backgroundTask, params object[] parameters)
		{
			if (progressDlg != null)
			{
				int nMin;
				int nMax = 0;
				progressDlg.GetRange(out nMin, out nMax);
				progressDlg.Position = nMin;
				object ret = backgroundTask(progressDlg, parameters);
				progressDlg.SetRange(nMin, nMax);
				progressDlg.Position = nMax;
				return ret;
			}
			return RunTask(fDisplayUi, backgroundTask, parameters);
		}
Ejemplo n.º 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes the scripture project.
		/// </summary>
		/// <param name="progressDialog">The progress dialog.</param>
		/// <param name="parameters">The parameters.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private object InitializeScriptureProject(IAdvInd4 progressDialog, params object[] parameters)
		{
			ILangProject lp = m_cache.LangProject;

			if (m_scr == null)
			{
				m_scr = lp.TranslatedScriptureOA = new Scripture();

				//Initialize factory styles
				TeStylesXmlAccessor.CreateFactoryScrStyles(progressDialog, m_scr);

				// Initialize the separator and bridge strings.
				m_scr.ChapterVerseSepr = ":";
				m_scr.Bridge = "-";
				m_scr.RefSepr = ";";
				m_scr.VerseSepr = ",";

				//Initialize misc
				m_scr.RestartFootnoteSequence = true;
				m_scr.CrossRefsCombinedWithFootnotes = false;

				m_scr.FootnoteMarkerType = FootnoteMarkerTypes.AutoFootnoteMarker;
				m_scr.FootnoteMarkerSymbol = Scripture.kDefaultFootnoteMarkerSymbol;
				m_scr.DisplayFootnoteReference = false;

				m_scr.CrossRefMarkerType = FootnoteMarkerTypes.NoFootnoteMarker;
				m_scr.CrossRefMarkerSymbol = Scripture.kDefaultFootnoteMarkerSymbol;
				m_scr.DisplayCrossRefReference = true;
			}

			// Initialize Scripture book annotations
			if (m_scr.BookAnnotationsOS.Count == 0)
				CreateScrBookAnnotations();

			//Initialize Scripture Book Ref info
			if (m_cache.ScriptureReferenceSystem.BooksOS.Count == 0)
				CreateScrBookRefs(progressDialog);

			//Initialize factory publications
			if (m_scr.PublicationsOC.Count == 0)
				TePublicationsInit.CreatePublicationInfo(progressDialog, m_scr);

			//Initialize the key terms
			ICmPossibilityList keyTermsList = lp.KeyTermsList;
			if (keyTermsList.PossibilitiesOS.Count < 1)
				TeKeyTermsInit.CreateKeyTerms(progressDialog, keyTermsList);

			//Initialize the note categories
			if (m_scr.NoteCategoriesOA == null || m_scr.NoteCategoriesOA.PossibilitiesOS.Count == 0)
				TeScrNoteCategoriesInit.CreateFactoryScrNoteCategories(progressDialog, m_scr);

			m_cache.Save();

			// For good measure, on the off-chance the user notices.
			int nMin, nMax;
			progressDialog.GetRange(out nMin, out nMax);
			progressDialog.Position = nMax;

			return null;
		}
Ejemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes the scripture project.
        /// </summary>
        /// <param name="progressDialog">The progress dialog.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        private object InitializeScriptureProject(IAdvInd4 progressDialog, params object[] parameters)
        {
            ILangProject lp = m_cache.LangProject;

            if (m_scr == null)
            {
                m_scr = lp.TranslatedScriptureOA = new Scripture();

                //Initialize factory styles
                TeStylesXmlAccessor.CreateFactoryScrStyles(progressDialog, m_scr);

                // Initialize the separator and bridge strings.
                m_scr.ChapterVerseSepr = ":";
                m_scr.Bridge           = "-";
                m_scr.RefSepr          = ";";
                m_scr.VerseSepr        = ",";

                //Initialize misc
                m_scr.RestartFootnoteSequence        = true;
                m_scr.CrossRefsCombinedWithFootnotes = false;

                m_scr.FootnoteMarkerType       = FootnoteMarkerTypes.AutoFootnoteMarker;
                m_scr.FootnoteMarkerSymbol     = Scripture.kDefaultFootnoteMarkerSymbol;
                m_scr.DisplayFootnoteReference = false;

                m_scr.CrossRefMarkerType       = FootnoteMarkerTypes.NoFootnoteMarker;
                m_scr.CrossRefMarkerSymbol     = Scripture.kDefaultFootnoteMarkerSymbol;
                m_scr.DisplayCrossRefReference = true;
            }

            // Initialize Scripture book annotations
            if (m_scr.BookAnnotationsOS.Count == 0)
            {
                CreateScrBookAnnotations();
            }

            //Initialize Scripture Book Ref info
            if (m_cache.ScriptureReferenceSystem.BooksOS.Count == 0)
            {
                CreateScrBookRefs(progressDialog);
            }

            //Initialize factory publications
            if (m_scr.PublicationsOC.Count == 0)
            {
                TePublicationsInit.CreatePublicationInfo(progressDialog, m_scr);
            }

            //Initialize the key terms
            ICmPossibilityList keyTermsList = lp.KeyTermsList;

            if (keyTermsList.PossibilitiesOS.Count < 1)
            {
                TeKeyTermsInit.CreateKeyTerms(progressDialog, keyTermsList);
            }

            //Initialize the note categories
            if (m_scr.NoteCategoriesOA == null || m_scr.NoteCategoriesOA.PossibilitiesOS.Count == 0)
            {
                TeScrNoteCategoriesInit.CreateFactoryScrNoteCategories(progressDialog, m_scr);
            }

            m_cache.Save();

            // For good measure, on the off-chance the user notices.
            int nMin, nMax;

            progressDialog.GetRange(out nMin, out nMax);
            progressDialog.Position = nMax;

            return(null);
        }