예제 #1
0
        /// <summary>
        /// Bring app back to selecting State
        /// </summary>
        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();
        }
예제 #2
0
 /// <summary>
 /// Clears listview
 /// </summary>
 public void ClearUI()
 {
     ImageOverlayDriver.ClearDefaultInstance();
     this.ElementContext        = null;
     this.lvResults.ItemsSource = null;
     this.tbGlimpse.Text        = Properties.Resources.GlimpseTextTarget;
     this.gdFailures.Visibility = Visibility.Collapsed;
     this.SelectedItems.Clear();
 }
 /// <summary>
 /// Clears listview
 /// </summary>
 public void ClearUI()
 {
     ImageOverlayDriver.ClearDefaultInstance();
     this.ElementContext = null;
     this.nonFrameworkListControl.Reset();
     this.frameworkListControl.Reset();
     this.tbGlimpse.Text        = Properties.Resources.GlimpseTextTarget;
     this.gdFailures.Visibility = Visibility.Collapsed;
 }
        /// <summary>
        /// Refresh
        /// </summary>
        public void Refresh()
        {
            // data will be asked to be captured again. so set the CurrentView right.
            MainWin.SetCurrentViewAndUpdateUI(TestView.CapturingData);

            ImageOverlayDriver.ClearDefaultInstance();

            var ecId = SelectAction.GetDefaultInstance().GetSelectedElementContextId().Value;

            SetDataAction.ReleaseDataContext(ecId);
#pragma warning disable CS4014
            // NOTE: We aren't awaiting this async call, so if you
            // touch it, consider if you need to add the await
            this.SetElement(ecId);
#pragma warning restore CS4014
        }