/// <summary> /// Handles the NodeClose event of the completedRecipesTreeView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Windows.Forms.TreeNodeMouseClickEventArgs"/> instance containing the event data.</param> private void completedRecipesTreeView_NodeClose(object sender, TreeNodeMouseClickEventArgs e) { GuidanceNavigatorManager.RecipeExecutionHistory history = e.Node.Tag as GuidanceNavigatorManager.RecipeExecutionHistory; if (history != null) { guidanceNavigatorManager.RemoveLogRecipeExecution(selectedGuidancePackage, history); e.Node.Remove(); } }
/// <summary> /// Adds a history recipe execution entry. /// </summary> private void AddHistoryRecipeEntry(GuidanceNavigatorManager.RecipeExecutionHistory recipeExecutionHistory) { Recipe recipe = guidanceNavigatorManager.GetRecipeConfiguration(selectedGuidancePackage, recipeExecutionHistory.RecipeName); if (recipe == null) { return; } ExtendedTreeNode recipeTreeNode = new ExtendedTreeNode(); recipeTreeNode.Text = recipe.Caption; recipeTreeNode.ToolTipText = recipe.Description; recipeTreeNode.Tag = recipeExecutionHistory; recipeTreeNode.ShowCloseButton = true; ExtendedTreeNode suggestedRecipesTreeNode = new ExtendedTreeNode(); suggestedRecipesTreeNode.StateImageIndex = ImageDocumentationIndex; suggestedRecipesTreeNode.ImageIndex = ImageDocumentationIndex; suggestedRecipesTreeNode.SelectedImageIndex = ImageDocumentationIndex; suggestedRecipesTreeNode.ShowAsLink = false; suggestedRecipesTreeNode.Text = Properties.Resources.Navigator_NextStepsTitle; // Recipe Documentation Nodes if (recipe.DocumentationLinks != null) { foreach (Link documentationLink in recipe.DocumentationLinks) { if (documentationLink.Kind == DocumentationKind.Documentation) { AddDocumentationNode(recipeTreeNode, documentationLink); } else if (documentationLink.Kind == DocumentationKind.NextStep) { AddDocumentationNode(suggestedRecipesTreeNode, documentationLink); } } } AddExecuteRecipeHistoryNode(recipe, recipeTreeNode); if (suggestedRecipesTreeNode.Nodes.Count > 0) { recipeTreeNode.Nodes.Add(suggestedRecipesTreeNode); } // collapse all history entries and show expand just the latest entry. this.historyRecipesTreeView.CollapseAll(); recipeTreeNode.ExpandAll(); this.historyRecipesTreeView.Nodes.Add(recipeTreeNode); historyRecipesTreeView.SelectedNode = recipeTreeNode; }
void guidanceNavigatorManager_RecipeExecuted(object sender, RecipeEventArgs e) { GuidancePackage package = (GuidancePackage)sender; if (package != selectedGuidancePackage) { SelectPackage(package); } GuidanceNavigatorManager.RecipeExecutionHistory[] history = guidanceNavigatorManager.GetExecutedRecipes(package).ToArray(); GuidanceNavigatorManager.RecipeExecutionHistory historyItem = history.GetValue(history.Length - 1) as GuidanceNavigatorManager.RecipeExecutionHistory; AddHistoryRecipeEntry(historyItem); ShowHistoryRecipes(); }