Exemplo n.º 1
0
        private void SmartFormatterExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            ITextEditorSettings settings = textCore.TextEditorSettings;

            settings.ToggleSmartFormatting(); // Toggle SmartFormatter option.
        }
Exemplo n.º 2
0
        private bool PlaybackNextXmlFile()
        {
            bool donePlayingAllXmlFiles = false;

            currentXmlFile = currentXmlFile + 1;
            if (currentXmlFile < 0 || (null == xmlTestFiles))
            {
                donePlayingAllXmlFiles = true;
            }
            if (currentXmlFile >= xmlTestFiles.Count)
            {
                donePlayingAllXmlFiles = true;
            }

            if (false != donePlayingAllXmlFiles)
            {
                if (null != playbackTimer)
                {
                    playbackTimer.Stop();
                }

                playbackTimer = null;
                SerialiseTestResults();
                textEditorCore.EnableRegularCommands = true;

                // Close out the editor for multi-playback.
                if (xmlTestFiles.Count > 1)
                {
                    System.Windows.Application.Current.Shutdown();
                }

                return(false);
            }

            string xmlFilePath = xmlTestFiles[currentXmlFile];

            if (File.Exists(xmlFilePath) == false)
            {
                return(false);
            }

            if (null == editorCommands)
            {
                editorCommands = new List <TextEditorCommand>();
            }
            editorCommands.Clear(); // Clear up any existing steps.

            string baseFilePath = FindMatchingBaseFile(xmlFilePath);

            if (string.IsNullOrEmpty(baseFilePath) == false)
            {
                Commands baseSteps = DeserializeFromXml(baseFilePath);
                editorCommands.AddRange(baseSteps.TextEditorCommands);
            }

            Commands            recordedSteps = DeserializeFromXml(xmlFilePath);
            ITextEditorSettings settings      = textEditorCore.TextEditorSettings;

            if (settings.EnableSmartFormatting != recordedSteps.EnableSmartFormatting)
            {
                settings.ToggleSmartFormatting(); // Formatting on a per-test basis.
            }
            editorCommands.AddRange(recordedSteps.TextEditorCommands);
            PlaybackVisualizer.Instance.SetCurrentFilePath(xmlFilePath);
            PlaybackVisualizer.Instance.SetEditorCommands(editorCommands);

            if (null == playbackTimer)
            {
                playbackTimer          = new DispatcherTimer();
                playbackTimer.Tick    += new EventHandler(OnPlaybackTimerTick);
                playbackTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            }

            commandIndex     = -1;
            playbackComplete = false;
            playbackTimer.Start();
            Solution.CloseSolution(Solution.Current, true);
            return(true);
        }