Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 /// <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);
     }
 }
Exemplo n.º 4
0
        /// <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;
        }
Exemplo n.º 5
0
 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;
 }