/// <summary> /// Compares two activites for their position within their parent. /// </summary> /// <param name="elem1">First activity to compare.</param> /// <param name="elem2">Second activity to compare.</param> /// <returns>Less than 0 if elem1 is less than elem2, 0 if they are equal, greater than 0 /// if elem1 is greater than elem2.</returns> private int CompareActivities(TableOfContentsElement elem1, TableOfContentsElement elem2) { Activity act1 = (Activity)elem1; Activity act2 = (Activity)elem2; return(act1.Position - act2.Position); }
private bool CheckForVisibleChildren(TableOfContentsElement element) { bool hasVisibleChildren = false; foreach (TableOfContentsElement child in element.Children) { if (child.Children.Count == 0) { hasVisibleChildren = child.IsVisible; } else { hasVisibleChildren = CheckForVisibleChildren(child); } if (hasVisibleChildren) { break; } } return(hasVisibleChildren); }
/// <summary> /// Recursive function to append toc state to the buffer. /// </summary> private void GetTocNodeState(StringBuilder buffer, TableOfContentsElement element) { if (element.IsVisible) { buffer.AppendFormat("{0},{1};", XmlConvert.ToString(element.ActivityId), element.IsValidChoiceNavigationDestination ? "true" : "false"); } foreach (TableOfContentsElement child in element.Children) { GetTocNodeState(buffer, child); } }
/// <summary> /// Compares two activites for their position within their parent. /// </summary> /// <param name="elem1">First activity to compare.</param> /// <param name="elem2">Second activity to compare.</param> /// <returns>Less than 0 if elem1 is less than elem2, 0 if they are equal, greater than 0 /// if elem1 is greater than elem2.</returns> private int CompareActivities(TableOfContentsElement elem1, TableOfContentsElement elem2) { Activity act1 = (Activity)elem1; Activity act2 = (Activity)elem2; return act1.Position - act2.Position; }
private bool CheckForVisibleChildren(TableOfContentsElement element) { bool hasVisibleChildren = false; foreach (TableOfContentsElement child in element.Children) { if (child.Children.Count == 0) { hasVisibleChildren = child.IsVisible; } else { hasVisibleChildren = CheckForVisibleChildren(child); } if (hasVisibleChildren) { break; } } return hasVisibleChildren; }