/// <summary>
        /// Constructs a instance of the main view for the revit addIn
        /// </summary>
        /// <param name="exEvent">External event for clashing process</param>
        /// <param name="handler">Handler for clashing process</param>
        /// <param name="externalCleanEvent">External event for cleaning view process</param>
        public MainUserControl(
            ExternalEvent exEvent,
            ClasherHandler handler,
            ExternalEvent externalCleanEvent
            )
        {
            InitializeComponent();
            m_ExEvent           = exEvent;
            m_Handler           = handler;
            _externalCleanEvent = externalCleanEvent;
            FillForm();

            this.DataContext = this;

            elementsClashingA = new ObservableCollection <ClashItems>();

            elementsClashingA.CollectionChanged += updateA;

            this.Topmost = true;

            ModelName.Content = RevitTools.Doc.Title.ToString();
        }
Exemple #2
0
        //   The external command invokes this on the end-user's request
        public void ShowForm()
        {
            // If we do not have a dialog yet, create and show it
            if (m_MyForm == null)
            {
                // A new handler to handle request posting by the dialog
                ClasherHandler handler = new ClasherHandler();

                // External Event for the dialog to use (to post requests)
                ExternalEvent exEvent = ExternalEvent.Create(handler);

                // External execution handler to provide the needed context by revit to perform modifications on active document
                CleanViewHandler cleanViewHandler = new CleanViewHandler();
                // External event used for clean elements on the active view
                ExternalEvent externalCleanEvent = ExternalEvent.Create(cleanViewHandler);

                // We give the objects to the new dialog;
                // The dialog becomes the owner responsible for disposing them, eventually.
                m_MyForm         = new MainUserControl(exEvent, handler, externalCleanEvent);
                m_MyForm.Closed += MyFormClosed;
                m_MyForm.Show();
            }
        }