Exemple #1
0
        /// <summary>
        /// Custom processing for active document changing event</summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args</param>
        void documentRegistry_ActiveDocumentChanged(object sender, EventArgs e)
        {
            ITreeView treeView = m_documentRegistry.GetMostRecentDocument <ITreeView>();

            if (treeView != null)
            {
                treeView = new FilteredTreeView(treeView, DefaultFilter);
            }

            // If it's different, switch to it
            if (!FilteredTreeView.Equals(TreeView, treeView))
            {
                if (TreeView != null)
                {
                    m_contextRegistry.RemoveContext(TreeView);
                }

                TreeView = treeView;

                if (treeView != null)
                {
                    // Make document the active context
                    m_contextRegistry.ActiveContext = treeView;

                    // Make sure user can see our TreeControl if it was hidden
                    m_controlHostService.Show(TreeControl);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Indicates whether two ITreeView instances are equal</summary>
        /// <param name="first">First ITreeView to compare</param>
        /// <param name="second">Second ITreeView to compare</param>
        /// <returns>True iff ITreeView instances are equal</returns>
        public static bool Equals(ITreeView first, ITreeView second)
        {
            FilteredTreeView f1 = first.As <FilteredTreeView>();

            if (f1 != null)
            {
                first = f1.m_treeView;
            }
            FilteredTreeView f2 = second.As <FilteredTreeView>();

            if (f2 != null)
            {
                second = f2.m_treeView;
            }
            return(first == second);
        }
        /// <summary>
        /// Custom processing for active document changing event</summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args</param>
        void documentRegistry_ActiveDocumentChanged(object sender, EventArgs e)
        {
            ITreeView treeView = m_documentRegistry.GetMostRecentDocument<ITreeView>();
            if (treeView != null)
                treeView = new FilteredTreeView(treeView, DefaultFilter);

            // If it's different, switch to it
            if (!FilteredTreeView.Equals(TreeView, treeView))
            {
                if (TreeView != null)
                    m_contextRegistry.RemoveContext(TreeView);

                TreeView = treeView;
                
                if (treeView != null)
                {
                    // Make document the active context
                    m_contextRegistry.ActiveContext = treeView;

                    // Make sure user can see our TreeControl if it was hidden
                    m_controlHostService.Show(TreeControl);
                }
            }
        }
Exemple #4
0
        private void ContextRegistry_ActiveContextChanged(object sender, EventArgs e)
        {
            IGameContext game = m_contextRegistry.GetActiveContext<IGameContext>();
            if (game == null)
            {
                TreeView = null;
            }
            else
            {
                ITreeView treeView = new FilteredTreeView((ITreeView)game, DefaultFilter);

                // If it's different, switch to it
                if (!FilteredTreeView.Equals(TreeView, treeView))
                {
                    TreeView = treeView;
                    UpdateFiltering(this, EventArgs.Empty);
                }
            }

            if (m_validationContext != null)
            {
                m_validationContext.Ended -= ValidationContext_Ended;
            }
            m_validationContext = (IValidationContext)game;
            if (m_validationContext != null)
            {
                m_validationContext.Ended += ValidationContext_Ended;
            }
        }
Exemple #5
0
        private void documentRegistry_ActiveDocumentChanged(object sender, EventArgs e)
        {
            // get the most recent document that can provide a tree view of the UI;
            //  GetActiveDocument would also work, as long as no other component loads documents.
            ITreeView treeView = m_documentRegistry.GetMostRecentDocument<TreeView>();
            if(treeView != null)
                treeView = new FilteredTreeView(treeView, DefaultFilter);
            // if it's different, switch to it
            if(!FilteredTreeView.Equals(TreeView,treeView))            
            {
                if (TreeView != null)
                    m_contextRegistry.RemoveContext(TreeView);
                TreeView = treeView;

                UpdateFiltering(this, EventArgs.Empty);

                if (treeView != null)
                    m_contextRegistry.ActiveContext = TreeView;                
            }
        }