public static GetSelectedProject ( ) : Project | ||
Résultat | Project |
private void BeforeQueryStatus(object sender, EventArgs e) { var button = (OleMenuCommand)sender; _project = ProjectHelpers.GetSelectedProject(); button.Enabled = button.Visible = _project != null; }
private void BeforeQueryStatus(object sender, EventArgs e) { var dte = (DTE)ServiceProvider.GetService(typeof(DTE)); var button = (OleMenuCommand)sender; _project = ProjectHelpers.GetSelectedProject() ?? GetActiveDocumentProject(dte); button.Enabled = button.Visible = _project != null; }
private async void ShowInstallDialogAsync(object sender, EventArgs e) { var dte = (DTE)ServiceProvider.GetService(typeof(DTE)); Project project = _project ?? ProjectHelpers.GetSelectedProject() ?? GetActiveDocumentProject(dte); if (project == null) { return; } InstallDialog dialog = new InstallDialog(ServiceProvider, new Bower(), new Jspm(), new Npm(), new NuGet(), new Tsd(), new Typings(), new Yarn()); var hwnd = new IntPtr(dte.MainWindow.HWnd); System.Windows.Window window = (System.Windows.Window)HwndSource.FromHwnd(hwnd).RootVisual; dialog.Owner = window; var result = dialog.ShowDialog(); if (!dialog.DialogResult.HasValue || !dialog.DialogResult.Value) { return; } try { await PackageInstallerPackage.AnimateStatusBar(true); await PackageInstallerPackage.UpdateStatus($"Installing {dialog.Package} package from {dialog.Provider.Name}..."); Logger.Log($"Installing {dialog.Package} package from {dialog.Provider.Name}..."); await dialog.Provider.InstallPackage(project, dialog.Package, dialog.Version, dialog.Arguments); } finally { await PackageInstallerPackage.AnimateStatusBar(false); await PackageInstallerPackage.HideStatus(3000); } }
private void MenuItemCallback(object sender, EventArgs e) { Project project = _project ?? ProjectHelpers.GetSelectedProject(); if (project == null) { return; } InstallDialog dialog = new InstallDialog(ServiceProvider, new Bower(), new Npm(), new Jspm()); var result = dialog.ShowDialog(); if (!dialog.DialogResult.HasValue || !dialog.DialogResult.Value) { return; } VSPackage.UpdateStatus($"Installing {dialog.Package} package from {dialog.Provider.Name}..."); dialog.Provider.InstallPackage(project, dialog.Package, dialog.Version); }