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()); }
private void SwitchStartupDir(string msg) { var dir = GetProjectPath(); terminalController.SetPath(dir); terminalController.InvokeCmd(msg, OptionMgr.CdPrefix() + dir); System.Threading.Thread.Sleep(200); //Wait dir changed terminalController.InvokeCmd("\n[Project Init Script ...]\n", OptionMgr.GetProjectScript()); }