internal void AddAdorner(
            AdornerLayer treeViewAdornerLayer, FrameworkElement adornedElement, ExplorerEFElement explorerElement,
            ExplorerFrame explorerFrame)
        {
            var adornerY = GetAdornerY(adornedElement, explorerElement, explorerFrame);

            if (adornerY >= 0)
            {
                SearchTickAdorner adorner;
                if (!_adorners.TryGetValue(adornerY, out adorner))
                {
                    adorner = new SearchTickAdorner(adornerY, adornedElement);
                    _adorners[adornerY] = adorner;
                    treeViewAdornerLayer.Add(adorner);

                    // adding adorners in batches of 100 - see bug: Windows OS Bugs 1750717 
                    if ((_adorners.Count % 100) == 0)
                    {
                        treeViewAdornerLayer.UpdateLayout();
                    }
                }

                adorner.AddExplorerElement(explorerElement);
            }
        }
 /// <summary>
 ///     This API supports the Entity Framework infrastructure and is not intended to be used directly from your code.
 /// </summary>
 /// <param name="disposing">This API supports the Entity Framework infrastructure and is not intended to be used directly from your code.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _explorerFrame = null;
     }
 }
Exemple #3
0
        internal void AddAdorner(
            AdornerLayer treeViewAdornerLayer, FrameworkElement adornedElement, ExplorerEFElement explorerElement,
            ExplorerFrame explorerFrame)
        {
            var adornerY = GetAdornerY(adornedElement, explorerElement, explorerFrame);

            if (adornerY >= 0)
            {
                SearchTickAdorner adorner;
                if (!_adorners.TryGetValue(adornerY, out adorner))
                {
                    adorner             = new SearchTickAdorner(adornerY, adornedElement);
                    _adorners[adornerY] = adorner;
                    treeViewAdornerLayer.Add(adorner);

                    // adding adorners in batches of 100 - see bug: Windows OS Bugs 1750717
                    if ((_adorners.Count % 100) == 0)
                    {
                        treeViewAdornerLayer.UpdateLayout();
                    }
                }

                adorner.AddExplorerElement(explorerElement);
            }
        }
        private ExplorerFrame GetExplorerFrame()
        {
            if (_explorerFrame == null)
            {
                _explorerFrame = ExplorerUtility.FindLogicalAncestorOfType <ExplorerFrame>(this);
            }

            return(_explorerFrame);
        }
        internal static double GetAdornerY(FrameworkElement adornedElement, ExplorerEFElement explorerElement, ExplorerFrame explorerFrame)
        {
            var treeViewItemY = explorerFrame.GetY(explorerFrame.GetTreeViewItem(explorerElement, true));

            // The adorner Y offset in the scrollbar adornedElement
            var size = SearchTickAdorner.GetRectangleSize(SearchTickAdorner.GetTickSize(adornedElement));
            var padding = (Thickness)adornedElement.GetValue(Border.PaddingProperty);
            var y = padding.Top +
                    ((adornedElement.ActualHeight - padding.Top - padding.Bottom) * treeViewItemY)
                    / (explorerFrame.ScrollViewer.ExtentHeight);
            return y - (y % size.Height) + size.Height;
        }
 private static ExplorerTreeViewItem GetTreeViewItemForEFObject(EFObject efobject, ExplorerFrame explorerFrame)
 {
     var treeViewItem = explorerFrame.ExplorerTreeRoot;
     if (null != efobject
         && !(efobject is EFArtifact))
     {
         var entityDesignArtifact = efobject.Artifact.ArtifactSet.GetEntityDesignArtifact();
         var editingContext =
             PackageManager.Package.DocumentFrameMgr.EditingContextManager.GetNewOrExistingContext(entityDesignArtifact.Uri);
         var element = explorerFrame.ExplorerViewModelHelper.GetExplorerEFElementForEFObject(editingContext, efobject);
         Debug.Assert(element != null, "Unable to find ExplorerEFElement for efobject of type " + efobject.GetType());
         if (element != null)
         {
             treeViewItem = explorerFrame.GetTreeViewItem(element, true);
         }
     }
     return treeViewItem;
 }
 public SearchTickAdorner(FrameworkElement adornedElement, ExplorerEFElement explorerElement, ExplorerFrame explorerFrame)
     : this(SearchAdornerDecorator.GetAdornerY(adornedElement, explorerElement, explorerFrame), adornedElement)
 {
     AddExplorerElement(explorerElement);
 }
        private static ExplorerTreeViewItem GetTreeViewItemForEFObject(EFObject efobject, ExplorerFrame explorerFrame)
        {
            var treeViewItem = explorerFrame.ExplorerTreeRoot;

            if (null != efobject &&
                !(efobject is EFArtifact))
            {
                var entityDesignArtifact = efobject.Artifact.ArtifactSet.GetEntityDesignArtifact();
                var editingContext       =
                    PackageManager.Package.DocumentFrameMgr.EditingContextManager.GetNewOrExistingContext(entityDesignArtifact.Uri);
                var element = explorerFrame.ExplorerViewModelHelper.GetExplorerEFElementForEFObject(editingContext, efobject);
                Debug.Assert(element != null, "Unable to find ExplorerEFElement for efobject of type " + efobject.GetType());
                if (element != null)
                {
                    treeViewItem = explorerFrame.GetTreeViewItem(element, true);
                }
            }
            return(treeViewItem);
        }
Exemple #9
0
 public SearchTickAdorner(FrameworkElement adornedElement, ExplorerEFElement explorerElement, ExplorerFrame explorerFrame)
     : this(SearchAdornerDecorator.GetAdornerY(adornedElement, explorerElement, explorerFrame), adornedElement)
 {
     AddExplorerElement(explorerElement);
 }
Exemple #10
0
        internal static double GetAdornerY(FrameworkElement adornedElement, ExplorerEFElement explorerElement, ExplorerFrame explorerFrame)
        {
            var treeViewItemY = explorerFrame.GetY(explorerFrame.GetTreeViewItem(explorerElement, true));

            // The adorner Y offset in the scrollbar adornedElement
            var size    = SearchTickAdorner.GetRectangleSize(SearchTickAdorner.GetTickSize(adornedElement));
            var padding = (Thickness)adornedElement.GetValue(Border.PaddingProperty);
            var y       = padding.Top +
                          ((adornedElement.ActualHeight - padding.Top - padding.Bottom) * treeViewItemY)
                          / (explorerFrame.ScrollViewer.ExtentHeight);

            return(y - (y % size.Height) + size.Height);
        }
            private void OnContextDisposing(object sender, EventArgs e)
            {
                var context = (EditingContext)sender;

                if (_selectionContainer != null)
                {
                    _selectionContainer.Dispose();
                    _selectionContainer = null;
                }

                if (_explorerFrame != null)
                {
                    _explorerFrame.Dispose();
                    _explorerFrame = null;
                }

                context.Items.SetValue(new ExplorerInfo());
                context.Disposing -= OnContextDisposing;
            }
            internal void SetExplorerInfo(ExplorerFrame explorerFrame, SelectionContainer<ExplorerSelection> selectionContainer)
            {
                _explorerFrame = explorerFrame;
                _selectionContainer = selectionContainer;

                var context = explorerFrame.Context;
                context.Disposing += OnContextDisposing;
                context.Items.SetValue(this);
            }
        private ExplorerFrame GetExplorerFrame()
        {
            if (_explorerFrame == null)
            {
                _explorerFrame = ExplorerUtility.FindLogicalAncestorOfType<ExplorerFrame>(this);
            }

            return _explorerFrame;
        }
 /// <summary>
 ///     This API supports the Entity Framework infrastructure and is not intended to be used directly from your code.
 /// </summary>
 /// <param name="disposing">This API supports the Entity Framework infrastructure and is not intended to be used directly from your code.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _explorerFrame = null;
     }
 }