示例#1
0
        private async void OnSlnInfoDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var dependencyObject = e.OriginalSource as DependencyObject;

            if (dependencyObject == null)
            {
                return;
            }
            var currentGridCell = UiUtils.FindProperDependencyElement <DataGridCell>(dependencyObject);

            if (currentGridCell == null)
            {
                return;
            }

            var currentSolution          = currentGridCell.DataContext as SolutionInfoViewModel;
            var headerString             = currentGridCell.Column.Header.ToString();
            var startupConfigurationMode = UiUtils.SlnInfoGridHeaderToStartupConfigurationMode(headerString);

            if (currentSolution == null || startupConfigurationMode == StartupConfigurationMode.All)
            {
                return;
            }
            var currentSolutionStatus = startupConfigurationMode.GetStatusValue(currentSolution);

            if (_selectedRunFolder == string.Empty || !Directory.Exists(_selectedRunFolder))
            {
                MessageBox.Show(this, Properties.Resources.SelectRunMsg, _selfTesterAppName, MessageBoxButton.OK,
                                MessageBoxImage.Warning);
                return;
            }

            if (currentSolutionStatus != AnalysisStatus.DiffFinished)
            {
                return;
            }

            var runFolderClosure = _selectedRunFolder;

            try
            {
                this.BlurApply(UiUtils.DefaultBlurRadius, TimeSpan.FromMilliseconds(200), TimeSpan.Zero);
                var waitWindow = new WaitWindow(_selfTesterAppName, Properties.Resources.DevenvStarting)
                {
                    Owner = this
                };
                await ShowWaitingDialogAsync(waitWindow).ConfigureAwait(true);

                await
                AnalyzerUtilities.OpenAnalysisReportUntilWndValidAsync(currentSolution, startupConfigurationMode,
                                                                       runFolderClosure)
                .ConfigureAwait(true);

                waitWindow.Close();
            }
            finally
            {
                this.BlurDisable(TimeSpan.FromSeconds(1), TimeSpan.Zero);
            }
        }
示例#2
0
        private bool StopPrepare(out string warningMessage)
        {
            if (_killingTimer != null)
            {
                _killingTimer.Dispose();
                _killingTimer = null;
            }

            this.BlurApply(UiUtils.DefaultBlurRadius, TimeSpan.FromMilliseconds(200), TimeSpan.Zero);
            var killingWaitWindow = new WaitWindow(_selfTesterAppName, "Killing Visual Studio's...")
            {
                Owner = this
            };
            var       countdownThreshold  = 10;
            const int launchTimerInterval = 500;

            /* В течении countdownThreshold * launchTimerInterval миллисекунд будем
             * принудительно завершать процессы, порожденные SelfTester'ом */
            _killingTimer = AutoResetTimer.Create(() =>
            {
                if (countdownThreshold-- > 0)
                {
                    ProcessUtils.MandatoryKill(Process.GetCurrentProcess(), false);
                }
                else
                {
                    _killingTimer.Dispose();
                    RunInUiSynchronizationContext(() =>
                    {
                        killingWaitWindow.Close();
                        this.BlurDisable(TimeSpan.FromSeconds(1), TimeSpan.Zero);
                    });
                }
            }, launchTimerInterval)
                            .Shedule(() => { RunInUiSynchronizationContext(() => killingWaitWindow.ShowDialogAlt()); });

            if (_testWorker != null && _testWorker.IsBusy)
            {
                _testWorker.CancelAsync();
                SetupSolutionInfoDataGrid(TestedSolutionsManager.RefreshTestingRunModel(_selectedRunFolder));
                SetUiCompletedState();
                UiUtils.ResetActiveStatuses(_currentSelectedSolutions, true);
                warningMessage = string.Empty;
                return(true);
            }

            warningMessage = Properties.Resources.AnalisysNotRunningNow;
            return(false);
        }
示例#3
0
 private Task ShowWaitingDialogAsync(WaitWindow waitWindow)
 {
     return(Task.Run(() => { RunInUiSynchronizationContext(waitWindow.ShowDialogAlt); }));
 }