private void highlightingToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem senderMenuItem = (ToolStripMenuItem)sender; if (senderMenuItem.Checked) return; this._applicationState.HighLight = (string)senderMenuItem.Tag; rectangleHighlightingToolStripMenuItem.Checked = false; fadingRectangleHighlightingToolStripMenuItem.Checked = false; raysAndRectangleHighlightingToolStripMenuItem.Checked = false; noneHighlightingToolStripMenuItem.Checked = false; senderMenuItem.Checked = true; StopHighlighting(); switch (this._applicationState.HighLight) { case ElementHighlighterFactory.None: { break; } default: { _highlighter = ElementHighlighterFactory.CreateHighlighterById(this._applicationState.HighLight, this._automationElementTree); _highlighter.StartHighlighting(); break; } } }
private void StopHighlighting() { if (this._highlighter != null) { this._highlighter.Dispose(); this._highlighter = null; } }