in src/AccessibilityInsights/MainWindowHelpers/StateMachine.cs [125:182]
public void HandleBackToSelectingState()
{
// if coming from startup, restore left nav bar
if (this.CurrentPage == AppPage.Start)
{
this.bdLeftNav.IsEnabled = true;
this.gdModes.Visibility = Visibility.Visible;
this.btnPause.Visibility = Visibility.Visible;
}
// clear selected element highliter
HollowHighlightDriver.GetInstance(HighlighterType.Selected).Clear();
ImageOverlayDriver.ClearDefaultInstance();
// this can be disabled if previous action was loading old data format.
// bring it back to enabled state.
this.btnHilighter.IsEnabled = true;
// since we comes back to live mode, enable highlighter by default.
SelectAction.GetDefaultInstance().ClearSelectedContext();
// turn highlighter on once you get back to selection mode.
SetHighlightBtnState(true);
var highlightDriver = HollowHighlightDriver.GetDefaultInstance();
highlightDriver.HighlighterMode = ConfigurationManager.GetDefaultInstance().AppConfig.HighlighterMode;
highlightDriver.IsEnabled = true;
highlightDriver.SetElement(null);
/// make sure that all Mode UIs are clean since new selection will be done.
CleanUpAllModeUIs();
#pragma warning disable CA1508 // Dead code warning doesn't apply here
if (this.CurrentPage == AppPage.Start
|| (this.CurrentPage == AppPage.CCA)
|| (this.CurrentPage == AppPage.Test)
|| (this.CurrentPage == AppPage.Inspect && this.CurrentView != InspectView.Live)
|| (this.CurrentPage == AppPage.Events)
|| (this.CurrentPage == AppPage.Inspect && SelectAction.GetDefaultInstance().IsPaused))
{
SelectAction.GetDefaultInstance().Scope = ConfigurationManager.GetDefaultInstance().AppConfig.IsUnderElementScope ? Axe.Windows.Actions.Enums.SelectionScope.Element : Axe.Windows.Actions.Enums.SelectionScope.App;
cbSelectionScope.SelectedIndex = (SelectAction.GetDefaultInstance().Scope == Axe.Windows.Actions.Enums.SelectionScope.Element) ? 0 : 1;
StartInspectMode(InspectView.Live); // clean up data when we get back to selection mode.
this.CurrentPage = AppPage.Inspect;
this.CurrentView = InspectView.Live;
}
#pragma warning restore CA1508 // Dead code warning doesn't apply here
// garbage collection for any UI elements
GC.Collect();
// enable element selector
EnableElementSelector();
// if it was open when the switch back button is clicked.
HideConfigurationMode();
UpdateMainWindowUI();
}