/// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var           options       = this.package.GetDialogPage(typeof(ExternalSearchOptionPage)) as ExternalSearchOptionPage;
            TextSelection textSelection = DteInstance?.ActiveDocument?.Selection as TextSelection;

            if (textSelection == null)
            {
                DteInstance.StatusBar.Text = "The selection is null or empty";
                return;
            }

            string textToBeSearched = textSelection?.Text?.Trim();

            if (!string.IsNullOrWhiteSpace(textToBeSearched))
            {
                string encodedText = HttpUtility.UrlEncode(textToBeSearched);
                DteInstance.StatusBar.Text = $"Searching {textToBeSearched}";
                OutputWindow.OutputString($"Searching {textToBeSearched}");
                string url = string.Format(options.Url, encodedText);
                if (options.UseVSBrowser)
                {
                    DteInstance.ItemOperations.Navigate(url, vsNavigateOptions.vsNavigateOptionsDefault);
                }
                else
                {
                    System.Diagnostics.Process.Start(url);
                }
            }
            else
            {
                DteInstance.StatusBar.Text = "The selection is null or empty";
            }
        }
 /// <summary>
 /// Adds a line of <paramref name="text"/> to RAD Projects Extension output pane
 /// </summary>
 /// <param name="text">Text to be added to the output</param>
 /// <param name="activate">If true, the pane is activated (brought to front)</param>
 public void Output(string text, bool activate = false)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     OutputWindow.OutputString(text + Environment.NewLine);
     if (activate)
     {
         OutputWindow.Activate(); // Brings output pane into view
     }
 }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            OutputWindow.Show();
            OutputWindow.OutputString($"Visual Studio Binary in {InstallationStateUtilities.IDEPath}:\r\n    {InstallationStateUtilities.IDEInfo}\r\n");
            OutputWindow.OutputString($"Is Razor Dependency Installed:\r\n    {InstallationStateUtilities.IsRazorDependencyInstalled}\r\n");
            OutputWindow.OutputString($"Installed Web Editor Assemblies in {InstallationStateUtilities.WebEditorFolder}: \r\n{InstallationStateUtilities.InstalledWebEditorAssemblies}\r\n");
            OutputWindow.OutputString($"Installed Web Editor .Net Core Razor Assemblies in {InstallationStateUtilities.WebEditorRazor4Folder}: \r\n{InstallationStateUtilities.InstalledWebEditorRazorV4Assemblies}\r\n");
            OutputWindow.OutputString($"Installed Razor Extension Assemblies in {InstallationStateUtilities.RazorExtensionFolder}: \r\n{InstallationStateUtilities.InstalledRazorExtensionAssemblies}\r\n");
        }
示例#4
0
        private void Write(string type, string message, object[] parameters)
        {
            message = $"{DateTime.Now:HH:mm:ss} {type}: {message}";

            try
            {
                if (parameters.Any())
                {
                    OutputWindow.OutputString(string.Format(message, parameters) + Environment.NewLine);
                }
                else
                {
                    OutputWindow.OutputString(message + Environment.NewLine);
                }
            }
            catch { }
        }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                OutputWindow.Show();
                OutputWindow.OutputString($"Visual Studio Binary in {InstallationStateUtilities.IDEPath}:\r\n    {InstallationStateUtilities.IDEInfo}\r\n");
                OutputWindow.OutputString($"Is Razor Dependency Installed:\r\n    {InstallationStateUtilities.IsRazorDependencyInstalled}\r\n");
                OutputWindow.OutputString($"Installed Web Editor Assemblies in {InstallationStateUtilities.WebEditorFolder}: \r\n{InstallationStateUtilities.InstalledWebEditorAssemblies}\r\n");
                OutputWindow.OutputString($"Installed Web Editor .Net Core Razor Assemblies in {InstallationStateUtilities.WebEditorRazor4Folder}: \r\n{InstallationStateUtilities.InstalledWebEditorRazorV4Assemblies}\r\n");
                OutputWindow.OutputString($"Installed Razor Extension Assemblies in {InstallationStateUtilities.RazorExtensionFolder}: \r\n{InstallationStateUtilities.InstalledRazorExtensionAssemblies}\r\n");

                PopSuccessMessage();
                OutputWindow.Show();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception occurred while attempting to output Razor diagnostics.", ex);
                PopFailureMessage(ex.Message);
            }
        }
示例#6
0
        private void Write(string type, string message, object[] parameters)
        {
            message = $"{DateTime.Now:HH:mm:ss.fff} {type}: {message}";

            ThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                try
                {
                    if (parameters.Any())
                    {
                        OutputWindow.OutputString(string.Format(CultureInfo.InvariantCulture, message, parameters) +
                                                  Environment.NewLine);
                    }
                    else
                    {
                        OutputWindow.OutputString(message + Environment.NewLine);
                    }
                }
                catch
                {
                }
            });
        }