Exemplo n.º 1
0
        /// <summary>
        /// Return lists of all publishers and applications selected in the tree
        /// </summary>
        /// <param name="listSelectedPublishers">return list of publishers selected</param>
        /// <param name="listSelectedApplications">return list of applications selected</param>
        /// <returns>true if all nodes selected, false if specific nodes selected and returned in lists</returns>
        ///
        public bool GetSelectedItems(out ApplicationPublisherList listSelectedPublishers, out InstalledApplicationList listSelectedApplications)
        {
            // Allocate the lists that we will return
            listSelectedPublishers   = new ApplicationPublisherList();
            listSelectedApplications = new InstalledApplicationList();

            // Are all nodes selected as this is SO much easier to handle as we just return TRUE to indicate that
            // all nodes have been selected - the return lists are empty
            UltraTreeNode rootNode = applicationsTree.Nodes[0];

            if (rootNode.CheckedState == CheckState.Checked)
            {
                return(true);
            }

            // OK unfortunately not all nodes are selected so we now need to populate the lists based on what has
            // been selected.  Note that if a node is checked then by definition ALL applications beneath that
            // node are deemed to be checked but we do not bother iterating them
            GetSelectedItems(listSelectedPublishers, listSelectedApplications);

            // return false to show that there is a selection
            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Recursive routine to traverse the locations tree and build up a list of the Asset Groups and Assets
        /// which are checked
        /// </summary>
        /// <param name="parentNode"></param>
        /// <param name="listSelectedGroups"></param>
        /// <param name="listSelectedAssets"></param>
        protected void GetSelectedItems(ApplicationPublisherList listSelectedPublishers, InstalledApplicationList listSelectedApplications)
        {
            UltraTreeNode rootNode = applicationsTree.Nodes[0];

            // Publishers first
            foreach (UltraTreeNode publisherNode in rootNode.Nodes)
            {
                foreach (UltraTreeNode applicationNode in publisherNode.Nodes)
                {
                    if (applicationNode.CheckedState == CheckState.Checked)
                    {
                        listSelectedApplications.Add(applicationNode.Tag as InstalledApplication);
                    }
                }
            }
        }
 /// <summary>
 /// Return lists of items selected in the locations control - this will return true if all items are
 /// selected and false if the selected items are located in the returned lists which may be empty)
 /// </summary>
 /// <param name="listSelectedGroups"></param>
 /// <param name="listSelectedAssets"></param>
 /// <returns></returns>
 public bool GetSelectedItems(out ApplicationPublisherList listSelectedPublishers, out InstalledApplicationList listSelectedApplications)
 {
     return(selectApplicationsControl.GetSelectedItems(out listSelectedPublishers, out listSelectedApplications));
 }