示例#1
0
        private void HighlightUsages_CheckedChanged(object sender, EventArgs e)
        {
            WordHelpers.RunActionWithWaitCursor(() =>
            {
                ResetTheCounters();
                var isFieldChecked = HighlightAllUsages.Checked;

                if (isFieldChecked)
                {
                    if (_corectDefinitionOccurences.Count != 0)
                    {
                        HighLightCorrectUsages();
                        NextDefinition.Enabled = true;
                    }
                    else
                    {
                        if (HighlightIncorrectUsages.Checked && _incorrectDefinitionOccurences.Count != 0)
                        {
                            NextDefinition.Enabled = true;
                        }
                    }
                    return;
                }

                if (!HighlightIncorrectUsages.Checked)
                {
                    NextDefinition.Enabled    = false;
                    PreviousDefiniton.Enabled = false;
                }
                DocumentHelpers.ClearHightlightOnAllInstancesOfTerm(_corectDefinitionOccurences);
            });
        }
示例#2
0
        private void DefinitionBox_FormClosing(object sender, FormClosingEventArgs e)
        {
            ThisAddIn.DecreaseDialogCoords();

            WordHelpers.RunActionWithWaitCursor(() =>
            {
                if (HighlightAllUsages.Checked)
                {
                    if (_corectDefinitionOccurences.Count != 0)
                    {
                        DocumentHelpers.ClearHightlightOnAllInstancesOfTerm(_corectDefinitionOccurences);
                    }
                }
                if (HighlightIncorrectUsages.Checked)
                {
                    if (_incorrectDefinitionOccurences.Count != 0)
                    {
                        DocumentHelpers.ClearHightlightOnAllInstancesOfTerm(_incorrectDefinitionOccurences);
                    }
                }
                if (_currentPosition != null)
                {
                    Navigate.ToRange(_currentPosition);
                }
            });
        }
示例#3
0
        private void HighlightIncorrectUsages_CheckedChanged(object sender, EventArgs e)
        {
            ResetTheCounters();
            var isFieldChecked = HighlightIncorrectUsages.Checked;

            if (isFieldChecked)
            {
                LogHelper.Info("Highlight incorrect usages of definition.");
                if (_incorrectDefinitionOccurences.Count != 0)
                {
                    HighLightIncorrectUsages();
                    NextDefinition.Enabled = true;
                }
                else
                {
                    if (HighlightAllUsages.Checked && _corectDefinitionOccurences.Count != 0)
                    {
                        NextDefinition.Enabled = true;
                    }
                }
                return;
            }

            if (!HighlightAllUsages.Checked)
            {
                NextDefinition.Enabled    = false;
                PreviousDefiniton.Enabled = false;
            }

            LogHelper.Info("Clear highlights.");
            DocumentHelpers.ClearHightlightOnAllInstancesOfTerm(_incorrectDefinitionOccurences);
        }