예제 #1
0
        public ActionController(
            Panel panel,
            Button resetButton,
            Button shiftButton,
            Label promptLabel,
            List <ActionAxisController> xyz,
            ActionModeController mode
            )
        {
            if (xyz.Count != 3)
            {
                throw new ArgumentException();
            }

            this.panel       = panel ?? throw new ArgumentNullException();
            this.resetButton = resetButton ?? throw new ArgumentNullException();
            this.shiftButton = shiftButton ?? throw new ArgumentNullException();
            this.promptLabel = promptLabel ?? throw new ArgumentNullException();

            this.xAxis = xyz[0];
            this.yAxis = xyz[1];
            this.zAxis = xyz[2];

            this.mode = mode ?? throw new ArgumentNullException();
        }
예제 #2
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;
        }