public RecipeFlowchartViewer(Recipe recipe) { InitializeComponent(); RecipeNode RootRecipeNode = createRecipeNode(recipe, 25, 25); recipeNodes.Add(recipe.id, RootRecipeNode); recipeNodesThatNeedToBeProcessed.Add(RootRecipeNode); RootNode = RootRecipeNode.Node; //tl.KeepGroupLayout = true; //layout.Orientation = MindFusion.Diagramming.Layout.Orientation.Vertical; layout.EnableParallelism = true; }
public RecipeFlowchartViewer(Recipe recipe) { InitializeComponent(); RecipeNode rootRecipeNode = CreateRecipeNode(recipe, 25, 25); recipeNodes.Add(recipe.ID, rootRecipeNode); recipeNodesThatNeedToBeProcessed.Add(rootRecipeNode); //tl.KeepGroupLayout = true; //layout.Orientation = MindFusion.Diagramming.Layout.Orientation.Vertical; layout.EnableParallelism = true; if (Settings.settings["loadAllFlowchartNodes"] != null && Settings.settings["loadAllFlowchartNodes"].ToObject <bool>()) { loadLinkedRecipesButton.Visible = false; ProcessAllRecipes(); } }
private void ProcessRecipes() { List <RecipeNode> nodesInProgress = new List <RecipeNode>(recipeNodesThatNeedToBeProcessed); recipeNodesThatNeedToBeProcessed.Clear(); progressBar1.Visible = true; progressBar1.Value = 0; progressBar1.Maximum = nodesInProgress.Count; progressBar1.Step = 1; foreach (RecipeNode currentNode in nodesInProgress) { foreach (string link in currentNode.LinkedRecipes) { // if a node for this recipe doesn't already exist, create it and link to it if (!recipeNodes.ContainsKey(link)) { RecipeNode tmpNode = CreateRecipeNode(Utilities.GetRecipe(link), 25, 25); recipeNodes[link] = tmpNode; tmpNode.Node.AttachTo(currentNode.Node, AttachToNode.MiddleRight); recipeNodesThatNeedToBeProcessed.Add(tmpNode); } } foreach (TreeViewItem rootItem in currentNode.Node.RootItems) { if (rootItem.Label.Contains("Recipes:")) { foreach (TreeViewItem child in rootItem.Children) { // child.Label -> "Linked Recipe:" foreach (TreeViewItem recipeChild in child.Children) { if (recipeChild.Label.Contains("Recipe ID: ")) { CreateLink(currentNode.Node, child, (TreeViewNode)diagram1.FindNodeById(recipeChild.Label.Substring(recipeChild.Label.LastIndexOf(' ') + 1))); } } } } } progressBar1.PerformStep(); } ArrangeNodes(); diagram1.RouteAllLinks(); progressBar1.Visible = false; }