//Check if the Document is a FamilyDocument
        private void CheckDoc(ViewActivatedEventArgs e)
        {
            Document doc = e.CurrentActiveView.Document;

            // If the document is a Family Document, disable the UI
            if (!doc.IsFamilyDocument)
            {
                if (!_disabled)
                {
                    _presenter.Disable();
                    _disabled = true;
                }
                return;
            }
            else
            {
                if (_disabled)
                {
                    _presenter.Enable();
                    _disabled = false;
                }
            }
            if (_document.Title != doc.Title)
            {
                _document           = doc;
                _presenter.Document = doc;
                _presenter.DocumentSwitched();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// On Document Switched
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnViewActivated(object sender, ViewActivatedEventArgs e)
        {
            if (!Started)
            {
                return;            // only do if the plugin is active
            }
            if (_presenter == null)
            {
                ShowForm();
                return;
            }

            Document doc = e.CurrentActiveView.Document;

            // If the document is a Family Document, disable the UI
            if (!doc.IsFamilyDocument)
            {
                if (!_disabled)
                {
                    _presenter.Disable();
                    _disabled = true;
                }
                return;
            }
            else
            {
                if (_disabled)
                {
                    _presenter.Enable();
                    _disabled = false;
                }
            }
            if (_document.Title != doc.Title)
            {
                _document            = doc;
                _presenter._Document = doc;
                _presenter.DocumentSwitched();
            }
        }