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

TryHideFocusBoxAndUninstall() private method

Hides the sandbox and removes it from the controls.
private TryHideFocusBoxAndUninstall ( ) : bool
return bool
		internal override bool TryHideFocusBoxAndUninstall()
		{
			if (!IsFocusBoxInstalled)
			{
				SelectedOccurrence = null;
				return false;
			}
			var oldAnnotation = SelectedOccurrence;
			SelectedOccurrence = null;
			SimulateReplaceAnalysis(oldAnnotation);
			bool fFocus = this.Focused || ExistingFocusBox.ContainsFocus;
			FocusBox.SizeChanged -= FocusBox_SizeChanged;
			ExistingFocusBox.SuspendLayout();
			ExistingFocusBox.Visible = false;
			this.SuspendLayout();
			this.Controls.Remove(ExistingFocusBox);
			this.ResumeLayout();
			ExistingFocusBox.ResumeLayout();
			// hiding the ExistingFocusBox can sometimes leave the focus on one of its controls,
			// believe it or not!  (See FWR-3188.)
			if (fFocus && !this.Focused)
				this.Focus();
			return 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