private void InitializeContextMenu() { bool displayConfigMenu = false; var test = _view.ContextNode?.Tag as TestNode; if (test != null && test.IsProject) { TestPackage package = _model.GetPackageForTest(test.Id); string activeConfig = _model.GetActiveConfig(package); var configNames = _model.GetConfigNames(package); if (configNames.Count > 0) { _view.ActiveConfiguration.MenuItems.Clear(); foreach (string config in configNames) { var configEntry = new ToolStripMenuItem(config); configEntry.Checked = config == activeConfig; configEntry.Click += (sender, e) => _model.ReloadPackage(package, ((ToolStripMenuItem)sender).Text); _view.ActiveConfiguration.MenuItems.Add(configEntry); } displayConfigMenu = true; } } _view.ActiveConfiguration.Visible = displayConfigMenu; }