public void Show()
        {
            if (!SettingsProvider.CompilerSettingsModel.ShowOutputWindow)
            {
                return;
            }

            var outputWindow = outputWindowBuilder.GetResult();

            UIUpdater.InvokeAsync(() =>
            {
                outputWindow.Pane.Activate();
                if (VsServiceProvider.TryGetService(typeof(DTE), out object dte))
                {
                    (dte as DTE2).ExecuteCommand("View.Output", string.Empty);
                }
                VsWindowController.Activate(VsWindowController.PreviousWindow);
            }).SafeFireAndForget();
        }
예제 #2
0
        public void OnWindowActivated(Window GotFocus, Window LostFocus)
        {
            VsWindowController.SetPreviousActiveWindow(LostFocus);

            if (ReleaseNotesView.WasShown == false)
            {
                var releaseNotesView = new ReleaseNotesView(true);
                releaseNotesView.Show();
            }

            if (showOpenFolderWarning)
            {
                var    registryUtility      = new RegistryUtility(registryName);
                string showCMakeBetaWarning = registryUtility.ReadCurrentUserKey(keyName);

                if (showCMakeBetaWarning == null && SolutionInfo.IsOpenFolderModeActive())
                {
                    showOpenFolderWarning = false;
                    CMakeBetaWarning cMakeBetaWarning = new CMakeBetaWarning();
                    cMakeBetaWarning.Show();
                }
            }

            if (SettingsProvider.CompilerSettingsModel.ShowSquiggles == false)
            {
                return;
            }

            if (running || vsBuildRunning)
            {
                return;
            }

            Document document = GotFocus.Document;

            if (document == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(oldActiveDocumentName) && oldActiveDocumentName == document.FullName)
            {
                return;
            }

            oldActiveDocumentName = document.FullName;
            if (!ScriptConstants.kAcceptedFileExtensions.Contains(Path.GetExtension(document.FullName)))
            {
                return;
            }

            _ = Task.Run(() =>
            {
                lock (mutex)
                {
                    try
                    {
                        TaskErrorViewModel.FileErrorsPair.Clear();
                        using BackgroundTidy backgroundTidyCommand = new BackgroundTidy();
                        backgroundTidyCommand.Run(document, CommandIds.kTidyId);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            });
        }