Beispiel #1
0
        private ICollapsible ExpandInternal(ICollapsed collapsed)
        {
            EnsureValid();

            Collapsed internalCollapsed = collapsed as Collapsed;

            if (internalCollapsed == null)
            {
                throw new ArgumentException("The given collapsed region was not created by this outlining manager.",
                                            "collapsed");
            }

            if (!internalCollapsed.IsValid)
            {
                throw new InvalidOperationException("The collapsed region is invalid, meaning it has already been expanded.");
            }

            if (!collapsedRegionTree.RemoveItem(internalCollapsed, internalCollapsed.Extent))
            {
                throw new ApplicationException("Unable to remove the collapsed region from outlining manager, which means there is an internal " +
                                               "consistency issue.");
            }

            // Now that we've expanded the region, invalidate the ICollapsed so it can no longer be used.
            internalCollapsed.Invalidate();

            return(new Collapsible(collapsed.Extent, collapsed.Tag));
        }
Beispiel #2
0
        public ICollapsible Expand(ICollapsed collapsed)
        {
            ICollapsible newCollapsible = ExpandInternal(collapsed);

            // Send out change event
            var handler = RegionsExpanded;

            if (handler != null)
            {
                handler(this, new RegionsExpandedEventArgs(Enumerable.Repeat(newCollapsible, 1)));
            }

            return(newCollapsible);
        }
Beispiel #3
0
        public ICollapsed TryCollapse(ICollapsible collapsible)
        {
            ICollapsed newCollapsed = CollapseInternal(collapsible);

            if (newCollapsed == null)
            {
                return(newCollapsed);
            }

            // Raise event.
            var handler = RegionsCollapsed;

            if (handler != null)
            {
                handler(this, new RegionsCollapsedEventArgs(Enumerable.Repeat(newCollapsed, 1)));
            }

            return(newCollapsed);
        }
 internal bool Match(ICollapsed givenCollapsed)
 {
     return(base.Match(givenCollapsed));
 }