Esempio n. 1
0
 internal void RaiseBeforeCollapse(TreeListViewCancelEventArgs e)
 {
     if (BeforeCollapse != null)
     {
         BeforeCollapse(this, e);
     }
 }
Esempio n. 2
0
 internal void RaiseBeforeExpand(TreeListViewCancelEventArgs e)
 {
     if (BeforeExpand != null)
     {
         BeforeExpand(this, e);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Expand
 /// </summary>
 public void Expand()
 {
     // The item wasn't expanded -> raise an event
     if (Visible && !_isexpanded && ListView != null)
     {
         TreeListViewCancelEventArgs e = new TreeListViewCancelEventArgs(
             this, TreeListViewAction.Expand);
         ListView.RaiseBeforeExpand(e);
         if (e.Cancel)
         {
             return;
         }
     }
     if (this.Visible)
     {
         Items.ReadWriteLock.AcquireReaderLock(-1);
         for (int i = Items.Count - 1; i >= 0; i--)
         {
             TreeListViewItem item = this.Items[i];
             if (!item.Visible)
             {
                 ListView LView = this.ListView;
                 LView.Items.Insert(
                     this.Index + 1,
                     item);
                 item.SetIndentation();
             }
             if (item.IsExpanded)
             {
                 item.Expand();
             }
         }
         Items.ReadWriteLock.ReleaseReaderLock();
     }
     // The item wasn't expanded -> raise an event
     if (Visible && !_isexpanded && ListView != null)
     {
         this._isexpanded = true;
         TreeListViewEventArgs e = new TreeListViewEventArgs(
             this, TreeListViewAction.Expand);
         ListView.RaiseAfterExpand(e);
         if (AfterExpand != null)
         {
             AfterExpand(this);
         }
     }
     this._isexpanded = true;
 }
Esempio n. 4
0
        /// <summary>
        /// Collapse
        /// </summary>
        public void Collapse()
        {
            // The item was expanded -> raise an event
            if (Visible && _isexpanded && ListView != null)
            {
                TreeListViewCancelEventArgs e = new TreeListViewCancelEventArgs(
                    this, TreeListViewAction.Collapse);
                ListView.RaiseBeforeCollapse(e);
                if (e.Cancel)
                {
                    return;
                }
            }

            // Collapse
            Items.ReadWriteLock.AcquireReaderLock(-1);
            if (this.Visible)
            {
                foreach (TreeListViewItem item in Items)
                {
                    item.Hide();
                }
            }
            Items.ReadWriteLock.ReleaseReaderLock();

            // The item was expanded -> raise an event
            if (Visible && _isexpanded && ListView != null)
            {
                this._isexpanded = false;
                TreeListViewEventArgs e = new TreeListViewEventArgs(
                    this, TreeListViewAction.Collapse);
                ListView.RaiseAfterCollapse(e);
                if (AfterCollapse != null)
                {
                    AfterCollapse(this);
                }
            }
            this._isexpanded = false;
        }