示例#1
0
        /// <summary>
        /// Set the document parent handling object and visibility
        /// to enable tool window to react on deactivation and activation
        /// of documents with content relevant to this tool window viewmodel.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="isVisible"></param>
        public void SetToolWindowVisibility(IDocumentParent parent,
                                            bool isVisible = true)
        {
            if (IsVisible == true)
            {
                this.SetDocumentParent(parent);
            }
            else
            {
                this.SetDocumentParent(null);
            }

            base.SetToolWindowVisibility(isVisible);
        }
示例#2
0
        /// <summary>
        /// Set the document parent handling object to deactivation and activation
        /// of documents with content relevant to this tool window viewmodel.
        /// </summary>
        /// <param name="parent"></param>
        public void SetDocumentParent(IDocumentParent parent)
        {
            if (parent != null)
            {
                parent.ActiveDocumentChanged -= this.OnActiveDocumentChanged;
            }

            this.mParent = parent;

            // Check if active document is a log4net document to display data for...
            if (this.mParent != null)
            {
                parent.ActiveDocumentChanged += new DocumentChangedEventHandler(this.OnActiveDocumentChanged);
            }
            else
            {
                this.OnActiveDocumentChanged(null, null);
            }
        }