private void OnAppPoolExec(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (null != menuCommand) { var appPools = LookupAppPools.GetAppPoolProcesses(); int appPoolItemIndex = menuCommand.CommandID.ID - this.baseMRUID; if (appPoolItemIndex >= 0 && appPoolItemIndex < this.appPoolList.Count && appPoolItemIndex < appPools.Count) { var appPoolProcId = appPools.Where(ap => ap.Value == menuCommand.Text).FirstOrDefault().Key; AttachToProcess(appPoolProcId); } } }
private void OnAppPoolQueryStatus(object sender, EventArgs e) { OleMenuCommand menuCommand = sender as OleMenuCommand; if (null != menuCommand) { var appPools = LookupAppPools.GetAppPoolProcesses(); int appPoolItemIndex = menuCommand.CommandID.ID - this.baseMRUID; if (appPoolItemIndex >= 0 && appPoolItemIndex < this.appPoolList.Count && appPoolItemIndex < appPools.Count) { menuCommand.Text = appPools.Values.Skip(appPoolItemIndex).FirstOrDefault(); menuCommand.Visible = true; } else { menuCommand.Visible = false; } } }
private void RefreshAppPoolMenu(OleMenuCommandService mcs) { var appPools = LookupAppPools.GetAppPoolProcesses(); int j = 0; foreach (var appPool in appPoolList) { var cmdID = new CommandID(GuidList.guidNielsV_AttachToAppPoolCmdSet, this.baseMRUID + j); var menuCommand = mcs.FindCommand(cmdID) as OleMenuCommand; if (j >= 0 && j < this.appPoolList.Count && j < appPools.Count) { menuCommand.Text = appPools.Values.ElementAt(j); menuCommand.Visible = true; } else { menuCommand.Visible = false; } j++; } }