Esempio n. 1
0
        static public void RelinkToDoc(_BcAp.Document document)
        {
            if (LinkedDocument == document)
            {
                return;
            }

            if (LinkedDocument != null)
            {
                LinkedDocument.CommandEnded            -= OnCommandEnded;
                LinkedDocument.Database.ObjectAppended -= OnObjectAppended;
                LinkedDocument.Database.ObjectErased   -= OnObjectErased;
                LinkedDocument.Database.ObjectModified -= OnObjectModified;
                LinkedDocument.CloseWillStart          -= OnBcDocCloseWillStart;
            }
            _preview?.Dispose();
            LinkedDocument = document;
            LinkedDocument.CloseWillStart          += OnBcDocCloseWillStart;
            LinkedDocument.Database.ObjectModified += OnObjectModified;
            LinkedDocument.Database.ObjectErased   += OnObjectErased;
            LinkedDocument.Database.ObjectAppended += OnObjectAppended;
            LinkedDocument.CommandEnded            += OnCommandEnded;

            _preview = new Visualization.GrasshopperPreview();
            ExpireGH();
            NeedRedraw = true;
        }
Esempio n. 2
0
 static void OnBcDocCloseWillStart(object sender, EventArgs e)
 {
     LinkedDocument.CloseWillStart -= OnBcDocCloseWillStart;
     _preview?.Dispose();
     _preview       = null;
     LinkedDocument = null;
     ExpireGH();
 }
Esempio n. 3
0
        static void OnDocumentBecameCurrent(object sender, _BcAp.DocumentCollectionEventArgs e)
        {
            if (LinkedDocument == null)
            {
                return;
            }

            if (e.Document != LinkedDocument)
            {
                _preview?.Dispose();
                _preview = null;
            }
            else
            {
                _preview = new Visualization.GrasshopperPreview();
            }
        }