DynamicModelUpdate.SectionUpdater.Register C# (CSharp) Méthode

Register() private méthode

private Register ( Document doc ) : void
doc Document
Résultat void
        internal void Register(Document doc)
        {
            // create a window filter for the updater's scope
              // we are only interested in two elements, one window and one section
              // (for the sake of simplicity, we hard-coded the elements' unique Ids)
              String windowUniqueId = "7f04899c-797b-4ad1-a9da-c6de1243ff83-00025ff6";
              String sectionUniqueId = "4ca42fe1-e3e2-4bee-ab19-7d6e95cdf1bc-000261e8";

              Element window = doc.get_Element(windowUniqueId);
              if (window == null)
              throw new Exception("Window was not found in the document.");
              Element section = doc.get_Element(sectionUniqueId);
              if (section == null)
              throw new Exception("Section was not found in the document.");

              // Setup collection of ids for the updater
              List<ElementId> idsToWatch = new List<ElementId>();
              m_windowId = window.Id;
              idsToWatch.Add(m_windowId);
              m_sectionId = section.Id;

              UpdateInitialParameters(doc);

             // Register and set a trigger for the section updater when the window changes
             UpdaterRegistry.RegisterUpdater(this, doc);
             UpdaterRegistry.AddTrigger(m_updaterId, doc, idsToWatch, Element.GetChangeTypeGeometry());
        }

Usage Example

Exemple #1
0
        private void RegisterSectionUpdaterOnOpen(object source, DocumentOpenedEventArgs args)
        {
            if (args.Document.Title.StartsWith("AssociativeSection"))
              {
             m_sectionUpdater = new SectionUpdater(m_thisAppId);
             m_sectionUpdater.Register(args.Document);

             bool enableSecondUpdate = false;
             if (enableSecondUpdate)
             {
                m_sectionUpdater.UpdateInitialParameters(args.Document);
             }
              }

               args.Document.DocumentClosing += UnregisterSectionUpdaterOnClose;
        }
All Usage Examples Of DynamicModelUpdate.SectionUpdater::Register