예제 #1
0
        public void CommonItemActivation(object sender, EventArgs eventArgs)
        {
            var o = Tree.SelectedObject;

            if (o == null)
            {
                return;
            }

            if (UserSettings.DoubleClickToExpand)
            {
                if (Tree.CanExpand(o) && !Tree.IsExpanded(o))
                {
                    Tree.Expand(o);
                    return;
                }
                if (Tree.IsExpanded(o))
                {
                    Tree.Collapse(o);
                    return;
                }
            }

            var cmd = new ExecuteCommandActivate(_activator, o);

            if (!cmd.IsImpossible)
            {
                cmd.Execute();
            }
        }
 /// <summary>
 /// Recursively collapses a group in the TreeListView
 /// control until it cannot collapse further. Prevents
 /// re-expansion from taking a long time.
 /// </summary>
 /// <param name="ienum"></param>
 internal void RecursiveCollapse(IEnumerable ienum)
 {
     foreach (var m in from object m in ienum where TlvControl.CanExpand(m) select m)
     {
         RecursiveCollapse(TlvControl.GetChildren(m));
         TlvControl.Collapse(m);
     }
 }
예제 #3
0
 private void ChildrenGetter()
 {
     m_treeListView1.ChildrenGetter = delegate(object x)
     {
         try
         {
             if (x is Project project)
             {
                 return(project.KnowledgeAreas);
             }
             if (x is KnowledgeArea)
             {
                 if (m_FilterInitiating == true)
                 {
                     return(((KnowledgeArea)x).Processes.FindAll(p => p.Initiating == true));
                 }
                 else
                 {
                     return(((KnowledgeArea)x).Processes);
                 }
                 //return ((KnowledgeArea)x).Processes;
                 //return ((KnowledgeArea)x).Processes.FindAll(p => p.Initiating == true);
             }
             else
             {
                 return(new ArrayList());
             }
         }
         catch (UnauthorizedAccessException ex)
         {
             //this.BeginInvoke((MethodInvoker)delegate ()
             //{
             m_treeListView1.Collapse(x);
             //    MessageBox.Show(this, ex.Message, "ObjectListViewDemo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             //});
             return(new ArrayList());
         }
     };
 }