Ejemplo n.º 1
0
        public ModelessForm(
            ExternalCommandData commandData,
            UIControlledApplication uiCtrlApp,
            ExternalEvent externalEvent,
            EventHandler eventHandler,
            ElementProtectionUpdater elementProtectionUpdater,
            List <Element> elementList,
            Main.SetSelection selectionTool
            )
        {
            InitializeComponent();

            debug = new DebugController(TestPanel, listBox1, listBox2);

            //selectionTool(new List<ElementId>());

            // Stop IdlingHandler from executing during initialization
            this.haltIdlingHandler = true;

            // Get all data needed for use on the modeless form
            this.commandData              = commandData;
            this.uiApp                    = this.commandData.Application;
            this.uiDoc                    = this.uiApp.ActiveUIDocument;
            this.doc                      = this.uiDoc.Document;
            this.uiCtrlApp                = uiCtrlApp;
            this.externalEvent            = externalEvent;
            this.eventHandler             = eventHandler;
            this.elementProtectionUpdater = elementProtectionUpdater;

            // Initialize Front-end Controllers
            this.selectionController = new ElementSelectionController(
                ElementSelectionPanel,
                ElementSelectionLabel,
                ElementSelectionTreeView);
            OptionVisibilityController optionVisibility = new OptionVisibilityController(
                OptionVisibilityPanel,
                OptionVisibilityCheckBox);
            OptionFilterController optionFilter = new OptionFilterController(
                OptionFilterPanel,
                OptionFilterRadioButton0,
                OptionFilterRadioButton1,
                OptionFilterRadioButton2);
            OptionHideNodeController optionHideNode = new OptionHideNodeController(
                OptionHideNodePanel,
                OptionHideNodeCheckedListBox);

            this.optionController = new OptionController(OptionPanel, optionVisibility, optionFilter, optionHideNode);

            ActionAxisController xAxis = new ActionAxisController(
                ActionShiftPanel0, ActionShiftLabel0, ActionShiftTextBox0);

            ActionAxisController yAxis = new ActionAxisController(
                ActionShiftPanel1, ActionShiftLabel1, ActionShiftTextBox1);

            ActionAxisController zAxis = new ActionAxisController(
                ActionShiftPanel2, ActionShiftLabel2, ActionShiftTextBox2);

            ActionModeController mode = new ActionModeController(
                ActionModePanel, ActionModeRadioButton0, ActionModeRadioButton1);

            List <ActionAxisController> xyz = new List <ActionAxisController>()
            {
                xAxis, yAxis, zAxis
            };

            this.actionController = new ActionController(
                ActionPanel, ActionResetButton, ActionShiftButton, ActionPromptLabel, xyz, mode);

            // Initialize Back-end Controllers
            this.revitController  = new RevitController(commandData);
            this.dataController   = new DataController(this.doc);
            this.requestHandler   = new RequestHandler();
            this.filterController = new FilterController(this.revitController);

            // Get elementList, not sure what to use it for
            elementList = elementList.Where(e => null != e.Category && e.Category.HasMaterialQuantities).ToList();

            // Execute method ModelessForm_FormClosed when the form is closing
            this.FormClosing += this.ModelessForm_FormClosed;
        }