Ejemplo n.º 1
0
        private void SendParagraphForVerification(RangeWrapper par)
        {
            if (par == null || !par.IsRangeValid)
            {
                return;
            }


            if (!m_verifier.InitParagraph(par))
            {
                return;
            }


            while (m_verifier.HasVerification())
            {
                if (m_cancelationPending)
                {
                    return;
                }

                // info about content and location of error, or even the related range
                VerificationData verData = m_verifier.GetNextVerificationData();

                if (verData == null || !verData.IsValid)
                {
                    continue;
                }

                //// SendToUi this verData and wait for user interaction
                //// VerificationResult contains selected suggestion user action and viwercontroller argument
                //VerificationResult verRes = SendVerificationToUi(verData);

                string defSuggestion = verData.Suggestions.DefaultSuggestion;
                if (defSuggestion == null)
                {
                    continue;
                }

                if (ShowProgressAtDocument)
                {
                    verData.RangeToHighlight.Select();
                }

                m_verifier.ApplyBatchModeAction(verData.RangeToHighlight, defSuggestion);
            }
        }
        private void SendParagraphForVerification(RangeWrapper par)
        {
            if (par == null || !par.IsRangeValid)
            {
                return;
            }


            if (!m_verifier.InitParagraph(par))
            {
                return;
            }


            while (m_verifier.HasVerification())
            {
                if (m_cancelationPending || LastUserAction == UserSelectedActions.Resume)
                {
                    return;
                }

                // info about content and location of error, or even the related range
                VerificationData verData = m_verifier.GetNextVerificationData();

                if (verData == null || !verData.IsValid)
                {
                    continue;
                }

                // SendToUi this verData and wait for user interaction
                // VerificationResult contains selected suggestion user action and viwercontroller argument
                VerificationResult verRes = SendVerificationToUi(verData);

                if (m_cancelationPending || LastUserAction == UserSelectedActions.Resume)
                {
                    return;
                }

                // UI is unaware of the addToDic dialog or any other kind of dialogs it may have
                // UI should provide means for verifier to call its desired UI dialog shows or others
                ProceedTypes procType = m_verifier.GetProceedTypeForVerificationResult(verRes);


                while (procType == ProceedTypes.InvalidUserAction)
                {
                    verRes = WaitForMoreUserActions();

                    if (m_cancelationPending || LastUserAction == UserSelectedActions.Resume)
                    {
                        return;
                    }

                    procType = m_verifier.GetProceedTypeForVerificationResult(verRes);
                }

                if (procType == ProceedTypes.IdleProceed)
                {
                    GoIdle();
                }
            }
        }