protected override void Initialize() { base.Initialize(); AddSkipLoading(); _dte = (DTE)GetService(typeof(DTE)); _dteEvents = _dte.Events.DTEEvents; _dteEvents.OnStartupComplete += OnOnStartupComplete; var metadata = new Metadata { EditorName = "ssms", PluginName = "ssms-wakatime", EditorVersion = _dte == null ? string.Empty : _dte.Version, PluginVersion = Constants.PluginVersion }; _logger = new Logger(Dependencies.GetConfigFilePath()); _wakatime = new Shared.ExtensionUtils.WakaTime(metadata, _logger); _logger.Debug("It will load WakaTime extension"); Task.Run(() => { InitializeAsync(); }); }
public DTEHelper(DTE dte) { this.DTE = dte; Current = this; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; //System.Windows.Input.Keyboard.AddPreviewKeyDownHandler(System.Windows.Application.Current.MainWindow, new System.Windows.Input.KeyEventHandler(App_KeyDown)); System.Windows.Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; System.Windows.Forms.Application.ThreadException += Application_ThreadException; docEvents = DTE.Events.DocumentEvents; //docEvents.DocumentOpening += DocumentEvents_DocumentOpening; //docEvents.DocumentClosing += VSPackage1Package_DocumentClosing; //VS关闭命令事件 //cmdEvents = DTE.Events.CommandEvents["{5EFC7975-14BC-11CF-9B2B-00AA00573819}", 229]; //cmdEvents.BeforeExecute += cmdEvents_BeforeExecute; //solEvents = DTE.Events.SolutionEvents; //solEvents.Opened += solEvents_Opened; wndEvents = DTE.Events.WindowEvents; wndEvents.WindowActivated += wndEvents_WindowActivated; dteEvents = DTE.Events.DTEEvents; dteEvents.OnStartupComplete += dteEvents_OnStartupComplete; TextViewCreationListener.FileContentChanged += TextViewCreationListener_FileContentChanged; UploadLog(); }
protected override async Task InitializeAsync(CancellationToken token, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(token, progress); Debug.WriteLine("InitializeAsync"); await JoinableTaskFactory.SwitchToMainThreadAsync(); page = GetDialogPage(typeof(SettingsPage)) as SettingsPage; page.NameChanged += NameChanged; monitor = new TabMonitor(page.GetNames()); uiShell7 = await GetServiceAsync(typeof(SVsUIShell)) as IVsUIShell7; Assumes.Present(uiShell7); wfeCookie = uiShell7.AdviseWindowFrameEvents(monitor); var dte = await GetServiceAsync(typeof(DTE)) as DTE2; Assumes.Present(dte); dteEvents = dte.Events.DTEEvents; dteEvents.ModeChanged += DteEvents_ModeChanged; Debug.WriteLine("InitializeAsync !"); }
public static async Task InitializeAsync(AsyncPackage package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); _shell = await package.GetServiceAsync <SVsShell, IVsShell4>(); _dte = await package.GetServiceAsync <DTE, DTE2>(); _events = _dte.Events.DTEEvents; _events.OnBeginShutdown += OnBeginShutdown; IMenuCommandService commandService = await package.GetServiceAsync <IMenuCommandService, IMenuCommandService>(); Assumes.Present(commandService); var cmdNormalId = new CommandID(PackageGuids.guidCommands, PackageIds.RestartNormal); var cmdNormal = new OleMenuCommand((s, e) => Execute(RestartType.Normal), cmdNormalId); commandService.AddCommand(cmdNormal); var cmdElevatedId = new CommandID(PackageGuids.guidCommands, PackageIds.RestartElevated); var cmdElevated = new OleMenuCommand((s, e) => Execute(RestartType.Elevated), cmdElevatedId); commandService.AddCommand(cmdElevated); var cmdSafemodeId = new CommandID(PackageGuids.guidCommands, PackageIds.RestartSafemode); var cmdSafemode = new OleMenuCommand((s, e) => Execute(RestartType.Safemode), cmdSafemodeId); commandService.AddCommand(cmdSafemode); }
public VsIconizerService(DTE dte, Func <DependencyObject, bool> isAutohideControl, Func <DependencyObject, bool> isDragUnlockHeader) { _isAutohideControl = isAutohideControl; _isDragUnlockHeader = isDragUnlockHeader; var ass = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x?.FullName.StartsWith("Microsoft.VisualStudio.Shell.ViewManager") == true); var type = ass.GetType("Microsoft.VisualStudio.PlatformUI.Shell.Controls.AutoHideChannelControl"); _getOrientation = type.GetMethod("GetOrientation", BindingFlags.Static | BindingFlags.Public); _dte = dte; _events = _dte.Events.DTEEvents; _events.OnStartupComplete += () => { _threadId = GetCurrentThreadId(); _dispatcher = Dispatcher.CurrentDispatcher; _timer = new Timer(TimerCallback, null, 2000, 2000); }; _events.OnBeginShutdown += () => { _timer.Dispose(); _timer = null; }; }
private void OnBeginShutDown() { _dteEvents.OnBeginShutdown -= OnBeginShutDown; _dteEvents = null; OptimizedZipPackage.PurgeCache(); }
/// <summary> /// Initializes the telemetry client. /// </summary> /// <param name="provider">The service provider instance.</param> /// <param name="version">The version of the Visual Studio extension.</param> /// <param name="telemetryKey">The Applicatoin Insights instrumentation key (usually a GUID).</param> public static void Initialize(IServiceProvider provider, string version, string telemetryKey) { if (_telemetry == null) { var dte = (DTE2)provider.GetService(typeof(DTE)); _telemetry = new TelemetryClient(); _telemetry.Context.Session.Id = Guid.NewGuid().ToString(); _telemetry.Context.Device.Model = dte.Edition; _telemetry.InstrumentationKey = telemetryKey; _telemetry.Context.Component.Version = version; byte[] enc = Encoding.UTF8.GetBytes(Environment.UserName + Environment.MachineName); using (var crypto = new MD5CryptoServiceProvider()) { byte[] hash = crypto.ComputeHash(enc); _telemetry.Context.User.Id = Convert.ToBase64String(hash); } _events = dte.Events.DTEEvents; _events.OnBeginShutdown += _telemetry.Flush; } Enabled = true; }
protected override void Initialize() { base.Initialize(); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CoAppApplication.ResolveAssembly); _vsMonitorSelection = (IVsMonitorSelection)GetService(typeof(IVsMonitorSelection)); Module.DTE = (DTE)GetService(typeof(DTE)); // get the solution exists/not building/not debugging cookie var solutionExistsAndNotBuildingAndNotDebuggingContextGuid = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid; _vsMonitorSelection.GetCmdUIContextCookie(ref solutionExistsAndNotBuildingAndNotDebuggingContextGuid, out _solutionExistsAndNotBuildingAndNotDebuggingContextCookie); // get the solution exists and fully loaded cookie var solutionExistsAndFullyLoadedContextGuid = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid; _vsMonitorSelection.GetCmdUIContextCookie(ref solutionExistsAndFullyLoadedContextGuid, out _solutionExistsAndFullyLoadedContextCookie); // Add our command handlers for menu (commands must exist in the .vsct file) AddMenuCommandHandlers(); Module.Initialize(); Module.OnStartup(null, null); DTEEvents = Module.DTE.Events.DTEEvents; DTEEvents.OnBeginShutdown += () => Module.OnExit(null, null); var timer = new DispatcherTimer(); timer.Tick += (o, a) => TrackSolution(); timer.Interval += new TimeSpan(0, 0, 0, 1); timer.Start(); }
public BuildEvents(IServiceProvider serviceProvider) { if (serviceProvider == null) { return; } _dte2 = serviceProvider.GetService(typeof(DTE)) as DTE2; if (_dte2 != null) { // These event sources have to be rooted or the GC will collect them. // http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/fd2f9108-1df3-4d96-a65d-67a69347ca27 _events = _dte2.Events; _buildEvents = _events.BuildEvents; _dteEvents = _events.DTEEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _buildEvents.OnBuildDone += OnBuildDone; _buildEvents.OnBuildProjConfigDone += OnBuildProjectDone; _dteEvents.ModeChanged += OnModeChanged; } _projectsBuildReport = new List <string>(); Settings.SettingsUpdated += (sender, args) => LoadSettings(); LoadSettings(); }
void VsShellPropertyEvents_AfterShellPropertyChanged(object sender, VsShellPropertyEventsHandler.ShellPropertyChangeEventArgs e) { SafeExecute(() => { // when zombie state changes to false, finish package initialization //! DO NOT USE CODE WHICH MAY EXECUTE FOR LONG TIME HERE if ((int)__VSSPROPID.VSSPROPID_Zombie == e.PropId) { if ((bool)e.Var == false) { var dte2 = ServiceProvider.GetDte2(); Events = dte2.Events as Events2; DTEEvents = Events.DTEEvents; SolutionEvents = Events.SolutionEvents; DocumentEvents = Events.DocumentEvents; WindowEvents = Events.WindowEvents; DebuggerEvents = Events.DebuggerEvents; CommandEvents = Events.CommandEvents; SelectionEvents = Events.SelectionEvents; DelayedInitialise(); } } }); }
///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidPasteToTargetCmdSet, (int)PkgCmdIDList.cmdidPasteToTarget); MenuCommand menuItem = new MenuCommand(OnPasteToTargetClicked, menuCommandID); mcs.AddCommand(menuItem); } DTE2 dte = GetService(typeof(SDTE)) as DTE2; if (dte != null) { m_packageEvents = dte.Events.DTEEvents; m_packageEvents.OnBeginShutdown += DTEEvents_OnBeginShutdown; } m_activity = new PasteToTargetActivity(); }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='application'>Root object of the host application.</param> /// <param term='connectMode'>Describes how the Add-in is being loaded.</param> /// <param term='addInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(DTE2 application, ext_ConnectMode connectMode, AddIn addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; ViewBase.ResetToolWindowList(); OutputWindow.Initialize(_applicationObject); try { CreateMenu(); try { Events events = _applicationObject.Events; _windowsEvents = events.get_WindowEvents(null); _windowsEvents.WindowActivated += OnWindowActivated; _eve = _applicationObject.Events.DTEEvents; } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } }
private void Init() { ThreadHelper.ThrowIfNotOnUIThread(); dte = Package.GetGlobalService(typeof(DTE)) as DTE2; if (dte != null) { events = dte.Events as Events2; if (events != null) { dteEvents = events.DTEEvents; solutionEvents = events.SolutionEvents; dteEvents.OnBeginShutdown += ShutDown; solutionEvents.Opened += () => SwitchStartupDir("\n====== Solution opening Detected ======\n"); } } terminalController.SetShell(OptionMgr.Shell); bool createSuccess = terminalController.Init(GetProjectPath()); if (!createSuccess) { VsShellUtilities.ShowMessageBox( ServiceProvider.GlobalProvider, "Can not create console process, check your configuration and reopen this window", "Can not create process", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); } terminalController.InvokeCmd("\n[Global Init Script ...]\n", OptionMgr.GetGlobalScript()); }
public void OnConnect(DTE2 applicationObject) { ApplicationObject = applicationObject; DocumentManager.BeforeKeyPress = OnBeforeKeyPress; DocumentManager.AfterKeyPress = OnAfterKeyPress; DocumentManager.Setup(applicationObject); var events = (Events2)applicationObject.Events; solutionEvents = events.SolutionEvents; projectItemEvents = events.ProjectItemsEvents; textEditorEvents = events.get_TextEditorEvents(null); documentEvents = events.DocumentEvents; dteEvents = events.DTEEvents; dteEvents.OnBeginShutdown += OnBeginShutdown; solutionEvents.Opened += OnSolutionOpened; solutionEvents.BeforeClosing += OnSolutionClosing; projectItemEvents.ItemAdded += OnSolutionItemAdded; projectItemEvents.ItemRenamed += OnSolutionItemRenamed; projectItemEvents.ItemRemoved += OnSolutionItemRemoved; textEditorEvents.LineChanged += OnTextEditorLineChanged; documentEvents.DocumentSaved += DocumentEvents_DocumentSaved; Command cmd = ApplicationObject.Commands.Item("Edit.CompleteWord", -1); commandEvents = ApplicationObject.Events.get_CommandEvents(cmd.Guid, cmd.ID); commandEvents.BeforeExecute += OnBeforeCompleteWordRequested; }
private void OnStartupComplete() { try { Log.Write("OnStartupComplete"); _dteEvents.OnStartupComplete -= OnStartupComplete; _dteEvents = null; PackageConfigurator.RemoveBridgeBuildTargetFromMicrosoftCommon(MicrosoftCommonTargetDocument, Locations.MicrosoftCommonTargetFileNamePath); Log.Write("BridgeBuild.targets Removed for x86 Operating System"); if (Environment.Is64BitOperatingSystem) { PackageConfigurator.RemoveBridgeBuildTargetFromMicrosoftCommon(MicrosoftCommonTargetX64Document, Locations.MicrosoftCommonTargetX64FileNamePath); Log.Write("BridgeBuild.targets Removed for x64 Operating System"); } if (PackageConfigurator.IsFramework45Installed) { PackageConfigurator.RemoveBridgeBuildTargetFromMicrosoftCommon(MicrosoftCommonTarget45Document, Locations.MicrosoftCommonTarget45FileNamePath); Log.Write("BridgeBuild.targets Removed for framework 4.5"); } PackageConfigurator.IsLinqBridgeEnabled = true; Log.Write("OnStartupComplete End"); } catch (Exception e) { Log.Write(e, "OnStartupComplete Error..."); } }
/// <summary> /// Initializes the telemetry client. /// </summary> public static void Initialize(DTE2 dte, string version, string telemetryKey) { if (_telemetry != null) { throw new NotSupportedException("The telemetry client is already initialized"); } _telemetry = new TelemetryClient(); _telemetry.Context.Session.Id = Guid.NewGuid().ToString(); _telemetry.Context.Device.Model = dte.Edition; _telemetry.InstrumentationKey = telemetryKey; _telemetry.Context.Component.Version = version; byte[] enc = Encoding.UTF8.GetBytes(Environment.UserName + Environment.MachineName); using (var crypto = new MD5CryptoServiceProvider()) { byte[] hash = crypto.ComputeHash(enc); _telemetry.Context.User.Id = Convert.ToBase64String(hash); } _events = dte.Events.DTEEvents; _events.OnBeginShutdown += _telemetry.Flush; Enabled = true; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); m_packageDTEEvents = ApplicationObject.Events.DTEEvents; m_packageDTEEvents.OnBeginShutdown += SpotifyRemoteDTEEventBeginShutdown; m_packageDTEEvents.OnStartupComplete += SpotifyRemoteDTEEventOnStartupComplete; SettingsManager sm = SettingsManager.GetSettingsManager(); CommandOpenSpotify.Initialize(this); CommandNextTrack.Initialize(this); CommandPlayPause.Initialize(this); CommandPreviousTrack.Initialize(this); SpotifyRemoteNS.SpotifyRemoteSettingsCommand.Initialize(this); SpotifyRemoteNS.CommandOpenSettings.Initialize(this); sm.ReadSettingsFromFile(); sm.ApplyCurrentSettings(); m_spotifyManager.Initialize(); }
/// <summary> /// Initializes the telemetry client. /// </summary> public static void Initialize(IServiceProvider serviceProvider, string version, string telemetryKey) { if (_telemetry != null) throw new NotSupportedException("The telemetry client is already initialized"); var dte = (DTE2)serviceProvider.GetService(typeof(DTE)); _telemetry = new TelemetryClient(); _telemetry.Context.Session.Id = Guid.NewGuid().ToString(); _telemetry.Context.Device.Model = dte.Edition; _telemetry.InstrumentationKey = telemetryKey; _telemetry.Context.Component.Version = version; byte[] enc = Encoding.UTF8.GetBytes(Environment.UserName + Environment.MachineName); using (var crypto = new MD5CryptoServiceProvider()) { byte[] hash = crypto.ComputeHash(enc); _telemetry.Context.User.Id = Convert.ToBase64String(hash); } _events = dte.Events.DTEEvents; _events.OnBeginShutdown += delegate { _telemetry.Flush(); }; Enabled = true; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { var componentModel = await GetServiceAsync(typeof(SComponentModel)) as IComponentModel; componentModel.DefaultCompositionService.SatisfyImportsOnce(this); SolutionManager.AfterNuGetProjectRenamed += SolutionManager_NuGetProjectRenamed; Brushes.LoadVsBrushes(); // Add our command handlers for menu (commands must exist in the .vsct file) await AddMenuCommandHandlersAsync(); _dte = (DTE) await GetServiceAsync(typeof(SDTE)); _dteEvents = _dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutDown; if (SolutionManager.NuGetProjectContext == null) { SolutionManager.NuGetProjectContext = ProjectContext; } // when NuGet loads, if the current solution has some package // folders marked for deletion (because a previous uninstalltion didn't succeed), // delete them now. if (SolutionManager.IsSolutionOpen) { DeleteOnRestartManager.Value.DeleteMarkedPackageDirectories(ProjectContext); } ProjectRetargetingHandler = new ProjectRetargetingHandler(_dte, SolutionManager, this, componentModel); ProjectUpgradeHandler = new ProjectUpgradeHandler(this, SolutionManager); SolutionUserOptions.LoadSettings(); // This instantiates a decoupled ICommand instance responsible to locate and display output pane by a UI control UI.Commands.ShowErrorsCommand = new ShowErrorsCommand(this); _vsMonitorSelection = new AsyncLazy <IVsMonitorSelection>( async() => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // get the UI context cookie for the debugging mode var vsMonitorSelection = await GetServiceAsync(typeof(IVsMonitorSelection)) as IVsMonitorSelection; // get the solution not building and not debugging cookie var guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid; vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionExistsAndFullyLoadedContextCookie); guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid; vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionNotBuildingAndNotDebuggingContextCookie); return(vsMonitorSelection); }, ThreadHelper.JoinableTaskFactory); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void OnInitialize() { // --- We are going to use this singleton instance Default = this; RegisterEditorFactory(new RomEditorFactory()); RegisterEditorFactory(new TzxEditorFactory()); RegisterEditorFactory(new TapEditorFactory()); RegisterEditorFactory(new DisAnnEditorFactory()); RegisterEditorFactory(new SpConfEditorFactory()); // --- Prepare for package shutdown _packageDteEvents = ApplicationObject.Events.DTEEvents; _packageDteEvents.OnBeginShutdown += () => { PackageClosing?.Invoke(this, EventArgs.Empty); }; _solutionEvents = ApplicationObject.Events.SolutionEvents; _solutionEvents.Opened += OnSolutionOpened; _solutionEvents.AfterClosing += OnSolutionClosed; // --- Create other helper objects DebugInfoProvider = new VsIntegratedSpectrumDebugInfoProvider(); CodeManager = new Z80CodeManager(); ErrorList = new ErrorListWindow(); TaskList = new TaskListWindow(); }
public void Initialize(IServiceProvider serviceProvider) { if (Interlocked.CompareExchange(ref _initialized, 1, 0) == 1) { return; } #pragma warning disable VSSDK006 // Check services exist _dte2 = serviceProvider.GetService(typeof(DTE)) as DTE2; #pragma warning restore VSSDK006 // Check services exist if (_dte2 != null) { // These event sources have to be rooted or the GC will collect them. // http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/fd2f9108-1df3-4d96-a65d-67a69347ca27 _events = _dte2.Events; _buildEvents = _events.BuildEvents; _dteEvents = _events.DTEEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _buildEvents.OnBuildDone += OnBuildDone; _buildEvents.OnBuildProjConfigDone += OnBuildProjectDone; _dteEvents.ModeChanged += OnModeChanged; } _projectsBuildReport = new List <string>(); Settings.SettingsUpdated += (sender, args) => LoadSettings(); LoadSettings(); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void OnInitialize() { RegisterEditorFactory(new RomEditorFactory()); RegisterEditorFactory(new TzxEditorFactory()); RegisterEditorFactory(new TapEditorFactory()); // --- Let's create the ZX Spectrum virtual machine view model // --- that is used all around in tool windows CodeDiscoverySolution = new SolutionStructure(); // --- Prepare for package shutdown _packageDteEvents = ApplicationObject.Events.DTEEvents; _packageDteEvents.OnBeginShutdown += () => { Messenger.Default.Send(new PackageShutdownMessage()); }; _solutionEvents = ApplicationObject.Events.SolutionEvents; _solutionEvents.Opened += OnSolutionOpened; _solutionEvents.AfterClosing += OnSolutionClosed; // --- Create other helper objects CodeManager = new Z80CodeManager(); ErrorList = new ErrorListWindow(); TaskList = new TaskListWindow(); }
public async Task StopPulseTrackingAsync() { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); this.StopTimer(); if (await GetServiceAsync(typeof(DTE)) is DTE dte) { Events events = dte.Events; WindowEvents windowEvents = events.WindowEvents; windowEvents.WindowActivated -= this.OnActiveDocumentChanged; this.dteEvents = events.DTEEvents; this.dteEvents.OnBeginShutdown -= this.OnBeginShutdown; this.textEditorEvents = events.TextEditorEvents; this.textEditorEvents.LineChanged -= this.OnLineChanged; this.buildEvents = events.BuildEvents; this.buildEvents.OnBuildDone -= this.OnBuildDone; this.documentEvents = events.DocumentEvents; this.documentEvents.DocumentSaved -= this.OnDocumentSaved; } }
private void OnBeginShutDown() { _dteEvents.OnBeginShutdown -= OnBeginShutDown; _dteEvents = null; // Clean up optimized zips used by NuGet.Core as part of the V2 Protocol OptimizedZipPackage.PurgeCache(); }
public LUFAPackage() { _DTE = Package.GetGlobalService(typeof(DTE)) as DTE; _DTEEvents = _DTE.Events.DTEEvents; _DTEEvents.OnStartupComplete += new _dispDTEEvents_OnStartupCompleteEventHandler(DTEEvents_OnStartupComplete); Logging.Log(Logging.Severity.Information, "LUFA package created"); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) AddMenuCommandHandlers(); // IMPORTANT: Do NOT do anything that can lead to a call to ServiceLocator.GetGlobalService(). // Doing so is illegal and may cause VS to hang. _dte = (DTE)GetService(typeof(SDTE)); Debug.Assert(_dte != null); _dteEvents = _dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutDown; // set default credential provider for the HttpClient var webProxy = (IVsWebProxy)GetService(typeof(SVsWebProxy)); Debug.Assert(webProxy != null); var settings = Settings.LoadDefaultSettings( _solutionManager == null ? null : _solutionManager.SolutionFileSystem, configFileName: null, machineWideSettings: MachineWideSettings); var packageSourceProvider = new PackageSourceProvider(settings); HttpClient.DefaultCredentialProvider = new SettingsCredentialProvider(new VSRequestCredentialProvider(webProxy), packageSourceProvider); // when NuGet loads, if the current solution has package // restore mode enabled, we make sure every thing is set up correctly. // For example, projects which were added outside of VS need to have // the <Import> element added. if (PackageRestoreManager.IsCurrentSolutionEnabledForRestore) { if (VsVersionHelper.IsVisualStudio2013) { // Run on a background thread in VS2013 to avoid CPS hangs. The modal loading dialog will block // until this completes. ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => PackageRestoreManager.EnableCurrentSolutionForRestore(fromActivation: false))); } else { PackageRestoreManager.EnableCurrentSolutionForRestore(fromActivation: false); } } // when NuGet loads, if the current solution has some package // folders marked for deletion (because a previous uninstalltion didn't succeed), // delete them now. if (SolutionManager.IsSolutionOpen) { DeleteOnRestart.DeleteMarkedPackageDirectories(); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await RegisterVsServicesAsync(); TaskErrorViewModel.Errors.Clear(); SquiggleViewModel.Squiggles.Clear(); mCommandController = new CommandController(this); CommandTestUtility.CommandController = mCommandController; var vsOutputWindow = VsServiceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; mOutputWindowController = new OutputWindowController(); mOutputWindowController.Initialize(this, vsOutputWindow); mRunningDocTableEvents = new RunningDocTableEvents(this); mErrorWindowController = new ErrorWindowController(this); #region Get Pointer to IVsSolutionEvents if (VsServiceProvider.TryGetService(typeof(SVsSolution), out object vsSolutionService)) { var vsSolution = vsSolutionService as IVsSolution; UnadviseSolutionEvents(vsSolution); AdviseSolutionEvents(vsSolution); } #endregion // Get the build and command events from DTE if (VsServiceProvider.TryGetService(typeof(DTE), out object dte)) { var dte2 = dte as DTE2; mBuildEvents = dte2.Events.BuildEvents; mCommandEvents = dte2.Events.CommandEvents; mDteEvents = dte2.Events.DTEEvents; } mSettingsHandler = new SettingsHandler(); mSettingsHandler.InitializeSettings(); await mCommandController.InitializeCommandsAsync(this); mSettingsProvider = new SettingsProvider(); RegisterToEvents(); LicenseController mLicenseController = new LicenseController(); await mLicenseController.CheckLicenseAsync(); await base.InitializeAsync(cancellationToken, progress); }
private void OnBeginShutDown() { _projectRetargetHandler.Dispose(); _projectUpgradeHandler.Dispose(); _packageRestorer.Dispose(); _packageRestorer = null; _dteEvents.OnBeginShutdown -= OnBeginShutDown; _dteEvents = null; }
/// <summary> /// The device name is what identifies what kind of device is calling /// </summary> public static void Initialize(DTE2 dte) { _telemetry.Context.Device.Model = dte.Edition; if (_events == null) { _events = dte.Events.DTEEvents; _events.OnBeginShutdown += delegate { _telemetry.Flush(); }; } }
private void SetUpLifeCycleEvents() { var dte = ServiceLocator.Resolve <DTE2>(); _dteEvents = dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += DteEventsOnOnBeginShutdown; _dteEvents.OnStartupComplete += StartupCompleted; _windowEvents = dte.Events.WindowEvents; _windowEvents.WindowActivated += SandoWindowActivated; }
public SolutionListener(SVsServiceProvider sp, ILogger logger, SettingsPersister persister, SettingsLocator locator) { this.logger = logger; this.locator = locator; this.persister = persister; dte = (DTE)sp.GetService(typeof(DTE)); dteEvents = dte.Events.DTEEvents; solutionEvents = dte.Events.SolutionEvents; projectEvents = ((Events2)dte.Events).ProjectItemsEvents; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await RegisterVsServicesAsync(); mCommandController = new CommandController(this); CommandTestUtility.CommandController = mCommandController; var vsOutputWindow = VsServiceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; mOutputWindowController = new OutputWindowController(); mOutputWindowController.Initialize(this, vsOutputWindow); mRunningDocTableEvents = new RunningDocTableEvents(this); mErrorWindowController = new ErrorWindowController(this); #region Get Pointer to IVsSolutionEvents if (VsServiceProvider.TryGetService(typeof(SVsSolution), out object vsSolutionService)) { var vsSolution = vsSolutionService as IVsSolution; UnadviseSolutionEvents(vsSolution); AdviseSolutionEvents(vsSolution); } #endregion // Get-Set the build and command events from DTE if (VsServiceProvider.TryGetService(typeof(DTE), out object dte)) { var dte2 = dte as DTE2; mBuildEvents = dte2.Events.BuildEvents; mCommandEvents = dte2.Events.CommandEvents; mDteEvents = dte2.Events.DTEEvents; windowEvents = dte2.Events.WindowEvents; } var settingsHandler = new SettingsHandler(); settingsHandler.InitializeSettings(); await settingsHandler.InitializeAccountSettingsAsync(); string version = SettingsProvider.GeneralSettingsModel.Version; ShowToolbar(version); UpdateVersion(version); //.SafeFireAndForget(); await mCommandController.InitializeCommandsAsync(this); RegisterToEvents(); await base.InitializeAsync(cancellationToken, progress); }
private AvaloniaBuildEvents() { if (Equals(Registry.GetValue(@"HKEY_CURRENT_USER\Software\AvaloniaUI\Designer", "AllocConsole", 0), 1)) CreateConsole(); var dte = (DTE) Package.GetGlobalService(typeof (DTE)); _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildBegin += PdbeBuildBegin; _buildEvents.OnBuildDone += NotifyBuildEnd; _dteEvents = dte.Events.DTEEvents; _dteEvents.ModeChanged += NotifyModeChanged; }
internal Telemetry(IVimApplicationSettings applicationSettings, _DTE dte) { _vimApplicationSettings = applicationSettings; var key = TryReadInstrumentationKey(); if (key != null) { _client = CreateClient(dte, key); _dteEvents = dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutdown; } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); var dte = (DTE)GetService(typeof(SDTE)); _dteEvents = dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutDown; _packageRestorer = new PackageRestorer(dte, this); _projectRetargetHandler = new ProjectRetargetingHandler(dte, this); _projectUpgradeHandler = new ProjectUpgradeHandler(this); }
public ShellEventsListener(DTE2 dte) { appObject = dte; dteEvents = dte.Events.DTEEvents; debugEvents = dte.Events.DebuggerEvents; currentMode = ShellHelper.GetMode(appObject); dteEvents.ModeChanged += InternalModeChanged; debugEvents.OnEnterBreakMode += OnEnterBreakMode; debugEvents.OnEnterDesignMode += OnEnterDesignMode; debugEvents.OnEnterRunMode += OnEnterRunMode; }
public RecentPackagesRepository( DTE dte, IPackageRepositoryFactory repositoryFactory, IPackageSourceProvider packageSourceProvider, IPersistencePackageSettingsManager settingsManager) { _repositoryFactory = repositoryFactory; _settingsManager = settingsManager; _aggregatePackageSource = packageSourceProvider.ActivePackageSource; if (dte != null) { _dteEvents = dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutdown; } }
public DTEEventSource( Events2 events) { _buildEvents = events.BuildEvents; _dteEvents = events.DTEEvents; _debuggerEvents = events.DebuggerEvents; _debuggerProcessEvents = events.DebuggerProcessEvents; _debuggerExpressionEvaluationEvents = events.DebuggerExpressionEvaluationEvents; _findEvents = events.FindEvents; _miscFileEvents = events.MiscFilesEvents; _projectItemsEvents = events.ProjectItemsEvents; _projectEvents = events.ProjectsEvents; _publishEvents = events.PublishEvents; _selectionEvents = events.SelectionEvents; _solutionEvents = events.SolutionEvents; _solutionItemEvents = events.SolutionItemsEvents; }
protected override void Initialize() { lock (_s_applicationLock) { Application = (DTE2)GetService(typeof(SDTE)); _events = Application.Application.Events; _dteEvents = _events.DTEEvents; _documentEvents = _events.DocumentEvents; var win = Application.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); _outputWindow = win.Object as OutputWindow; if (_outputWindow != null) { _karmaOutputWindowPane = _outputWindow.OutputWindowPanes.Add("Karma"); } _dteEvents.OnBeginShutdown += ShutdownKarma; _events.SolutionEvents.Opened += SolutionEventsOpened; } base.Initialize(); // Add our command handlers for menu (commands must exist in .vsct file) var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null == mcs) return; // Create the command for the menu item. var menuCommandId1 = new CommandID( GuidList.guidToggleKarmaVsUnitCmdSet, (int)PkgCmdIDList.cmdidToggleKarmaVsUnit ); var menuItem1 = new MenuCommand(KarmaVsUnit, menuCommandId1); mcs.AddCommand(menuItem1); // Create the command for the menu item. var menuCommandId2 = new CommandID( GuidList.guidToggleKarmaVsE2eCmdSet, (int)PkgCmdIDList.cmdidToggleKarmaVsE2e ); var menuItem2 = new MenuCommand(KarmaVsE2e, menuCommandId2); mcs.AddCommand(menuItem2); }
/// <summary> /// Initializes the telemetry client. /// </summary> public static void Initialize(DTE2 dte, string version, string telemetryKey) { if (_telemetry != null) throw new NotSupportedException("The telemetry client is already initialized"); _telemetry = new TelemetryClient(); _telemetry.Context.Session.Id = Guid.NewGuid().ToString(); _telemetry.Context.User.Id = (Environment.UserName + Environment.MachineName).GetHashCode().ToString(); _telemetry.Context.Device.Model = dte.Edition; _telemetry.InstrumentationKey = telemetryKey; _telemetry.Context.Component.Version = version; _events = dte.Events.DTEEvents; _events.OnBeginShutdown += delegate { _telemetry.Flush(); }; Enabled = true; }
internal RecentPackageRepository( DTE dte, IPackageRepositoryFactory repositoryFactory, IPackageSourceProvider packageSourceProvider, IPersistencePackageSettingsManager settingsManager, IPackageRepository cacheRepository) { _packageSourceProvider = packageSourceProvider; _repositoryFactory = repositoryFactory; _settingsManager = settingsManager; _cacheRepository = cacheRepository; if (dte != null) { _dteEvents = dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutdown; } }
public BuildEvents(IServiceProvider serviceProvider) { if (serviceProvider == null) return; _dte2 = serviceProvider.GetService(typeof(DTE)) as DTE2; if (_dte2 != null) { // These event sources have to be rooted or the GC will collect them. // http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/fd2f9108-1df3-4d96-a65d-67a69347ca27 _events = _dte2.Events; _buildEvents = _events.BuildEvents; _dteEvents = _events.DTEEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _buildEvents.OnBuildDone += OnBuildDone; _buildEvents.OnBuildProjConfigDone += OnBuildProjectDone; _dteEvents.ModeChanged += OnModeChanged; } _projectsBuildReport = new List<string>(); }
public void Initialize(IServiceProvider serviceProvider) { if (Interlocked.CompareExchange(ref _initialized, 1, 0) == 1) return; _dte2 = serviceProvider.GetService(typeof(DTE)) as DTE2; if (_dte2 != null) { // These event sources have to be rooted or the GC will collect them. // http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/fd2f9108-1df3-4d96-a65d-67a69347ca27 _events = _dte2.Events; _buildEvents = _events.BuildEvents; _dteEvents = _events.DTEEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _buildEvents.OnBuildDone += OnBuildDone; _buildEvents.OnBuildProjConfigDone += OnBuildProjectDone; _dteEvents.ModeChanged += OnModeChanged; } _projectsBuildReport = new List<string>(); Settings.SettingsUpdated += (sender, args) => LoadSettings(); LoadSettings(); }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='application'>Root object of the host application.</param> /// <param term='connectMode'>Describes how the Add-in is being loaded.</param> /// <param term='addInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; ViewBase.ResetToolWindowList(); OutputWindow.Initialize(_applicationObject); try { if (connectMode == ext_ConnectMode.ext_cm_AfterStartup || connectMode == ext_ConnectMode.ext_cm_Startup) { CreateMenu(); try { CommandBars toolBarCommandBars = ((CommandBars)_applicationObject.CommandBars); string toolbarName = Helper.GetResourceString(OMControlLibrary.Common.Constants.PRODUCT_CAPTION); try { omToolbar = toolBarCommandBars.Add(toolbarName, MsoBarPosition.msoBarTop, Type.Missing, false); } catch (ArgumentException) { omToolbar = toolBarCommandBars[toolbarName]; } CreateToolBar(); omToolbar.Visible = true; } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } try { Events events = _applicationObject.Events; _windowsEvents = events.get_WindowEvents(null); _windowsEvents.WindowActivated += OnWindowActivated; _eve = _applicationObject.Events.DTEEvents; _eve.ModeChanged += DesignDebugModeChanged; } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } try { //This function checks whether user already logged in. ViewBase.ApplicationObject = _applicationObject; //enable disable connect button while checking cfredentials connectDatabaseMenu.Enabled = false; connectDatabaseButton.Enabled = false; Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.Default; connectDatabaseMenu.Enabled = true; connectDatabaseButton.Enabled = true; } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } } } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } }
/// <summary> /// Register Visual Studio DTE events. /// </summary> private void SetUpDTEEvents() { SrcMLFileLogger.DefaultLogger.Info("> Register Visual Studio DTE events."); DTE2 dte = GetService(typeof(DTE)) as DTE2; if(dte != null) { DteEvents = dte.Events.DTEEvents; // Register the Visual Studio DTE event that occurs when the environment has completed initializing. DteEvents.OnStartupComplete += DTEStartupCompleted; // Register the Visual Studio DTE event that occurs when the development environment is closing. DteEvents.OnBeginShutdown += DTEBeginShutdown; } else { SrcMLFileLogger.DefaultLogger.Info("> Could not get the DTE object"); } }
protected override void Initialize() { base.Initialize(); ObjDte = (DTE2)GetService(typeof(DTE)); _dteEvents = ObjDte.Events.DTEEvents; _dteEvents.OnStartupComplete += OnOnStartupComplete; Task.Run(() => { InitializeAsync(); }); }
public PerformanceVisualizationPlugin(Connect con, DTE2 appObject, AddIn addinInstance) : base(con, appObject, addinInstance) { this.events = this.ApplicationObject.Events.DTEEvents; this.events.ModeChanged += new _dispDTEEvents_ModeChangedEventHandler(DTEEvents_ModeChanged); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) AddMenuCommandHandlers(); // IMPORTANT: Do NOT do anything that can lead to a call to ServiceLocator.GetGlobalService(). // Doing so is illegal and may cause VS to hang. _dte = (DTE)GetService(typeof(SDTE)); Debug.Assert(_dte != null); _dteEvents = _dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += OnBeginShutDown; // set default credential provider for the HttpClient var webProxy = (IVsWebProxy)GetService(typeof(SVsWebProxy)); Debug.Assert(webProxy != null); var settings = Settings.LoadDefaultSettings( _solutionManager == null ? null : _solutionManager.SolutionFileSystem, configFileName: null, machineWideSettings: MachineWideSettings); var packageSourceProvider = new PackageSourceProvider(settings); HttpClient.DefaultCredentialProvider = new SettingsCredentialProvider(new VSRequestCredentialProvider(webProxy), packageSourceProvider); // when NuGet loads, if the current solution has package // restore mode enabled, we make sure every thing is set up correctly. // For example, projects which were added outside of VS need to have // the <Import> element added. if (PackageRestoreManager.IsCurrentSolutionEnabledForRestore) { PackageRestoreManager.EnableCurrentSolutionForRestore(fromActivation: false); } // when NuGet loads, if the current solution has some package // folders marked for deletion (because a previous uninstalltion didn't succeed), // delete them now. if (SolutionManager.IsSolutionOpen) { DeleteOnRestart.DeleteMarkedPackageDirectories(); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidvs10CmdSet, (int)PkgCmdIDList.cmdidjsCompiler); MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID); mcs.AddCommand(menuItem); // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidvs10CmdSet, (int)PkgCmdIDList.cmdidjsCompilerTool); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand(menuToolWin); } EnvDTE80.DTE2 dte = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2; _DTEEvents = dte.Events.DTEEvents; _DTEEvents.OnStartupComplete += new _dispDTEEvents_OnStartupCompleteEventHandler(DTEEvents_OnStartupComplete); }
private void SetUpLifeCycleEvents() { var dte = ServiceLocator.Resolve<DTE2>(); _dteEvents = dte.Events.DTEEvents; _dteEvents.OnBeginShutdown += DteEventsOnOnBeginShutdown; _dteEvents.OnStartupComplete += StartupCompleted; }
private void HandleVisualStudioShutDown() { try { Log.Write("OnBeginShutdown"); _mPackageDteEvents.OnBeginShutdown -= HandleVisualStudioShutDown; _dteEvents = null; _mPackageDteEvents = null; //Check if there's only one instance of VS running. if it's so then remove from Microsoft.Common.Target //Any reference of LINQBridgeVs if (Process.GetProcessesByName(VisualStudioProcessName).Length > 1) return; //This simulate an uninstall. if it's the last instance of VS running disable LINQBridgeVs PackageConfigurator.IsLinqBridgeEnabled = false; } catch (Exception e) { Log.Write(e, "OnBeginShutdown Error..."); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debugger.Break(); base.Initialize(); _dte = (DTE)GetService(typeof(SDTE)); _dteEvents = _dte.Events.DTEEvents; _dteEvents.OnStartupComplete += OnStartupComplete; _mPackageDteEvents = ApplicationObject.Events.DTEEvents; _mPackageDteEvents.OnBeginShutdown += HandleVisualStudioShutDown; var bridge = new LINQBridgeVsExtension(_dte); //// Add our command handlers for menu (commands must exist in the .vsct file) var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null == mcs) return; //// Create the command for the menu item. var enableCommand = new CommandID(GuidList.GuidBridgeVsExtensionCmdSet, (int)PkgCmdIdList.CmdIdEnableBridge); var menuItemEnable = new OleMenuCommand((s, e) => bridge.Execute(CommandAction.Enable), enableCommand); menuItemEnable.BeforeQueryStatus += (s, e) => bridge.UpdateCommand(menuItemEnable, CommandAction.Enable); var disableCommand = new CommandID(GuidList.GuidBridgeVsExtensionCmdSet, (int)PkgCmdIdList.CmdIdDisableBridge); var menuItemDisable = new OleMenuCommand((s, e) => bridge.Execute(CommandAction.Disable), disableCommand); menuItemDisable.BeforeQueryStatus += (s, e) => bridge.UpdateCommand(menuItemDisable, CommandAction.Disable); var aboutCommand = new CommandID(GuidList.GuidBridgeVsExtensionCmdSet, (int)PkgCmdIdList.CmdIdAbout); var menuItemAbout = new OleMenuCommand((s, e) => { var about = new About(); about.ShowDialog(); }, aboutCommand); mcs.AddCommand(menuItemEnable); mcs.AddCommand(menuItemDisable); mcs.AddCommand(menuItemAbout); }
public VisualStudioEventHandler(DTEEvents dTEEvents, CommandEvents closeCommandEvents, ProcessStartInfo processStartInfo) { _dTEEvents = dTEEvents; _closeCommandEvents = closeCommandEvents; _startInfo = processStartInfo; dTEEvents.OnBeginShutdown += DTEEvents_OnBeginShutdown; if (closeCommandEvents != null) { closeCommandEvents.AfterExecute += CommandEvents_AfterExecute; } }