private void OnGetAppName_Click(object sender, RoutedEventArgs e) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); string appName; IVsUIShell vsUIShell = (IVsUIShell)SimpleEditorPackage.GetGlobalService(typeof(SVsUIShell)); vsUIShell.GetAppName(out appName); VsShellUtilities.ShowMessageBox(parentPane, appName, "WPF Based Editor", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); }
/// <summary> /// Sets up the different UI elements. /// </summary> private void SetupComponents() { // Get the project name. string projectFileName = Path.GetFileName(this.projectFullPath); string projectName = Path.GetFileNameWithoutExtension(this.projectFullPath); IVsUIShell shell = this.serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; if (shell == null) { throw new InvalidOperationException(); } String applicationName; // Get the name of the SKU. shell.GetAppName(out applicationName); // Set the dialog box caption (title). this.Text = String.Format(CultureInfo.CurrentCulture, this.Text, projectName); // Set the text at the top of the dialog that gives a brief description of the security // implications of loading this project. this.warningText.Text = String.Format(CultureInfo.CurrentCulture, this.warningText.Text, projectName, applicationName); // Set the text that describes the "Browse" option. this.browseText.Text = String.Format(CultureInfo.CurrentCulture, this.browseText.Text, applicationName); // Set the text that describes the "Load" option. this.loadText.Text = String.Format(CultureInfo.CurrentCulture, this.loadText.Text, applicationName); // The default selection is "Browse" so select that radio button. this.browseButton.Checked = true; // Turn on the "Ask me always" checkbox by default. this.askAgainCheckBox.Checked = true; // Set the focus to the Browse button, so hitting Enter will press the OK button this.browseButton.Focus(); this.CenterToScreen(); }