Example #1
0
        /// <summary>
        /// Switches to snapshot mode and selects appropriate element
        /// </summary>
        /// <param name="followUp">An action to perform after tests have been run</param>
        private void StartElementHowToFixView(Action followUp = null)
        {
            var ecId = SelectAction.GetDefaultInstance().GetSelectedElementContextId();

            this.CurrentPage = AppPage.Test;
            this.CurrentView = TestView.ElementHowToFix;

            var tp = GetDataAction.GetProcessAndUIFrameworkOfElementContext(ecId.Value);

            PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString(), tp.Item2);

            this.ctrlCurMode.HideControl();
            this.ctrlCurMode = this.ctrlSnapMode;
            this.ctrlSnapMode.DataContextMode = GetDataContextModeForTest();
            this.ctrlCurMode.ShowControl();

            DisableElementSelector();
#pragma warning disable CA2008 // Do not create tasks without passing a TaskScheduler
            ctrlSnapMode.SetElement(ecId.Value).ContinueWith(
                t =>
            {
                followUp?.Invoke();
            });
#pragma warning restore CA2008 // Do not create tasks without passing a TaskScheduler
        }
Example #2
0
        /// <summary>
        /// Start snapshot mode with loading data
        /// </summary>
        private void StartLoadingSnapshot(string path, int?selectedElementId = null)
        {
            DisableElementSelector();

            var v = SelectAction.GetDefaultInstance().SelectLoadedData(path, selectedElementId);

            Logger.PublishTelemetryEvent(TelemetryEventFactory.ForLoadDataFile(v.Item2.Mode.ToString()));

            if (v.Item2.Mode == A11yFileMode.Test && !selectedElementId.HasValue)
            {
                StartTestAutomatedChecksView();
            }
            else if (v.Item2.Mode == A11yFileMode.Contrast)
            {
                StartTestAutomatedChecksView(); // we got rid of the CC test tab.
            }
            else // A11yFileMode.Inspect
            {
                this.ctrlCurMode.HideControl();
                this.ctrlCurMode = this.ctrlSnapMode;
                this.ctrlSnapMode.DataContextMode = GetDataContextModeForTest();
                this.CurrentPage = AppPage.Test;
                this.CurrentView = TestView.ElementDetails;
                this.ctrlCurMode.ShowControl();
#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.ctrlSnapMode.SetElement(v.Item1);
#pragma warning restore CS4014
            }

            PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString());
        }
Example #3
0
        /// <summary>
        /// Start snapshot mode.
        /// </summary>
        private void StartElementDetailView()
        {
            var ecId = SelectAction.GetDefaultInstance().GetSelectedElementContextId();

            if (ecId != null)
            {
                this.CurrentPage = AppPage.Test;
                this.CurrentView = TestView.CapturingData;
                DisableElementSelector();

                var tp = GetDataAction.GetProcessAndUIFrameworkOfElementContext(ecId.Value);

                PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString(), tp.Item2);

                this.ctrlCurMode.HideControl();
                this.ctrlCurMode = this.ctrlSnapMode;
                this.ctrlSnapMode.DataContextMode = GetDataContextModeForTest();
                this.ctrlCurMode.ShowControl();

#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
                ctrlSnapMode.SetElement(ecId.Value);
#pragma warning restore CS4014
            }
            else
            {
                this.AllowFurtherAction = false;
                MessageDialog.Show(Properties.Resources.StartElementDetailViewNoElementIsSelectedMessage);
                this.AllowFurtherAction = true;
            }
        }
Example #4
0
        /// <summary>
        /// Start fastpass mode.
        /// </summary>
        private void StartTestAutomatedChecksView()
        {
            var ec = SelectAction.GetDefaultInstance().GetSelectedElementContextId();

            if (ec != null)
            {
                DisableElementSelector();

                ctrlCurMode.HideControl();
                // make sure that we honor loaded data. but in this case, some of manual test should be disabled.
                ctrlTestMode.DataContextMode = GetDataContextModeForTest();
                ctrlCurMode = ctrlTestMode;
                ctrlCurMode.ShowControl();

                // set mode to data capturing
                this.CurrentPage = AppPage.Test;
                this.CurrentView = TestView.CapturingData;

#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.ctrlTestMode.SetElement(ec.Value);
#pragma warning restore CS4014

                var tp = GetDataAction.GetProcessAndUIFrameworkOfElementContext(ec.Value);
                PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString(), tp.Item2);
            }
            else
            {
                this.AllowFurtherAction = false;
                MessageDialog.Show(Properties.Resources.StartElementDetailViewNoElementIsSelectedMessage);
                this.AllowFurtherAction = true;
            }
        }
        /// <summary>
        /// Start Live Monitor mode
        /// show only single selected item information
        /// </summary>
        private void StartLiveMode()
        {
            if (!(this.CurrentPage == AppPage.Inspect && (InspectView)this.CurrentView == InspectView.Live))
            {
                this.CurrentPage = AppPage.Inspect;
                this.CurrentView = InspectView.Live;
                PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString());

                // make sure that highlighter is cleared for new selection.
                HollowHighlightDriver.GetDefaultInstance().Clear();

                SetWindowForLiveMode();
            }

            // set the state to Capturing view. it will prevent testing for safety.
            this.CurrentView = InspectView.CapturingData;

            var ecId = SelectAction.GetDefaultInstance().SelectedElementContextId;

            if (ecId != null)
            {
                // make sure that no more selection is requested.
                DisableElementSelector();

                // Pass the currently selected Element Context
                this.ctrlCurMode.SetElement(ecId.Value);
            }
            else
            {
                // make sure that state is set to Live since View is not changed via SetElement.
                SetCurrentViewAndUpdateUI(InspectView.Live);
                EnableElementSelector();
            }
        }
 void InitStartMode()
 {
     this.CurrentPage = AppPage.Start;
     PageTracker.TrackPage(this.CurrentPage, null);
     this.gdModes.Visibility  = Visibility.Visible;
     this.btnPause.Visibility = Visibility.Visible;
     ctrlDialogContainer.ShowDialog(new StartUpModeControl()).ContinueWith(BackToSelectingOnDispatcher, TaskScheduler.Current);
     ShowTelemetryDialog();
     CheckForUpdates();
 }
Example #7
0
        /// <summary>
        /// Start Start Mode
        /// </summary>
        /// <returns></returns>
        void StartStartMode()
        {
            this.CurrentPage = AppPage.Start;
            this.ctrlCurMode = ctrlStartUpMode;
            PageTracker.TrackPage(this.CurrentPage, null);

            /// Make sure that title and Name property are set with same value.
            UpdateTitleString();

            this.hWnd = new WindowInteropHelper(this).Handle;

            ImageOverlayDriver.SetHighlightBtnState = SetHighlightBtnState;
            HollowHighlightDriver.GetDefaultInstance().HighlighterMode = ConfigurationManager.GetDefaultInstance().AppConfig.HighlighterMode;

            InitHotKeys();
            InitSelectActionMode();
            InitTimerSelector();
            InitTimerAutoSnap();
            InitAccessKeyRule();
            InitHighlighter();

            /// Set UI appropriately if showing startup screen
            if (ConfigurationManager.GetDefaultInstance().AppConfig.NeedToShowWelcomeScreen())
            {
                this.bdLeftNav.IsEnabled = false;
                this.gdModes.Visibility  = Visibility.Collapsed;
                this.ctrlStartUpMode.ShowControl();
                //show telemetry dialog
                ShowTelemetryDialog();
                // make sure that we show update.
                CheckForUpdates();
            }
            else
            {
                HandleBackToSelectingState();
                // make sure that we disable selector before showing update
                // otherwise, UI could be in weird state (Main window is gray out but still show selection and update dialog is disappearing)
                DisableElementSelector();
                //show telemetry dialog
                ShowTelemetryDialog();
                CheckForUpdates();
                EnableElementSelector();
            }

            // chrome height is set to make sure system menu is shown over title bar area.
            var chrome = new WindowChrome();

            chrome.CaptionHeight = 35;
            WindowChrome.SetWindowChrome(this, chrome);

            UpdateTabSelection();
        }
Example #8
0
        /// <summary>
        /// Allow to change view value from mode control and update title.
        /// </summary>
        /// <param name="view"></param>
        internal void SetCurrentViewAndUpdateUI(dynamic view)
        {
            var ec = SelectAction.GetDefaultInstance().GetSelectedElementContextId();

            this.CurrentView = view;
            if (ec != null)
            {
                var tp = GetDataAction.GetProcessAndUIFrameworkOfElementContext(ec.Value);
                PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString(), tp.Item2);
            }

            UpdateTitleString();
            UpdateMainCommandButtons();
        }
        /// <summary>
        /// Pause LiveMonitoring and get into Event mode for Loaded Events data
        /// </summary>
        /// <param name="path">path of event file. </param>
        private void StartEventsWithLoadedData(string path)
        {
            DisableElementSelector();

            List <EventMessage> el = ListenAction.LoadEventMessages(path);

            this.ctrlCurMode.HideControl();
            this.ctrlCurMode = this.ctrlEventMode;
            this.ctrlCurMode.ShowControl();

            this.ctrlEventMode.Clear();

            this.ctrlEventMode.LoadEventRecords(el);

            this.CurrentPage = AppPage.Events;
            this.CurrentView = EventsView.Load;

            PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString());
        }
Example #10
0
        /// <summary>
        /// Pause LiveMonitoring and get into Event mode for Loaded Events data
        /// </summary>
        /// <param name="path">path of event file. </param>
        private void StartEventsWithLoadedData(string path)
        {
            DisableElementSelector();

            List <EventMessage> el = SetupLibrary.FileHelpers.LoadDataFromJSON <List <EventMessage> >(path);

            this.ctrlCurMode.HideControl();
            this.ctrlCurMode = this.ctrlEventMode;
            this.ctrlCurMode.ShowControl();

            this.ctrlEventMode.Clear();

            this.ctrlEventMode.LoadEventRecords(el);

            this.CurrentPage = AppPage.Events;
            this.CurrentView = EventsView.Load;

            PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString());
        }
        /// <summary>
        /// Start snapshot mode.
        /// </summary>
        /// <param name="e">root element for listening events</param>
        private void StartEventsMode(A11yElement e)
        {
            if (e == null)
            {
                this.AllowFurtherAction = false;
                MessageDialog.Show(Properties.Resources.StartElementDetailViewNoElementIsSelectedMessage);
                this.AllowFurtherAction = true;
            }
            else if (e.IsSafeToRefresh() == false)
            {
                this.AllowFurtherAction = false;
                MessageDialog.Show(Properties.Resources.StartEventsModeElementNotAvailableMessage);
                this.AllowFurtherAction = true;
            }
            else
            {
                // we need to explicitly set the highlighter mode despite of the highlighter button status
                HighlightAction.GetDefaultInstance().HighlighterMode = HighlighterMode.Highlighter;

                this.ctrlEventMode.Clear();

                DisableElementSelector();

                this.ctrlCurMode.HideControl();
                this.ctrlCurMode = this.ctrlEventMode;
                this.ctrlEventMode.CurrentView = EventsView.Config;
                this.ctrlCurMode.ShowControl();

                var sa = SelectAction.GetDefaultInstance();

                // set the root element to listen to.
#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.ctrlEventMode.SetElement(sa.GetSelectedElementContextId().Value);
#pragma warning restore CS4014
                this.CurrentPage = AppPage.Events;
                this.CurrentView = EventsView.Config;
                PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString());
            }
        }
Example #12
0
        /// <summary>
        /// Start CCA Automatic Monitor mode
        /// show only single selected item information
        /// </summary>
        private void StartCCAMode()
        {
            if (!(this.CurrentPage == AppPage.CCA && (CCAView)this.CurrentView == CCAView.Automatic))
            {
                this.CurrentPage = AppPage.CCA;
                this.CurrentView = CCAView.Automatic;
                PageTracker.TrackPage(this.CurrentPage, this.CurrentView.ToString());

                // make sure that highlighter is cleared for new selection.
                HollowHighlightDriver.GetDefaultInstance().Clear();

                SetWindowForAutomaticMode();
            }

            SelectAction.GetDefaultInstance().Scope = SelectionScope.Element;

            // set the state to Capturing view. it will prevent testing for safety.
            this.CurrentView = CCAView.CapturingData;

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

            if (ecId != null)
            {
                // make sure that no more selection is requested.
                DisableElementSelector();

                // Pass the currently selected Element Context
                this.ctrlCurMode.SetElement(ecId.Value);
            }
            else
            {
                this.CurrentView = CCAView.Automatic;
            }

            // enable element selector
            EnableElementSelector();
        }