SIL.FieldWorks.IText.InterlinDocForAnalysis.SelectOccurrence C# (CSharp) Method

SelectOccurrence() public method

Select the word indicated by the occurrence. Note that this does not save any changes made in the Sandbox. It is mainly used when the view is read-only.
public SelectOccurrence ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target ) : void
target SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
return void
		public override void SelectOccurrence(AnalysisOccurrence target)
		{
			if (target == null)
			{
				TryHideFocusBoxAndUninstall();
				return;
			}
			if (SelectedOccurrence == target && IsFocusBoxInstalled)
			{
				// Don't steal the focus from another window.  See FWR-1795.
				if (ParentForm == Form.ActiveForm)
				{
					if (ExistingFocusBox.CanFocus)
					{
						ExistingFocusBox.Focus(); // important when switching tabs with ctrl-tab.
					}
					else
					{
						VisibleChanged += FocusWhenVisible;
					}
				}
				return;
			}
			if (!m_vc.CanBeAnalyzed(target))
				return;
#if DEBUG
			// test preconditions.
			Debug.Assert(target.IsValid && !(target.Analysis is IPunctuationForm), "Given annotation type should not be punctuation"
				+ " but was " + target.Analysis.ShortName + ".");
#endif
			TriggerAnnotationSelected(target, true);
		}

Usage Example

            public override bool Redo()
            {
                if (m_newOccurrence != null && m_newOccurrence.IsValid)
                {
                    m_interlinDoc.SelectOccurrence(m_newOccurrence);
                }
                else
                {
                    m_interlinDoc.TryHideFocusBoxAndUninstall();
                }

                return(true);
            }
InterlinDocForAnalysis